mirror of
				https://github.com/jhasse/poly2tri.git
				synced 2025-11-04 14:09:33 +01:00 
			
		
		
		
	fixed edge pointer bug - yay
This commit is contained in:
		@@ -1,60 +1,60 @@
 | 
			
		||||
2158.9981,2350.2286
 | 
			
		||||
2158.9981,3245.4557
 | 
			
		||||
-1042.9463,3245.4557
 | 
			
		||||
-1042.9463,2496.1895
 | 
			
		||||
91.149593,800.20639
 | 
			
		||||
441.75649,251.73749
 | 
			
		||||
648.06929,-97.04991
 | 
			
		||||
765.46219,-332.30851
 | 
			
		||||
849.31479,-540.20071
 | 
			
		||||
899.62689,-720.72671
 | 
			
		||||
916.39869,-873.88651
 | 
			
		||||
896.13819,-1060.7944
 | 
			
		||||
835.35969,-1193.3788
 | 
			
		||||
789.54889,-1239.4959
 | 
			
		||||
733.15879,-1272.4376
 | 
			
		||||
666.18939,-1292.204
 | 
			
		||||
588.64059,-1298.7951
 | 
			
		||||
511.08979,-1291.4964
 | 
			
		||||
444.11959,-1269.6012
 | 
			
		||||
387.73029,-1233.1107
 | 
			
		||||
341.92169,-1182.0263
 | 
			
		||||
306.46619,-1109.2461
 | 
			
		||||
281.14119,-1007.6808
 | 
			
		||||
260.88259,-718.19491
 | 
			
		||||
260.88259,-218.68401
 | 
			
		||||
-1042.9463,-218.68401
 | 
			
		||||
-1042.9463,-410.05511
 | 
			
		||||
-1030.3404,-804.55201
 | 
			
		||||
-992.52205,-1105.8022
 | 
			
		||||
-958.08057,-1232.6032
 | 
			
		||||
-905.18018,-1358.3923
 | 
			
		||||
-833.82067,-1483.1695
 | 
			
		||||
-744.00213,-1606.9348
 | 
			
		||||
-637.5262,-1722.6871
 | 
			
		||||
-516.1928,-1823.4397
 | 
			
		||||
-380.00205,-1909.1927
 | 
			
		||||
-228.95374,-1979.9461
 | 
			
		||||
-62.599167,-2035.2866
 | 
			
		||||
119.51329,-2074.8167
 | 
			
		||||
317.38399,-2098.5364
 | 
			
		||||
531.01279,-2106.4456
 | 
			
		||||
938.57049,-2082.2155
 | 
			
		||||
1122.512,-2051.9328
 | 
			
		||||
1293.2285,-2009.5383
 | 
			
		||||
1450.7202,-1955.0316
 | 
			
		||||
1594.987,-1888.4129
 | 
			
		||||
1726.0289,-1809.6817
 | 
			
		||||
1843.846,-1718.8382
 | 
			
		||||
2038.4505,-1512.159
 | 
			
		||||
2177.4543,-1279.7356
 | 
			
		||||
2260.8578,-1021.5681
 | 
			
		||||
2288.6606,-737.65631
 | 
			
		||||
2273.0151,-508.98211
 | 
			
		||||
2226.0792,-273.82221
 | 
			
		||||
2147.8538,-32.17651
 | 
			
		||||
2038.3398,215.95519
 | 
			
		||||
1852.2859,537.88159
 | 
			
		||||
1544.4495,1000.9025
 | 
			
		||||
1114.8304,1605.018
 | 
			
		||||
563.42839,2350.2286
 | 
			
		||||
2158.9981 2350.2286
 | 
			
		||||
2158.9981 3245.4557
 | 
			
		||||
-1042.9463 3245.4557
 | 
			
		||||
-1042.9463 2496.1895
 | 
			
		||||
91.149593 800.20639
 | 
			
		||||
441.75649 251.73749
 | 
			
		||||
648.06929 -97.04991
 | 
			
		||||
765.46219 -332.30851
 | 
			
		||||
849.31479 -540.20071
 | 
			
		||||
899.62689 -720.72671
 | 
			
		||||
916.39869 -873.88651
 | 
			
		||||
896.13819 -1060.7944
 | 
			
		||||
835.35969 -1193.3788
 | 
			
		||||
789.54889 -1239.4959
 | 
			
		||||
733.15879 -1272.4376
 | 
			
		||||
666.18939 -1292.204
 | 
			
		||||
588.64059 -1298.7951
 | 
			
		||||
511.08979 -1291.4964
 | 
			
		||||
444.11959 -1269.6012
 | 
			
		||||
387.73029 -1233.1107
 | 
			
		||||
341.92169 -1182.0263
 | 
			
		||||
306.46619 -1109.2461
 | 
			
		||||
281.14119 -1007.6808
 | 
			
		||||
260.88259 -718.19491
 | 
			
		||||
260.88259 -218.68401
 | 
			
		||||
-1042.9463 -218.68401
 | 
			
		||||
-1042.9463 -410.05511
 | 
			
		||||
-1030.3404 -804.55201
 | 
			
		||||
-992.52205 -1105.8022
 | 
			
		||||
-958.08057 -1232.6032
 | 
			
		||||
-905.18018 -1358.3923
 | 
			
		||||
-833.82067 -1483.1695
 | 
			
		||||
-744.00213 -1606.9348
 | 
			
		||||
-637.5262 -1722.6871
 | 
			
		||||
-516.1928 -1823.4397
 | 
			
		||||
-380.00205 -1909.1927
 | 
			
		||||
-228.95374 -1979.9461
 | 
			
		||||
-62.599167 -2035.2866
 | 
			
		||||
119.51329 -2074.8167
 | 
			
		||||
317.38399 -2098.5364
 | 
			
		||||
531.01279 -2106.4456
 | 
			
		||||
938.57049 -2082.2155
 | 
			
		||||
1122.512 -2051.9328
 | 
			
		||||
1293.2285 -2009.5383
 | 
			
		||||
1450.7202 -1955.0316
 | 
			
		||||
1594.987 -1888.4129
 | 
			
		||||
1726.0289 -1809.6817
 | 
			
		||||
1843.846 -1718.8382
 | 
			
		||||
2038.4505 -1512.159
 | 
			
		||||
2177.4543 -1279.7356
 | 
			
		||||
2260.8578 -1021.5681
 | 
			
		||||
2288.6606 -737.65631
 | 
			
		||||
2273.0151 -508.98211
 | 
			
		||||
2226.0792 -273.82221
 | 
			
		||||
2147.8538 -32.17651
 | 
			
		||||
2038.3398 215.95519
 | 
			
		||||
1852.2859 537.88159
 | 
			
		||||
1544.4495 1000.9025
 | 
			
		||||
1114.8304 1605.018
 | 
			
		||||
563.42839 2350.2286
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
0 130 
 | 
			
		||||
-270 0 
 | 
			
		||||
130 -40 
 | 
			
		||||
10 -60 
 | 
			
		||||
10 -60
 | 
			
		||||
-10 -20 
 | 
			
		||||
100 30 
 | 
			
		||||
40 -40
 | 
			
		||||
@@ -44,8 +44,8 @@ using namespace std;
 | 
			
		||||
 | 
			
		||||
void Init();
 | 
			
		||||
void ShutDown(int return_code);
 | 
			
		||||
void MainLoop();
 | 
			
		||||
void Draw();
 | 
			
		||||
void MainLoop(const double zoom);
 | 
			
		||||
void Draw(const double zoom);
 | 
			
		||||
 
 | 
			
		||||
float rotate_y = 0,
 | 
			
		||||
      rotate_z = 0;
 | 
			
		||||
@@ -63,6 +63,11 @@ double StringToDouble(const std::string& s) {
 | 
			
		||||
 | 
			
		||||
int main(int argc, char* argv[]) {
 | 
			
		||||
  
 | 
			
		||||
  if (argc != 3) {
 | 
			
		||||
    cout << "Usage: p2t filename zoom" << endl;
 | 
			
		||||
    return 1;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
	/*
 | 
			
		||||
  // initialize random seed: 
 | 
			
		||||
  srand ( time(NULL) );
 | 
			
		||||
@@ -112,9 +117,9 @@ int main(int argc, char* argv[]) {
 | 
			
		||||
  int num_points = points.size();
 | 
			
		||||
  cout << "Number of points = " << num_points << endl;
 | 
			
		||||
  
 | 
			
		||||
	Point* polyline = new Point[num_points];
 | 
			
		||||
	Point** polyline = new Point *[num_points];
 | 
			
		||||
  for(int i = 0; i < num_points; i++) {
 | 
			
		||||
    polyline[i] = points[i];
 | 
			
		||||
    polyline[i] = &points[i];
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  Init();
 | 
			
		||||
@@ -128,7 +133,7 @@ int main(int argc, char* argv[]) {
 | 
			
		||||
  
 | 
			
		||||
  triangles = cdt->GetTriangles();
 | 
			
		||||
  
 | 
			
		||||
  MainLoop();
 | 
			
		||||
  MainLoop(atof(argv[2]));
 | 
			
		||||
  
 | 
			
		||||
  delete [] polyline;
 | 
			
		||||
  ShutDown(0);
 | 
			
		||||
@@ -161,7 +166,7 @@ void ShutDown(int return_code)
 | 
			
		||||
  exit(return_code);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
void MainLoop()
 | 
			
		||||
void MainLoop(const double zoom)
 | 
			
		||||
{
 | 
			
		||||
  // the time of the previous frame
 | 
			
		||||
  double old_time = glfwGetTime();
 | 
			
		||||
@@ -187,7 +192,7 @@ void MainLoop()
 | 
			
		||||
    rotate_z += delta_rotate;
 | 
			
		||||
 
 | 
			
		||||
    // Draw the scene
 | 
			
		||||
    Draw();
 | 
			
		||||
    Draw(zoom);
 | 
			
		||||
    // swap back and front buffers
 | 
			
		||||
    glfwSwapBuffers();
 | 
			
		||||
  }
 | 
			
		||||
@@ -217,11 +222,12 @@ void ResetZoom(double zoom, double cx, double cy, double width, double height) {
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
    
 | 
			
		||||
void Draw()
 | 
			
		||||
void Draw(const double zoom)
 | 
			
		||||
{
 | 
			
		||||
  // reset zoom
 | 
			
		||||
  double zoom = 0.5;
 | 
			
		||||
  ResetZoom(zoom, 0, 0, 800, 600);
 | 
			
		||||
  Point center = Point(0, 0);
 | 
			
		||||
  
 | 
			
		||||
  ResetZoom(zoom, center.x, center.y, 800, 600);
 | 
			
		||||
  
 | 
			
		||||
  list<Triangle*>::iterator it; 
 | 
			
		||||
  for (it = triangles.begin(); it != triangles.end(); it++) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user