1. CONVEX PARTITIONING OF A POLYGON INTO MINIMIZED NUMBER OF
PIECES
K. R. Wijeweera, S. R. Kodituwakku
Paper:
https://www.academia.edu/32022683/Convex_Partitioning_of_a_Polygon_into_Smaller_Numbe
r_of_Pieces_with_Lowest_Memory_Consumption
APPENDIX
This section includes the implementation of the proposed algorithm in C programming language.
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include"D:/header/grap.h"
double x[]={40,50,80,130,140,150,250,190,140,90,80,30,20,50,20,40,10};
double y[]={10,40,10,20,70,20,90,130,80,70,130,180,140,120,100,60,50};
int points=17;
int reflex[20];
int secs=0;
double sx[20];
double sy[20];
double ex[20];
double ey[20];
double xn,yn,xg,yg;
int found;
int dpx(double x)
{
int p;
p=(int)(x+0.5);
return p;
}
15. setSectors1();
setSectors2();
setcolor(10);
drawSectors();
getch();
gexit();
}
Following is the set of polygons used for comparing with the Hertel Mehlhorn algorithm.
Comparison results are shown in Table 1 and Table2.
// 1
double
x[]={165,15,45,60,90,15,60,15,150,60,150,90,210,270,405,270,195,315,255,330,480,420,525,48
0,435,405,555,345};
double
y[]={15,45,135,75,165,135,240,315,240,195,165,105,165,285,270,225,90,165,150,225,180,300,
255,150,180,150,75,150};
int points=28;
// 2
double x[]={210,255,345,420,465,495,420,420,180,330,90,135,180,90,120,45,120,30};
double y[]={30,180,225,180,255,255,315,285,345,255,255,270,330,285,345,285,225,165};
int points=18;
// 3
double
x[]={210,450,390,300,360,270,270,360,285,225,285,240,195,90,120,15,60,120,90,45,45,15,120,
150,150};
double
y[]={90,195,240,195,180,180,195,255,360,300,315,180,300,240,315,225,120,195,90,90,45,15,6
0,30,225};
int points=25;
// 4
double
x[]={300,345,465,540,600,495,390,435,390,285,345,390,285,300,135,195,75,30,135,180,330,19
5,270,270,435};
16. double
y[]={45,15,60,195,225,270,210,195,180,300,210,165,165,255,315,195,135,30,90,30,135,105,24
0,150,150};
int points=25;
// 5
double x[]={255,480,480,600,600,480,390,330,210,120,105,255,60,15,90,15,120,165,90,210};
double y[]={60,165,120,120,240,195,285,150,240,165,225,300,345,270,165,45,15,105,90,210};
int points=20;
// 6
double x[]={180,270,435,555,405,465,300,390,240,45,255,330,195,240,90,210,105,165,30};
double y[]={15,135,45,165,270,165,165,225,330,210,270,210,165,225,180,135,75,45,45};
int points=19;
// 7
double x[]={75,330,510,300,375,270,390,300,150,300,75,240,60,30,120};
double y[]={30,30,210,345,195,150,150,75,120,210,210,300,315,30,195};
int points=15;
// 8
double x[]={225,405,540,420,300,480,225,75,300,240,195,195,270,210,150,45,90,45,225};
double y[]={45,90,15,150,90,315,360,195,285,210,225,150,180,105,180,165,90,30,75};
int points=19;
// 9
double x[]={330,510,570,495,510,420,465,360,210,300,135,225,120,30,240,345,225,345,420};
double y[]={45,15,225,165,120,150,180,330,360,285,240,60,135,45,15,135,105,285,90};
int points=19;
// 10
double x[]={345,450,510,345,405,210,360,255,270,225,285,90,165,240,30,30,180,150};
double y[]={105,30,240,165,315,270,120,180,195,180,105,270,135,90,90,15,75,15};
int points=18;
// 11
double x[]={330,465,345,345,405,405,240,330,210,135,270,330,330,195,225,150,75,45};
double y[]={30,225,330,180,240,165,165,270,330,195,90,135,60,90,105,150,105,30};
int points=18;