From 2da0bb6268b4eb9e73b4f04d7a3116c4735cc2d2 Mon Sep 17 00:00:00 2001 From: Nico Kruithof Date: Thu, 24 Aug 2006 07:36:47 +0000 Subject: [PATCH] In the mixed complex point location, remember the previous mixed cell to avoid predicates Make private examples working and don't test them (added to dont_submit) --- .../NGHK_skin_surface_simple.cpp | 6 +-- .../NGHK_skin_surface_subdiv.cpp | 33 ++++++++----- .../examples/Skin_surface_3/makefile | 4 +- Skin_surface_3/include/CGAL/Skin_surface_3.h | 47 +++++++++---------- 4 files changed, 49 insertions(+), 41 deletions(-) diff --git a/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_simple.cpp b/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_simple.cpp index bd4fe57428c..3c4bac20573 100644 --- a/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_simple.cpp +++ b/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_simple.cpp @@ -1,4 +1,5 @@ -//#define CGAL_PROFILE +#define CGAL_PROFILE +#define CGAL_NO_ASSERTIONS // examples/Skin_surface_3/skin_surface_simple.C #include @@ -42,9 +43,6 @@ int main(int argc, char *argv[]) { std::cout << "Meshing ..." << std::endl; CGAL::mesh_skin_surface_3(skin_surface, p); - std::cout << "Subdividing ..." << std::endl; - CGAL::subdivide_skin_surface_mesh_3(p, skin_surface,1); - std::cout << "Is closed: " << (p.is_closed() ? "Yes" : "No") << std::endl; std::ofstream out("mesh.off"); diff --git a/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_subdiv.cpp b/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_subdiv.cpp index 96efd36f059..798ccc34df5 100644 --- a/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_subdiv.cpp +++ b/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_subdiv.cpp @@ -1,21 +1,27 @@ // examples/Skin_surface_3/NGHK_skin_surface_subdiv.C +#define CGAL_PROFILE +#define CGAL_NO_ASSERTIONS + #include #include #include #include -#include +#include #include +#include #include "skin_surface_writer.h" -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Regular_triangulation_euclidean_traits_3 Traits; -typedef CGAL::Skin_surface_3 Skin_surface_3; -typedef Skin_surface_3::RT RT; -typedef Skin_surface_3::Weighted_point Weighted_point; -typedef Weighted_point::Point Bare_point; -typedef CGAL::Skin_surface_polyhedral_items_3 Poly_items; -typedef CGAL::Polyhedron_3 Polyhedron; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Skin_surface_traits_3 Traits; +typedef CGAL::Skin_surface_3 Skin_surface_3; +typedef Skin_surface_3::RT RT; +typedef Skin_surface_3::Weighted_point Weighted_point; +typedef Weighted_point::Point Bare_point; +typedef CGAL::Polyhedron_3< + CGAL::Simple_cartesian, + CGAL::Skin_surface_polyhedral_items_3 + > Polyhedron; int main(int argc, char *argv[]) { if (argc < 2) { @@ -28,14 +34,19 @@ int main(int argc, char *argv[]) { Weighted_point wp; std::ifstream in(argv[1]); - while (in >> wp) l.push_front(wp); + while (in >> wp) l.push_back(wp); Skin_surface_3 skin_surface(l.begin(), l.end(), shrinkfactor, false); Polyhedron p; + + std::cout << "Meshing ..." << std::endl; CGAL::mesh_skin_surface_3(skin_surface, p); - CGAL::subdivide_skin_surface_mesh_3(p, skin_surface); + std::cout << "Subdividing ..." << std::endl; + CGAL::subdivide_skin_surface_mesh_3(p, skin_surface, 1); + + std::cout << "Is closed: " << (p.is_closed() ? "Yes" : "No") << std::endl; std::ofstream out("mesh.off"); write_polyhedron_with_normals(p, skin_surface, out); diff --git a/Skin_surface_3/examples/Skin_surface_3/makefile b/Skin_surface_3/examples/Skin_surface_3/makefile index 366e7352f52..5aa22e7869b 100644 --- a/Skin_surface_3/examples/Skin_surface_3/makefile +++ b/Skin_surface_3/examples/Skin_surface_3/makefile @@ -13,7 +13,7 @@ include $(CGAL_MAKEFILE) # compiler flags #---------------------------------------------------------------------# -CXXFLAGS = \ +CXXFLAGS = -pg\ -I.\ -Idsrpdb/include\ -I../../include \ @@ -30,7 +30,7 @@ LIBPATH = \ $(TESTSUITE_LIBPATH) \ $(CGAL_LIBPATH) -LDFLAGS = \ +LDFLAGS = -pg\ $(TESTSUITE_LDFLAGS) \ $(LONG_NAME_PROBLEM_LDFLAGS) \ $(CGAL_LDFLAGS) diff --git a/Skin_surface_3/include/CGAL/Skin_surface_3.h b/Skin_surface_3/include/CGAL/Skin_surface_3.h index c09a2bc0868..f854f8646b9 100644 --- a/Skin_surface_3/include/CGAL/Skin_surface_3.h +++ b/Skin_surface_3/include/CGAL/Skin_surface_3.h @@ -578,7 +578,7 @@ template typename Skin_surface_3::Simplex Skin_surface_3:: locate_mixed(const Bare_point &p, const Simplex &start) const { - Simplex /*prev,*/ s; + Simplex prev, s; if (start == Simplex()) { Cell_handle ch = regular.locate(p); if (regular.is_infinite(ch->vertex(0))) { s = ch->vertex(1); } @@ -613,15 +613,14 @@ locate_mixed(const Bare_point &p, const Simplex &start) const { for (int i=0; ipoint(), nbs[index]->point(), p) == POSITIVE) { - //prev = s; - bool b = regular.is_edge(vh, nbs[index], ch, i1, i2); - CGAL_assertion(b); + prev = s; + regular.is_edge(vh, nbs[index], ch, i1, i2); s = Edge(ch,i1,i2); goto try_next_cell; } - //} + } } } break; @@ -644,38 +643,38 @@ locate_mixed(const Bare_point &p, const Simplex &start) const { if (index < nrFacets) { // Check incident facets: if (!regular.is_infinite(*fcir)) { - //if (prev != Simplex(fcir)) { + if (prev != Simplex(fcir)) { i1 = (*fcir).first->index(vh1); i2 = (*fcir).first->index(vh2); Vertex_handle vh3 = (*fcir).first->vertex(6-(*fcir).second-i1-i2); if (side_tester(vh1->point(), vh2->point(), vh3->point(), p) == POSITIVE) { - //prev = s; + prev = s; s = fcir; goto try_next_cell; } - //} + } } fcir++; } else { // Check incident vertices: if (index==nrFacets) { - //if (prev != Simplex(vh1)) { + if (prev != Simplex(vh1)) { if (side_tester(vh1->point(), vh2->point(), p) == NEGATIVE) { - //prev = s; + prev = s; s = vh1; goto try_next_cell; } - //} + } } else { - //if (prev != Simplex(vh2)) { + if (prev != Simplex(vh2)) { if (side_tester(vh2->point(), vh1->point(), p) == NEGATIVE) { - //prev = s; + prev = s; s = vh2; goto try_next_cell; } - //} + } } } } @@ -697,16 +696,16 @@ locate_mixed(const Bare_point &p, const Simplex &start) const { } CGAL_assertion(!regular.has_vertex(f, ch->vertex(i1))); if (!regular.is_infinite(ch->vertex(i1))) { - //if (prev != Simplex(ch)) { + if (prev != Simplex(ch)) { if (side_tester(ch->vertex((i1+1)&3)->point(), ch->vertex((i1+2)&3)->point(), ch->vertex((i1+3)&3)->point(), ch->vertex(i1)->point(), p) == POSITIVE) { - //prev = s; + prev = s; s = ch; goto try_next_cell; } - //} + } } } else { // Check incident edges (index = 0,1,2) @@ -719,14 +718,14 @@ locate_mixed(const Bare_point &p, const Simplex &start) const { Vertex_handle vh2 = f.first->vertex(i2); Vertex_handle vh3 = f.first->vertex(i3); - //if (prev != Simplex(Edge(f.first,i1,i2))) { + if (prev != Simplex(Edge(f.first,i1,i2))) { if (side_tester(vh1->point(), vh2->point(), vh3->point(), p) == NEGATIVE) { - //prev = s; + prev = s; s = Edge(f.first,i1,i2); goto try_next_cell; } - //} + } } } break; @@ -736,16 +735,16 @@ locate_mixed(const Bare_point &p, const Simplex &start) const { Cell_handle ch = s; int index = rng.get_int(0,4); for (int i=0; i<4; i++, index = (index+1)&3) { - //if (prev != Simplex(Facet(ch, index))) { + if (prev != Simplex(Facet(ch, index))) { if (side_tester(ch->vertex((index+1)&3)->point(), ch->vertex((index+2)&3)->point(), ch->vertex((index+3)&3)->point(), ch->vertex(index)->point(), p) == NEGATIVE) { - //prev = s; + prev = s; s = Facet(ch, index); goto try_next_cell; } - //} + } } break; }