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)
This commit is contained in:
Nico Kruithof 2006-08-24 07:36:47 +00:00
parent 150ecf7520
commit 2da0bb6268
4 changed files with 49 additions and 41 deletions

View File

@ -1,4 +1,5 @@
//#define CGAL_PROFILE #define CGAL_PROFILE
#define CGAL_NO_ASSERTIONS
// examples/Skin_surface_3/skin_surface_simple.C // examples/Skin_surface_3/skin_surface_simple.C
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -42,9 +43,6 @@ int main(int argc, char *argv[]) {
std::cout << "Meshing ..." << std::endl; std::cout << "Meshing ..." << std::endl;
CGAL::mesh_skin_surface_3(skin_surface, p); 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::cout << "Is closed: " << (p.is_closed() ? "Yes" : "No") << std::endl;
std::ofstream out("mesh.off"); std::ofstream out("mesh.off");

View File

@ -1,21 +1,27 @@
// examples/Skin_surface_3/NGHK_skin_surface_subdiv.C // examples/Skin_surface_3/NGHK_skin_surface_subdiv.C
#define CGAL_PROFILE
#define CGAL_NO_ASSERTIONS
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Skin_surface_3.h> #include <CGAL/Skin_surface_3.h>
#include <CGAL/Polyhedron_3.h> #include <CGAL/Polyhedron_3.h>
#include <CGAL/mesh_skin_surface_3.h> #include <CGAL/mesh_skin_surface_3.h>
#include <CGAL/subdivide_skin_surface_mesh_3.h> #include <CGAL/Skin_surface_polyhedral_items_3.h>
#include <list> #include <list>
#include <fstream>
#include "skin_surface_writer.h" #include "skin_surface_writer.h"
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Regular_triangulation_euclidean_traits_3<K> Traits; typedef CGAL::Skin_surface_traits_3<K> Traits;
typedef CGAL::Skin_surface_3<Traits> Skin_surface_3; typedef CGAL::Skin_surface_3<Traits> Skin_surface_3;
typedef Skin_surface_3::RT RT; typedef Skin_surface_3::RT RT;
typedef Skin_surface_3::Weighted_point Weighted_point; typedef Skin_surface_3::Weighted_point Weighted_point;
typedef Weighted_point::Point Bare_point; typedef Weighted_point::Point Bare_point;
typedef CGAL::Skin_surface_polyhedral_items_3<Skin_surface_3> Poly_items; typedef CGAL::Polyhedron_3<
typedef CGAL::Polyhedron_3<K,Poly_items> Polyhedron; CGAL::Simple_cartesian<double>,
CGAL::Skin_surface_polyhedral_items_3<Skin_surface_3>
> Polyhedron;
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (argc < 2) { if (argc < 2) {
@ -28,14 +34,19 @@ int main(int argc, char *argv[]) {
Weighted_point wp; Weighted_point wp;
std::ifstream in(argv[1]); 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); Skin_surface_3 skin_surface(l.begin(), l.end(), shrinkfactor, false);
Polyhedron p; Polyhedron p;
std::cout << "Meshing ..." << std::endl;
CGAL::mesh_skin_surface_3(skin_surface, p); 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"); std::ofstream out("mesh.off");
write_polyhedron_with_normals(p, skin_surface, out); write_polyhedron_with_normals(p, skin_surface, out);

View File

@ -13,7 +13,7 @@ include $(CGAL_MAKEFILE)
# compiler flags # compiler flags
#---------------------------------------------------------------------# #---------------------------------------------------------------------#
CXXFLAGS = \ CXXFLAGS = -pg\
-I.\ -I.\
-Idsrpdb/include\ -Idsrpdb/include\
-I../../include \ -I../../include \
@ -30,7 +30,7 @@ LIBPATH = \
$(TESTSUITE_LIBPATH) \ $(TESTSUITE_LIBPATH) \
$(CGAL_LIBPATH) $(CGAL_LIBPATH)
LDFLAGS = \ LDFLAGS = -pg\
$(TESTSUITE_LDFLAGS) \ $(TESTSUITE_LDFLAGS) \
$(LONG_NAME_PROBLEM_LDFLAGS) \ $(LONG_NAME_PROBLEM_LDFLAGS) \
$(CGAL_LDFLAGS) $(CGAL_LDFLAGS)

View File

@ -578,7 +578,7 @@ template <class MixedComplexTraits_3>
typename Skin_surface_3<MixedComplexTraits_3>::Simplex typename Skin_surface_3<MixedComplexTraits_3>::Simplex
Skin_surface_3<MixedComplexTraits_3>:: Skin_surface_3<MixedComplexTraits_3>::
locate_mixed(const Bare_point &p, const Simplex &start) const { locate_mixed(const Bare_point &p, const Simplex &start) const {
Simplex /*prev,*/ s; Simplex prev, s;
if (start == Simplex()) { if (start == Simplex()) {
Cell_handle ch = regular.locate(p); Cell_handle ch = regular.locate(p);
if (regular.is_infinite(ch->vertex(0))) { s = ch->vertex(1); } 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; i<nrNbs; i++, index = (index+1)%nrNbs) { for (int i=0; i<nrNbs; i++, index = (index+1)%nrNbs) {
if (!regular.is_infinite(nbs[index])) { if (!regular.is_infinite(nbs[index])) {
//if (prev != Simplex(nbs[index])) { if (prev != Simplex(nbs[index])) {
if (side_tester(vh->point(), nbs[index]->point(), p) == POSITIVE) { if (side_tester(vh->point(), nbs[index]->point(), p) == POSITIVE) {
//prev = s; prev = s;
bool b = regular.is_edge(vh, nbs[index], ch, i1, i2); regular.is_edge(vh, nbs[index], ch, i1, i2);
CGAL_assertion(b);
s = Edge(ch,i1,i2); s = Edge(ch,i1,i2);
goto try_next_cell; goto try_next_cell;
} }
//} }
} }
} }
break; break;
@ -644,38 +643,38 @@ locate_mixed(const Bare_point &p, const Simplex &start) const {
if (index < nrFacets) { if (index < nrFacets) {
// Check incident facets: // Check incident facets:
if (!regular.is_infinite(*fcir)) { if (!regular.is_infinite(*fcir)) {
//if (prev != Simplex(fcir)) { if (prev != Simplex(fcir)) {
i1 = (*fcir).first->index(vh1); i1 = (*fcir).first->index(vh1);
i2 = (*fcir).first->index(vh2); i2 = (*fcir).first->index(vh2);
Vertex_handle vh3 = (*fcir).first->vertex(6-(*fcir).second-i1-i2); Vertex_handle vh3 = (*fcir).first->vertex(6-(*fcir).second-i1-i2);
if (side_tester(vh1->point(), vh2->point(), vh3->point(), if (side_tester(vh1->point(), vh2->point(), vh3->point(),
p) == POSITIVE) { p) == POSITIVE) {
//prev = s; prev = s;
s = fcir; s = fcir;
goto try_next_cell; goto try_next_cell;
} }
//} }
} }
fcir++; fcir++;
} else { } else {
// Check incident vertices: // Check incident vertices:
if (index==nrFacets) { if (index==nrFacets) {
//if (prev != Simplex(vh1)) { if (prev != Simplex(vh1)) {
if (side_tester(vh1->point(), vh2->point(), p) == NEGATIVE) { if (side_tester(vh1->point(), vh2->point(), p) == NEGATIVE) {
//prev = s; prev = s;
s = vh1; s = vh1;
goto try_next_cell; goto try_next_cell;
} }
//} }
} else { } else {
//if (prev != Simplex(vh2)) { if (prev != Simplex(vh2)) {
if (side_tester(vh2->point(), vh1->point(), p) == NEGATIVE) { if (side_tester(vh2->point(), vh1->point(), p) == NEGATIVE) {
//prev = s; prev = s;
s = vh2; s = vh2;
goto try_next_cell; 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))); CGAL_assertion(!regular.has_vertex(f, ch->vertex(i1)));
if (!regular.is_infinite(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(), if (side_tester(ch->vertex((i1+1)&3)->point(),
ch->vertex((i1+2)&3)->point(), ch->vertex((i1+2)&3)->point(),
ch->vertex((i1+3)&3)->point(), ch->vertex((i1+3)&3)->point(),
ch->vertex(i1)->point(), p) == POSITIVE) { ch->vertex(i1)->point(), p) == POSITIVE) {
//prev = s; prev = s;
s = ch; s = ch;
goto try_next_cell; goto try_next_cell;
} }
//} }
} }
} else { } else {
// Check incident edges (index = 0,1,2) // 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 vh2 = f.first->vertex(i2);
Vertex_handle vh3 = f.first->vertex(i3); 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(), if (side_tester(vh1->point(), vh2->point(), vh3->point(),
p) == NEGATIVE) { p) == NEGATIVE) {
//prev = s; prev = s;
s = Edge(f.first,i1,i2); s = Edge(f.first,i1,i2);
goto try_next_cell; goto try_next_cell;
} }
//} }
} }
} }
break; break;
@ -736,16 +735,16 @@ locate_mixed(const Bare_point &p, const Simplex &start) const {
Cell_handle ch = s; Cell_handle ch = s;
int index = rng.get_int(0,4); int index = rng.get_int(0,4);
for (int i=0; i<4; i++, index = (index+1)&3) { 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(), if (side_tester(ch->vertex((index+1)&3)->point(),
ch->vertex((index+2)&3)->point(), ch->vertex((index+2)&3)->point(),
ch->vertex((index+3)&3)->point(), ch->vertex((index+3)&3)->point(),
ch->vertex(index)->point(), p) == NEGATIVE) { ch->vertex(index)->point(), p) == NEGATIVE) {
//prev = s; prev = s;
s = Facet(ch, index); s = Facet(ch, index);
goto try_next_cell; goto try_next_cell;
} }
//} }
} }
break; break;
} }