code cleanup

This commit is contained in:
zzzzrrr
2010-01-22 15:22:08 -05:00
parent 2df225041f
commit ac40ef4631
7 changed files with 17 additions and 139 deletions

View File

@@ -29,7 +29,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "advancing_front.h"
#include "mesh.h"
#include "sweep_context.h"
#include "sweep.h"

View File

@@ -1,49 +0,0 @@
/*
* Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
* http://code.google.com/p/poly2tri/
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of Poly2Tri nor the names of its contributors may be
* used to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "mesh.h"
// Recursively collect interior triangles and clean the mesh
// Excludes exterior triangles outside constrained edges
// Depth first search
void Mesh::clean(Triangle& triangle)
{
/*
if(triangle != NULL && !triangle.interior)
{
triangle.interior = true;
triangles += triangle;
for(i <- 0 until 3)
if(!triangle.edges(i))
clean(triangle.neighbors(i));
}
*/
}

View File

@@ -1,48 +0,0 @@
/*
* Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
* http://code.google.com/p/poly2tri/
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of Poly2Tri nor the names of its contributors may be
* used to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <vector>
using namespace std;
class Triangle;
class Mesh
{
public:
/// Triangles that constitute the mesh
vector<Triangle> map;
// Debug triangles
//val debug = new ArrayBuffer[Triangle]
//val triangles = new ArrayBuffer[Triangle]
void clean(Triangle& triangle);
};

View File

@@ -79,25 +79,8 @@ void SweepContext::InitTriangulation()
tail_ = new Point(xmin - dx, ymin - dy);
// Sort points along y-axis
double init_time = glfwGetTime();
std::sort(points_, points_ + point_count_, cmp);
double dt = glfwGetTime() - init_time;
printf("Sort time (secs) = %f\n", dt);
/*
printf("*************************\n");
for (int i = 0; i < point_count_; i++) {
printf("%f,%f ", points_[i]->x, points_[i]->y);
printf("%p\n", points_[i]);
}
/*
printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
for(int i = 0; i < edge_list.size(); i++) {
edge_list[i]->p->DebugPrint(); edge_list[i]->q->DebugPrint();
printf("%p, %p\n", edge_list[i]->p, edge_list[i]->q);
}
*/
}
void SweepContext::InitEdges(Point** polyline, const int& point_count)
@@ -106,13 +89,6 @@ void SweepContext::InitEdges(Point** polyline, const int& point_count)
int j = i < point_count - 1 ? i + 1 : 0;
edge_list.push_back(new Edge(*polyline[i], *polyline[j]));
}
/*
for(int i = 0; i < edge_list.size(); i++) {
edge_list[i]->p->DebugPrint(); edge_list[i]->q->DebugPrint();
printf("%p, %p\n", edge_list[i]->p, edge_list[i]->q);
}
*/
}
Point* SweepContext::GetPoint(const int& index)