refactoring

This commit is contained in:
Peter Hachenberger 2003-09-15 09:02:26 +00:00
parent 8d72a4c2e8
commit 7970c9d2c4
5 changed files with 384 additions and 418 deletions

View File

@ -18,12 +18,13 @@
// revision : $Revision$ // revision : $Revision$
// revision_date : $Date$ // revision_date : $Date$
// //
// author(s) : Michael Seel <seel@mpi-sb.mpg.de> // author(s) : Michael Seel <seel@mpi-sb.mpg.de>
// Miguel Granados <granados@mpi-sb.mpg.de> // Miguel Granados <granados@mpi-sb.mpg.de>
// Susan Hert <hert@mpi-sb.mpg.de> // Susan Hert <hert@mpi-sb.mpg.de>
// Lutz Kettner <kettner@mpi-sb.mpg.de> // Lutz Kettner <kettner@mpi-sb.mpg.de>
// maintainer : Susan Hert <hert@mpi-sb.mpg.de> // Peter Hachenberger <hachenberger@mpi-sb.mpg.de>
// Lutz Kettner <kettner@mpi-sb.mpg.de> // maintainer : Peter Hachenberger <hachenberger@mpi-sb.mpg.de>
// Lutz Kettner <kettner@mpi-sb.mpg.de>
// coordinator : MPI Saarbruecken // coordinator : MPI Saarbruecken
// //
// SNC_constructor.h construction of basic SNCs and global construction // SNC_constructor.h construction of basic SNCs and global construction
@ -264,6 +265,8 @@ public:
DECUSING(SHalfedge_around_svertex_circulator); DECUSING(SHalfedge_around_svertex_circulator);
#undef DECUSING #undef DECUSING
enum{NORMAL, CORNER, DEGENERATE};
Vertex_handle minVertex; Vertex_handle minVertex;
typedef void* GenPtr; typedef void* GenPtr;
@ -371,68 +374,10 @@ public:
volumes. \precond |categorize_facet_cycles_and_creating_facets()| was volumes. \precond |categorize_facet_cycles_and_creating_facets()| was
called before.}*/ called before.}*/
Halffacet_handle get_facet_below( Vertex_handle vi) const;
Volume_handle determine_volume( SFace_handle sf, Volume_handle determine_volume( SFace_handle sf,
const std::vector< Vertex_handle>& MinimalVertex, const std::vector< Vertex_handle>& MinimalVertex,
const Sface_shell_hash& Shell ) const const Sface_shell_hash& Shell ) const;
/*{\Mop determines the volume |C| that a shell |S| pointed by |sf|
belongs to. \precondition |S| separates the volume |C| from an enclosed
volume.}*/ {
TRACEN("determine volume");
Vertex_handle v_min = MinimalVertex[Shell[sf]];
Halffacet_handle f_below = get_facet_below(v_min);
if ( f_below == Halffacet_handle())
return Base(*this).volumes_begin();
Volume_handle c = volume(f_below);
if( c != Volume_handle()) {
TRACE( "Volume " << &*c << " hit ");
TRACEN("(Shell #" << Shell[adjacent_sface(f_below)] << ")");
return c;
}
SFace_handle sf_below = adjacent_sface(f_below);
TRACE( "Shell not assigned to a volume hit ");
TRACEN( "(Inner shell #" << Shell[sf_below] << ")");
c = determine_volume( sf_below, MinimalVertex, Shell);
link_as_inner_shell( sf_below, c);
return c;
}
Halffacet_handle get_facet_below( Vertex_handle vi) const
// {\Mop determines the facet below a vertex |vi| via ray shooting. }
{
Halffacet_handle f_below;
Point_3 p = point(vi);
if(!Infi_box::is_standard(p))
return Halffacet_handle();
Ray_3 ray = Ray_3(p, Direction_3(-1,0,0));
SNC_ray_shooter rs(*sncp());
Object_handle o = rs.shoot(ray);
Vertex_handle v;
Halfedge_handle e;
Halffacet_handle f;
TRACEN("get_facet_below");
if( assign(v, o)) {
TRACEN("facet below from from vertex...");
f_below = get_visible_facet(v, ray);
if( f_below == Halffacet_handle())
f_below = get_facet_below(v);
}
else if( assign(e, o)) {
TRACEN("facet below from from edge...");
f_below = get_visible_facet(e, ray);
if( f_below == Halffacet_handle())
f_below = get_facet_below(vertex(e));
}
else if( assign(f, o)) {
TRACEN("facet below from from facet...");
f_below = get_visible_facet(f, ray);
CGAL_nef3_assertion( f_below != Halffacet_handle());
}
else { TRACEN("no facet below found..."); }
return f_below;
}
void create_vertices_of_box_with_plane(const Plane_3& h, bool b); void create_vertices_of_box_with_plane(const Plane_3& h, bool b);
void create_frame_point(Point_3 p, Point_3 sp1, Point_3 sp2, void create_frame_point(Point_3 p, Point_3 sp1, Point_3 sp2,
@ -443,6 +388,9 @@ public:
int min,int max, Plane_3 h, int min,int max, Plane_3 h,
bool boundary)const; bool boundary)const;
void create_SM_on_infibox(Point_3 center, Sphere_point* SP, int size,
bool boundary, bool fmark0) const;
}; // SNC_constructor<SNC> }; // SNC_constructor<SNC>
@ -453,7 +401,7 @@ create_vertices_of_box_with_plane(const Plane_3& h, bool b) {
// SETDTHREAD(19*43*11); // SETDTHREAD(19*43*11);
Point_3 loc(-h.d(),0,0,h.a()); // Point_3 loc(-h.d(),0,0,h.a());
Vector_3 orth = h.orthogonal_vector(); Vector_3 orth = h.orthogonal_vector();
NT orth_coords[3]; NT orth_coords[3];
@ -462,8 +410,10 @@ create_vertices_of_box_with_plane(const Plane_3& h, bool b) {
orth_coords[2] = orth.hz()[0]; orth_coords[2] = orth.hz()[0];
int add_corners = 0; int add_corners = 0;
while(orth_coords[add_corners] == 0) add_corners++; while(orth_coords[add_corners] == 0){
CGAL_assertion(add_corners < 3); CGAL_assertion(add_corners < 2);
add_corners++;
}
std::list<Point_3> points; std::list<Point_3> points;
for(int dir=0; dir<3;++dir) { for(int dir=0; dir<3;++dir) {
@ -499,7 +449,7 @@ create_vertices_of_box_with_plane(const Plane_3& h, bool b) {
cross[i][3])); cross[i][3]));
} }
for(int i=0;i<2;i++) for(int i=0;i<3;i++)
orth_coords[i] = CGAL_NTS abs(orth_coords[i]); orth_coords[i] = CGAL_NTS abs(orth_coords[i]);
int max = 0; int max = 0;
@ -608,6 +558,11 @@ SNC_constructor<SNC_>::
create_frame_point(Point_3 p, Point_3 sp1, Point_3 sp2, create_frame_point(Point_3 p, Point_3 sp1, Point_3 sp2,
Plane_3 h, bool boundary) const { Plane_3 h, bool boundary) const {
if(h.d() == 0) {
CGAL_nef3_assertion(CGAL_NTS abs(p.hy()) != CGAL_NTS abs(p.hx()) ||
CGAL_NTS abs(p.hz()) != CGAL_NTS abs(p.hx()));
}
int max = 0; int max = 0;
if(CGAL_NTS abs(p.hx()) > CGAL_NTS abs(p.hy())) if(CGAL_NTS abs(p.hx()) > CGAL_NTS abs(p.hy()))
max = 1; max = 1;
@ -615,79 +570,31 @@ create_frame_point(Point_3 p, Point_3 sp1, Point_3 sp2,
max = 2; max = 2;
TRACEN("create frame point "); TRACEN("create frame point ");
Vertex_handle v=sncp()->new_vertex(p, boundary);
SM_decorator SD(v);
TRACEN("create spoints"); TRACEN("create spoints");
Sphere_point SP[4]; Sphere_point SP[4];
switch(max) { switch(max) {
case 0: SP[1] = Sphere_point(1,0,0); break; case 0: SP[2] = Sphere_point(1,0,0); break;
case 1: SP[1] = Sphere_point(0,1,0); break; case 1: SP[2] = Sphere_point(0,1,0); break;
case 2: SP[1] = Sphere_point(0,0,1); break; case 2: SP[2] = Sphere_point(0,0,1); break;
default: CGAL_nef3_assertion_msg(0,"wrong value"); default: CGAL_nef3_assertion_msg(0,"wrong value");
} }
SP[0]=sp1; SP[1]=sp1;
SP[2]=sp2; SP[0]=sp2;
if (spherical_orientation(SP[0],SP[1],SP[2]) < 0) { if (spherical_orientation(SP[0],SP[1],SP[2]) < 0) {
SP[3] = SP[1]; SP[3] = SP[2];
SP[1] = -Vector_3(SP[3]); SP[2] = -Vector_3(SP[3]);
} }
else else
SP[3] = -Vector_3(SP[1]); SP[3] = -Vector_3(SP[2]);
RT delta = h.a()*SP[1].hx()+h.b()*SP[1].hy()+h.c()*SP[1].hz(); RT delta = h.a()*SP[2].hx()+h.b()*SP[2].hy()+h.c()*SP[2].hz();
CGAL_nef3_assertion(delta !=0); CGAL_nef3_assertion(delta !=0);
bool fmark0 = (delta < 0); bool fmark0 = (delta < 0);
TRACEN("create svertices"); create_SM_on_infibox(p, SP, 4, boundary, fmark0);
SVertex_handle sv[4];
for(int i=0; i<4; ++i) {
sv[i] = SD.new_vertex(SP[i]);
mark(sv[i]) = boundary;
}
TRACEN("create sedges");
SHalfedge_handle she[5];
for(int si=0; si<3;++si) {
she[si]=SD.new_edge_pair(sv[si], sv[(si+1)%3]);
SD.circle(she[si])=
Sphere_circle(Plane_3(SP[si],SP[(si+1)%3],Point_3(0,0,0)));
SD.circle(SD.twin(she[si])) = SD.circle(she[si]).opposite();
SD.mark(she[si]) = boundary;
}
she[3] = SD.new_edge_pair(SD.twin(she[2]), sv[3],1);
she[4] = SD.new_edge_pair(she[2],sv[3],-1);
CGAL_nef3_assertion(SD.next(she[0]) == she[1]);
CGAL_nef3_assertion(SD.next(she[1]) == she[2]);
CGAL_nef3_assertion(SD.next(she[2]) == she[0]);
SD.circle(she[3])= Sphere_circle(Plane_3(SP[0],SP[3],Point_3(0,0,0)));
SD.circle(SD.twin(she[3])) = SD.circle(she[3]).opposite();
SD.mark(she[3]) = boundary;
// SD.mark(SD.twin(she[3])) = !fmark0;
SD.circle(she[4])= Sphere_circle(Plane_3(SP[2],SP[3],Point_3(0,0,0)));
SD.circle(SD.twin(she[4])) = SD.circle(she[4]).opposite();
SD.mark(she[4]) = boundary;
// SD.mark(SD.twin(she[4])) = !fmark0;
SFace_handle sf[3];
for(int i=0; i<3; ++i)
sf[i] = SD.new_face();
SD.mark(sf[0])= fmark0;
SD.mark(sf[1])=!fmark0;
SD.mark(sf[2])= 0;
SD.link_as_face_cycle(she[0],sf[0]);
SD.link_as_face_cycle(SD.twin(she[2]),sf[1]);
SD.link_as_face_cycle(SD.twin(she[0]),sf[2]);
SM_point_locator L(v);
L.init_marks_of_halfspheres();
} }
template <typename SNC_> template <typename SNC_>
@ -696,126 +603,66 @@ SNC_constructor<SNC_>::
create_corner_frame_point(Point_3 p, Point_3 sp1, Point_3 sp2, create_corner_frame_point(Point_3 p, Point_3 sp1, Point_3 sp2,
int max, Plane_3 h, bool boundary) const { int max, Plane_3 h, bool boundary) const {
CGAL_nef3_assertion(h.d() == 0);
Vector_3 vec = h.orthogonal_vector();
CGAL_nef3_assertion(CGAL_NTS abs(vec.hx()) != CGAL_NTS abs(vec.hy()) &&
CGAL_NTS abs(vec.hy()) != CGAL_NTS abs(vec.hz()) &&
CGAL_NTS abs(vec.hx()) != CGAL_NTS abs(vec.hz()));
CGAL_nef3_assertion(vec.hx() + vec.hy() == vec.hz() ||
vec.hx() + vec.hz() == vec.hy() ||
vec.hy() + vec.hz() == vec.hx());
TRACEN("create corner frame point "); TRACEN("create corner frame point ");
Vertex_handle v=sncp()->new_vertex(p, boundary);
SM_decorator SD(v);
RT vp[3]; RT vp[3];
vp[0] = -v->point().hx()[1]; vp[0] = -p.hx()[1];
vp[1] = -v->point().hy()[1]; vp[1] = -p.hy()[1];
vp[2] = -v->point().hz()[1]; vp[2] = -p.hz()[1];
TRACEN("create spoints"); TRACEN("create spoints");
Sphere_point SP[5]; Sphere_point SP[5];
switch(max) { switch(max) {
case 0: case 0:
SP[0] = Sphere_point(0,vp[1],0); SP[3] = Sphere_point(0,vp[1],0);
SP[3]= Sphere_point(0,0,vp[2]); SP[2]= Sphere_point(0,0,vp[2]);
SP[4] = Sphere_point(vp[0],0,0); SP[4] = Sphere_point(vp[0],0,0);
break; break;
case 1: case 1:
SP[0] = Sphere_point(vp[0],0,0); SP[3] = Sphere_point(vp[0],0,0);
SP[3]= Sphere_point(0,0,vp[2]); SP[2]= Sphere_point(0,0,vp[2]);
SP[4] = Sphere_point(0,vp[1],0); SP[4] = Sphere_point(0,vp[1],0);
break; break;
case 2: case 2:
SP[0] = Sphere_point(vp[0],0,0); SP[3] = Sphere_point(vp[0],0,0);
SP[3]= Sphere_point(0,vp[1],0); SP[2]= Sphere_point(0,vp[1],0);
SP[4] = Sphere_point(0,0,vp[2]); SP[4] = Sphere_point(0,0,vp[2]);
break; break;
default: CGAL_nef3_assertion_msg(0,"wrong value"); default: CGAL_nef3_assertion_msg(0,"wrong value");
} }
if (spherical_orientation(SP[0],Sphere_point(sp1),Sphere_point(sp2)) > 0) { if (spherical_orientation(SP[3],Sphere_point(sp1),Sphere_point(sp2)) > 0) {
SP[1] = sp1; SP[0] = sp1;
SP[2] = sp2; SP[1] = sp2;
} }
else { else {
SP[1] = sp2; SP[0] = sp2;
SP[2] = sp1; SP[1] = sp1;
} }
if (spherical_orientation(SP[3],SP[0],SP[1]) < 0) { if (spherical_orientation(SP[2],SP[3],SP[0]) < 0) {
Sphere_point sx = SP[3]; Sphere_point sx = SP[2];
SP[3] = SP[0]; SP[2] = SP[3];
SP[0] = sx; SP[3] = sx;
} }
RT delta = h.a()*SP[4].hx()+h.b()*SP[4].hy()+h.c()*SP[4].hz(); RT delta = h.a()*SP[4].hx()+h.b()*SP[4].hy()+h.c()*SP[4].hz();
CGAL_nef3_assertion(delta !=0); CGAL_nef3_assertion(delta !=0);
bool fmark0 = (delta > 0); bool fmark0 = (delta > 0);
TRACEN("create svertices"); create_SM_on_infibox(p, SP, 5, boundary, fmark0);
SVertex_handle sv[5];
for(int i=0; i<5; ++i) {
TRACEN("svertex " << SP[i]);
sv[i] = SD.new_vertex(SP[i]);
mark(sv[i]) = boundary;
}
TRACEN("create sedges");
SHalfedge_handle she[6];
for(int si=0; si<4;++si) {
she[si]=SD.new_edge_pair(sv[si], sv[(si+1)%4]);
SD.circle(she[si])=
Sphere_circle(Plane_3(SP[si],SP[(si+1)%4],Point_3(0,0,0)));
SD.circle(SD.twin(she[si])) = SD.circle(she[si]).opposite();
SD.mark(she[si]) = boundary;
}
she[4] = SD.new_edge_pair(she[1],sv[4],-1);
CGAL_nef3_assertion(SD.next(she[0]) == she[1]);
CGAL_nef3_assertion(SD.next(she[1]) == she[2]);
CGAL_nef3_assertion(SD.next(she[2]) == she[3]);
CGAL_nef3_assertion(SD.next(she[3]) == she[0]);
CGAL_nef3_assertion(SD.next(SD.twin(she[1])) == she[4]);
CGAL_nef3_assertion(SD.next(she[4]) == SD.twin(she[4]));
CGAL_nef3_assertion(SD.next(SD.twin(she[4])) == SD.twin(she[0]));
she[5] = SD.new_edge_pair(sv[4],she[2],-1);
CGAL_nef3_assertion(SD.next(she[0]) == she[1]);
CGAL_nef3_assertion(SD.next(she[1]) == she[2]);
CGAL_nef3_assertion(SD.next(she[2]) == she[3]);
CGAL_nef3_assertion(SD.next(she[3]) == she[0]);
CGAL_nef3_assertion(SD.next(she[4]) == she[5]);
CGAL_nef3_assertion(SD.next(she[5]) == SD.twin(she[1]));
CGAL_nef3_assertion(SD.next(SD.twin(she[1])) == she[4]);
CGAL_nef3_assertion(SD.next(she[4]) == she[5]);
CGAL_nef3_assertion(spherical_orientation(SP[1],SP[4],SP[2]) > 0);
SD.circle(she[4])=
Sphere_circle(Plane_3(SP[1],SP[4],Point_3(0,0,0)));
SD.circle(SD.twin(she[4])) = SD.circle(she[4]).opposite();
SD.mark(she[4]) = boundary;
SD.circle(she[5])=
Sphere_circle(Plane_3(SP[4],SP[2],Point_3(0,0,0)));
SD.circle(SD.twin(she[5])) = SD.circle(she[5]).opposite();
SD.mark(she[5]) = 1;
TRACEN("create sfaces");
SFace_handle sf[3];
for(int i=0; i<3; ++i)
sf[i] = SD.new_face();
SD.mark(sf[0])=fmark0;
SD.mark(sf[1])=!fmark0;
SD.mark(sf[2])=0;
TRACEN("link faces");
SD.link_as_face_cycle(she[0],sf[0]);
SD.link_as_face_cycle(SD.twin(she[1]),sf[1]);
SD.link_as_face_cycle(SD.twin(she[0]),sf[2]);
TRACEN("fpwc sedges");
SHalfedge_handle se;
CGAL_nef3_forall_shalfedges(se,SM_decorator(v))
TRACEN(PH(se));
SM_point_locator L(v);
L.init_marks_of_halfspheres();
} }
template <typename SNC_> template <typename SNC_>
@ -825,77 +672,112 @@ create_degenerate_corner_frame_point(Point_3 p, Point_3 sp1, Point_3 sp2,
int min, int max, Plane_3 h, int min, int max, Plane_3 h,
bool boundary) const { bool boundary) const {
TRACEN("create degenerate corner frame point "); CGAL_nef3_assertion(h.d() == 0);
Vertex_handle v=sncp()->new_vertex(p, boundary);
SM_decorator SD(v); Vector_3 vec = h.orthogonal_vector();
CGAL_nef3_assertion(
(CGAL_NTS abs(vec.hx()) == CGAL_NTS abs(vec.hy()) && vec.hz() == 0) ||
(CGAL_NTS abs(vec.hy()) == CGAL_NTS abs(vec.hz()) && vec.hx() == 0) ||
(CGAL_NTS abs(vec.hx()) == CGAL_NTS abs(vec.hz()) && vec.hy() == 0));
RT vp[3]; RT vp[3];
vp[0] = -p.hx()[1]; vp[0] = -p.hx()[1];
vp[1] = -p.hy()[1]; vp[1] = -p.hy()[1];
vp[2] = -p.hz()[1]; vp[2] = -p.hz()[1];
TRACEN("create degenerate corner frame point ");
TRACEN("create spoints"); TRACEN("create spoints");
Sphere_point SP[4]; Sphere_point SP[4];
switch(max) { switch(max) {
case 0: SP[0] = Sphere_point(vp[0],0,0); break; case 0: SP[2] = Sphere_point(vp[0],0,0); break; // plane(x,x,0), plane(x,0,x)
case 1: SP[0] = Sphere_point(0,vp[1],0); break; case 1: SP[2] = Sphere_point(0,vp[1],0); break; // plane(0,x,x)
case 2: SP[0] = Sphere_point(0,0,vp[2]); break;
default: CGAL_nef3_assertion_msg(0,"wrong value \"max\""); default: CGAL_nef3_assertion_msg(0,"wrong value \"max\"");
} }
switch(min+max) { switch(min+max) {
case 1: SP[3] = Sphere_point(0,0,vp[2]); break; case 1: SP[3] = Sphere_point(0,0,vp[2]); break; // plane(0,x,x), plane(x,0,x)
case 2: SP[3] = Sphere_point(0,vp[1],0); break; case 2: SP[3] = Sphere_point(0,vp[1],0); break; // plane(x,x,0)
case 3: SP[3] = Sphere_point(vp[0],0,0); break;
default: CGAL_nef3_assertion_msg(0,"wrong value \"min+max\""); default: CGAL_nef3_assertion_msg(0,"wrong value \"min+max\"");
} }
if (spherical_orientation(SP[0],Sphere_point(sp1),Sphere_point(sp2)) > 0) { if (spherical_orientation(SP[2],Sphere_point(sp1),Sphere_point(sp2)) > 0) {
SP[1] = sp1; SP[0] = sp1;
SP[2] = sp2; SP[1] = sp2;
} }
else { else {
SP[1] = sp2; SP[0] = sp2;
SP[2] = sp1; SP[1] = sp1;
} }
RT delta = h.a()*SP[0].hx()+h.b()*SP[0].hy()+h.c()*SP[0].hz(); RT delta = h.a()*SP[2].hx()+h.b()*SP[2].hy()+h.c()*SP[2].hz();
CGAL_nef3_assertion(delta !=0); CGAL_nef3_assertion(delta !=0);
bool fmark0 = (delta < 0); bool fmark0 = (delta < 0);
create_SM_on_infibox(p, SP, 4, boundary, fmark0);
}
template <typename SNC_>
void
SNC_constructor<SNC_>::
create_SM_on_infibox(Point_3 center, Sphere_point* SP, int size,
bool boundary, bool fmark0) const {
Vertex_handle v=sncp()->new_vertex(center, boundary);
SM_decorator SD(v);
TRACEN("create svertices"); TRACEN("create svertices");
SVertex_handle sv[4]; SVertex_handle sv[size];
for(int i=0; i<4; ++i) { for(int i=0; i<size; ++i) {
sv[i] = SD.new_vertex(SP[i]); sv[i] = SD.new_vertex(SP[i]);
mark(sv[i]) = boundary; mark(sv[i]) = boundary;
} }
TRACEN("create sedges"); TRACEN("create sedges");
SHalfedge_handle she[5]; SHalfedge_handle she[size+1];
for(int si=0; si<3;++si) { for(int si=0; si<size-1;++si) {
she[si]=SD.new_edge_pair(sv[si], sv[(si+1)%3]); she[si]=SD.new_edge_pair(sv[si], sv[(si+1)%(size-1)]);
SD.circle(she[si])= SD.circle(she[si])=
Sphere_circle(Plane_3(SP[si],SP[(si+1)%3],Point_3(0,0,0))); Sphere_circle(Plane_3(SP[si],SP[(si+1)%(size-1)],Point_3(0,0,0)));
SD.circle(SD.twin(she[si])) = SD.circle(she[si]).opposite(); SD.circle(SD.twin(she[si])) = SD.circle(she[si]).opposite();
SD.mark(she[si]) = boundary; SD.mark(she[si]) = boundary;
} }
she[3] = SD.new_edge_pair(sv[3],she[1],-1); she[size-1] = SD.new_edge_pair(she[0], sv[size-1], -1);
she[4] = SD.new_edge_pair(sv[3],SD.twin(she[1]),1); she[size] = SD.new_edge_pair(sv[size-1], SD.twin(she[0]), 1);
CGAL_nef3_assertion(SD.next(she[0]) == she[1]); CGAL_nef3_assertion(SD.next(she[0]) == she[1]);
CGAL_nef3_assertion(SD.next(she[1]) == she[2]); CGAL_nef3_assertion(SD.next(she[1]) == she[2]);
CGAL_nef3_assertion(SD.next(she[2]) == she[0]); if(size == 4)
CGAL_nef3_assertion(SD.next(she[2]) == she[0]);
else {
CGAL_nef3_assertion(SD.next(she[2]) == she[3]);
CGAL_nef3_assertion(SD.next(she[3]) == she[0]);
}
SD.circle(SD.twin(she[3]))= CGAL_nef3_assertion(SD.next(SD.twin(she[0])) == she[size-1]);
Sphere_circle(Plane_3(SP[1],SP[3],Point_3(0,0,0))); CGAL_nef3_assertion(SD.next(she[size-1]) == she[size]);
SD.circle(she[3]) = SD.circle(SD.twin(she[3])).opposite(); CGAL_nef3_assertion(SD.next(she[size]) == SD.twin(she[0]));
SD.mark(she[3]) = boundary;
SD.circle(she[4])= Sphere_circle(Plane_3(SP[3],SP[2],Point_3(0,0,0))); CGAL_nef3_assertion(SD.next(SD.twin(she[4])) == SD.twin(she[3]));
SD.circle(SD.twin(she[4])) = SD.circle(she[4]).opposite(); CGAL_nef3_assertion(SD.next(SD.twin(she[3])) == SD.twin(she[2]));
SD.mark(she[4]) = boundary; CGAL_nef3_assertion(SD.next(SD.twin(she[2])) == SD.twin(she[1]));
if(size == 4)
CGAL_nef3_assertion(SD.next(SD.twin(she[1])) == SD.twin(she[4]));
else {
CGAL_nef3_assertion(SD.next(SD.twin(she[5])) == SD.twin(she[4]));
CGAL_nef3_assertion(SD.next(SD.twin(she[1])) == SD.twin(she[5]));
}
SD.circle(she[size-1])= Sphere_circle(Plane_3(SP[0],SP[size-1],Point_3(0,0,0)));
SD.circle(SD.twin(she[size-1])) = SD.circle(she[size-1]).opposite();
SD.mark(she[size-1]) = boundary;
SD.circle(she[size])= Sphere_circle(Plane_3(SP[size-1],SP[1],Point_3(0,0,0)));
SD.circle(SD.twin(she[size])) = SD.circle(she[size]).opposite();
SD.mark(she[size]) = boundary;
TRACEN("create sfaces"); TRACEN("create sfaces");
SFace_handle sf[3]; SFace_handle sf[3];
@ -906,8 +788,8 @@ create_degenerate_corner_frame_point(Point_3 p, Point_3 sp1, Point_3 sp2,
SD.mark(sf[2])=0; SD.mark(sf[2])=0;
SD.link_as_face_cycle(she[0],sf[0]); SD.link_as_face_cycle(she[0],sf[0]);
SD.link_as_face_cycle(SD.twin(she[1]),sf[1]); SD.link_as_face_cycle(SD.twin(she[0]),sf[1]);
SD.link_as_face_cycle(SD.twin(she[0]),sf[2]); SD.link_as_face_cycle(SD.twin(she[1]),sf[2]);
SM_point_locator L(v); SM_point_locator L(v);
L.init_marks_of_halfspheres(); L.init_marks_of_halfspheres();
@ -984,6 +866,7 @@ create_extended_box_corner(int x,int y,int z,bool space,bool boundary) const {
TRACEN(" constructing box corner on "<<Point_3(x,y,z)<<"..."); TRACEN(" constructing box corner on "<<Point_3(x,y,z)<<"...");
Point_3 p = Infi_box::create_extended_point(x,y,z); Point_3 p = Infi_box::create_extended_point(x,y,z);
Vertex_handle v = sncp()->new_vertex(p , boundary); Vertex_handle v = sncp()->new_vertex(p , boundary);
TRACEN( point(v));
SM_decorator SD(v); SM_decorator SD(v);
Sphere_point sp[] = { Sphere_point(-x, 0, 0), Sphere_point sp[] = { Sphere_point(-x, 0, 0),
Sphere_point(0, -y, 0), Sphere_point(0, -y, 0),
@ -1166,6 +1049,77 @@ create_from_edge(Halfedge_handle e,
return v; return v;
} }
template <typename SNC_>
typename SNC_::Halffacet_handle
SNC_constructor<SNC_>::
get_facet_below( Vertex_handle vi) const {
// {\Mop determines the facet below a vertex |vi| via ray shooting. }
Halffacet_handle f_below;
Point_3 p = point(vi);
if(!Infi_box::is_standard(p))
return Halffacet_handle();
Ray_3 ray = Ray_3(p, Direction_3(-1,0,0));
SNC_ray_shooter rs(*sncp());
Object_handle o = rs.shoot(ray);
Vertex_handle v;
Halfedge_handle e;
Halffacet_handle f;
TRACEN("get_facet_below");
if( assign(v, o)) {
TRACEN("facet below from from vertex...");
f_below = get_visible_facet(v, ray);
if( f_below == Halffacet_handle())
f_below = get_facet_below(v);
}
else if( assign(e, o)) {
TRACEN("facet below from from edge...");
f_below = get_visible_facet(e, ray);
if( f_below == Halffacet_handle())
f_below = get_facet_below(vertex(e));
}
else if( assign(f, o)) {
TRACEN("facet below from from facet...");
f_below = get_visible_facet(f, ray);
CGAL_nef3_assertion( f_below != Halffacet_handle());
}
else { TRACEN("no facet below found..."); }
return f_below;
}
template <typename SNC_>
typename SNC_::Volume_handle
SNC_constructor<SNC_>::
determine_volume( SFace_handle sf,
const std::vector< Vertex_handle>& MinimalVertex,
const Sface_shell_hash& Shell ) const {
//{\Mop determines the volume |C| that a shell |S| pointed by |sf|
// belongs to. \precondition |S| separates the volume |C| from an enclosed
// volume.}
TRACEN("determine volume");
Vertex_handle v_min = MinimalVertex[Shell[sf]];
Halffacet_handle f_below = get_facet_below(v_min);
if ( f_below == Halffacet_handle())
return Base(*this).volumes_begin();
Volume_handle c = volume(f_below);
if( c != Volume_handle()) {
TRACE( "Volume " << &*c << " hit ");
TRACEN("(Shell #" << Shell[adjacent_sface(f_below)] << ")");
return c;
}
SFace_handle sf_below = adjacent_sface(f_below);
TRACE( "Shell not assigned to a volume hit ");
TRACEN( "(Inner shell #" << Shell[sf_below] << ")");
c = determine_volume( sf_below, MinimalVertex, Shell);
link_as_inner_shell( sf_below, c);
return c;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// pair_up_halfedges() // pair_up_halfedges()
// Starting from all local graphs of all vertices of a nef polyhedron // Starting from all local graphs of all vertices of a nef polyhedron

View File

@ -133,6 +133,8 @@ public:
} }
}; };
enum {NO_SNC, WITH_SNC};
public: public:
typedef void* GenPtr; typedef void* GenPtr;
@ -726,6 +728,7 @@ public:
#endif // CGAL_NEF3_DUMP_SPHERE_MAPS #endif // CGAL_NEF3_DUMP_SPHERE_MAPS
CGAL_assertion( point(v0) == point(v1)); CGAL_assertion( point(v0) == point(v1));
Vertex_handle v01 = rsnc.new_vertex( point(v0), BOP( mark(v0),mark(v1))); Vertex_handle v01 = rsnc.new_vertex( point(v0), BOP( mark(v0),mark(v1)));
// cerr << "BOP Vertex " << mark(v0) << " " << mark(v1) << std::endl;
TRACEN(" binop result on vertex "<<&*v01<<" on "<<&*(v01->sncp())); TRACEN(" binop result on vertex "<<&*v01<<" on "<<&*(v01->sncp()));
SM_overlayer O(v01); SM_overlayer O(v01);
O.subdivide( v0, v1); O.subdivide( v0, v1);
@ -999,10 +1002,10 @@ public:
O.print(); O.print();
#endif // CGAL_NEF3_DUMP_SNC_OPERATORS #endif // CGAL_NEF3_DUMP_SNC_OPERATORS
/*
// remove vertices whose local view is not that of a vertex // remove vertices whose local view is not that of a vertex
Vertex_iterator vi, vin; Vertex_iterator vi, vin(v1);
for( vi = result.vertices_begin(); vi != result.vertices_end(); vi = vin) { for( vi = result.vertices_begin(); vi != result.vertices_end(); vi = vin) {
vin = vi;
vin++; vin++;
SM_decorator SD(vi); SM_decorator SD(vi);
if( (result.is_part_of_volume(vi) && if( (result.is_part_of_volume(vi) &&
@ -1012,11 +1015,13 @@ public:
mark(vi) == SD.mark(SD.shalfloop())) mark(vi) == SD.mark(SD.shalfloop()))
|| ||
(result.is_part_of_edge(vi) && (result.is_part_of_edge(vi) &&
mark(vi) == SD.mark(SD.svertices_begin()))) mark(vi) == SD.mark(SD.svertices_begin()) &&
mark(vi) == SD.mark(++(SD.svertices_begin())))
result.delete_vertex(vi); result.delete_vertex(vi);
} }
*/
// compute_all_marks_of_halfspaces(); result.vertex_simplification(NO_SNC);
// synthesis of spatial structure // synthesis of spatial structure
@ -1027,7 +1032,7 @@ public:
C.link_shalfedges_to_facet_cycles(); C.link_shalfedges_to_facet_cycles();
C.categorize_facet_cycles_and_create_facets(); C.categorize_facet_cycles_and_create_facets();
C.create_volumes(); C.create_volumes();
result.simplify(); CGAL_nef3_assertion(!result.simplify());
#ifdef CGAL_NEF3_DUMP_SNC_OPERATORS #ifdef CGAL_NEF3_DUMP_SNC_OPERATORS
TRACEN("=> construction completed, result: "); TRACEN("=> construction completed, result: ");

View File

@ -196,24 +196,8 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
if( h.has_on( seg.source())) if( h.has_on( seg.source()))
/* no possible internal intersection */ /* no possible internal intersection */
return false; return false;
#ifdef REDUNDANT_CODE
/* This optimization might be inside of |intersection()| code */
Oriented_side os1 = h.oriented_side(seg.source());
Oriented_side os2 = h.oriented_side(seg.target());
TRACEN( "-> endpoint plane side " << os1 << " " << os2);
CGAL_nef3_assertion( h.has_on(p));
CGAL_nef3_assertion( seg.has_on(p));
if (os1 == os2)
return false;
#endif //REDUNDANT_CODE
Object o = intersection( h, seg); Object o = intersection( h, seg);
Ray_3 s; if( !assign( p, o))
if ( assign( s, o) ) {
CGAL_nef3_assertion( s == seg );
TRACEN( "-> seg belongs to facet's plane." << p );
return false;
}
else if( !assign( p, o))
return false; return false;
TRACEN( "-> intersection point " << p ); TRACEN( "-> intersection point " << p );
TRACEN( "-> point in facet? "<<locate_point_in_halffacet(p, f)); TRACEN( "-> point in facet? "<<locate_point_in_halffacet(p, f));
@ -223,6 +207,7 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
bool does_intersect_internally( const Segment_3& seg, bool does_intersect_internally( const Segment_3& seg,
const Halffacet_const_handle f, const Halffacet_const_handle f,
Point_3& p) const { Point_3& p) const {
if(plane(f).has_on(seg.target())) return false;
return (does_intersect_internally(Ray_3(seg.source(),seg.target()),f,p) return (does_intersect_internally(Ray_3(seg.source(),seg.target()),f,p)
&& seg.has_on(p)); && seg.has_on(p));
} }

View File

@ -911,63 +911,6 @@ public:
put_sface_node(&*h); put_sface_node(&*h);
} }
SNC_io_parser<SNC_structure> *IO;
typedef typename Union_find< Volume_handle>::handle UFH_volume;
typedef typename Union_find< Halffacet_handle>::handle UFH_facet;
typedef typename Union_find< SFace_handle>::handle UFH_sface;
void remove_f_including_all_edge_uses_in_its_boundary_cycles
( Halffacet_handle f,
Unique_hash_map< SFace_handle, UFH_sface>& hash,
Union_find< SFace_handle>& uf )
/* removes f and its boundary cycles, and merges up the sphere facets
incident to them. */ {
SNC_decorator D;
Halffacet_cycle_iterator fc;
CGAL_nef3_forall_facet_cycles_of(fc, f) {
SHalfedge_handle e;
SHalfloop_handle l;
if( assign(e, fc) ) {
SHalfedge_around_facet_circulator u(e), eend(e);
CGAL_For_all(u, eend) {
SFace_handle fu = D.sface(u), ftu = D.sface(D.twin(u));
TRACEN("sfUNION of "<<IO->index(fu)<<" & "<<IO->index(ftu));
merge_sets( fu, ftu, hash, uf);
SM_decorator SD(D.vertex(u));
TRACEN("removing "<<IO->index(u)<<" & "<<IO->index(SD.twin(u)));
Halfedge_handle src(SD.source(u)), tgt(SD.target(u));
if ( SD.is_closed_at_source(u) )
SD.set_face( src, fu);
if ( SD.is_closed_at_source( SD.twin(u)) )
SD.set_face( tgt, fu);
/* TO VERIFY: does is_closed_at_source(u) imply is_isolated(src)?
if it is true, the svertex face update is not necesary. */
SD.delete_edge_pair(u);
if( SD.is_isolated(src))
// SD.delete_vertex_only(src);
SD.set_face(src,fu);
SM_decorator SD2(D.vertex(tgt));
if( SD2.is_isolated(tgt))
// SD.delete_vertex_only(tgt);
SD2.set_face(tgt,fu);
/* TO VERIFY: can both svertices be isolated at the same time? */
}
}
else if( assign(l, fc)) {
SFace_handle fu = D.sface(l), ftu = D.sface(D.twin(l));
TRACEN("UNION of "<<IO->index(fu)<<" & "<<IO->index(ftu));
merge_sets( fu, ftu, hash, uf);
SM_decorator SD(D.vertex(l));
TRACEN("removing "<<IO->index(l)<<" & "<<IO->index(SD.twin(l)));
SD.delete_loop_only();
}
}
TRACEN("removing "<<IO->index(f)<<" & "<<IO->index(D.twin(f)));
delete_halffacet_pair(f);
return;
}
char PSE(SHalfedge_handle h) char PSE(SHalfedge_handle h)
/* prints a sphere segment */ { /* prints a sphere segment */ {
SNC_decorator D; SNC_decorator D;
@ -1021,6 +964,66 @@ public:
return '.'; return '.';
} }
SNC_io_parser<SNC_structure> *IO;
typedef typename Union_find< Volume_handle>::handle UFH_volume;
typedef typename Union_find< Halffacet_handle>::handle UFH_facet;
typedef typename Union_find< SFace_handle>::handle UFH_sface;
void remove_f_including_all_edge_uses_in_its_boundary_cycles
( Halffacet_handle f,
Unique_hash_map< SFace_handle, UFH_sface>& hash,
Union_find< SFace_handle>& uf )
/* removes f and its boundary cycles, and merges up the sphere facets
incident to them. */ {
SNC_decorator D;
Halffacet_cycle_iterator fc;
CGAL_nef3_forall_facet_cycles_of(fc, f) {
SHalfedge_handle e;
SHalfloop_handle l;
if( assign(e, fc) ) {
SHalfedge_around_facet_circulator u(e), eend(e);
CGAL_For_all(u, eend) {
SFace_handle fu = D.sface(u), ftu = D.sface(D.twin(u));
TRACEN("sfUNION of "<<IO->index(fu)<<" & "<<IO->index(ftu));
merge_sets( fu, ftu, hash, uf);
SM_decorator SD(D.vertex(u));
TRACEN("removing "<<IO->index(u)<<" & "<<IO->index(SD.twin(u)));
Halfedge_handle src(SD.source(u)), tgt(SD.target(u));
if ( SD.is_closed_at_source(u) )
SD.set_face( src, fu);
if ( SD.is_closed_at_source( SD.twin(u)) )
SD.set_face( tgt, fu);
/* TO VERIFY: does is_closed_at_source(u) imply is_isolated(src)?
if it is true, the svertex face update is not necesary. */
SD.delete_edge_pair(u);
if( SD.is_isolated(src))
// SD.delete_vertex_only(src);
SD.set_face(src,fu);
SM_decorator SD2(D.vertex(tgt));
if( SD2.is_isolated(tgt))
// SD.delete_vertex_only(tgt);
SD2.set_face(tgt,fu);
/* TO VERIFY: can both svertices be isolated at the same time? */
}
}
else if( assign(l, fc)) {
// this code is currenlty not used, but it is potentially need
// in the future, e.g for complex marks or a relative interior
// function
SFace_handle fu = D.sface(l), ftu = D.sface(D.twin(l));
TRACEN("UNION of "<<IO->index(fu)<<" & "<<IO->index(ftu));
merge_sets( fu, ftu, hash, uf);
SM_decorator SD(D.vertex(l));
TRACEN("removing "<<IO->index(l)<<" & "<<IO->index(SD.twin(l)));
SD.delete_loop_only();
}
}
TRACEN("removing "<<IO->index(f)<<" & "<<IO->index(D.twin(f)));
delete_halffacet_pair(f);
return;
}
bool is_part_of_volume(Vertex_handle v) bool is_part_of_volume(Vertex_handle v)
/* determines if a vertex v is part of a volume, cheking if its local /* determines if a vertex v is part of a volume, cheking if its local
graph is trivial (only one sface with no boundary). */ { graph is trivial (only one sface with no boundary). */ {
@ -1048,37 +1051,82 @@ public:
bool is_part_of_edge(Vertex_handle v) { bool is_part_of_edge(Vertex_handle v) {
/* determines if a vertex v is part of a edge, checking at its local /* determines if a vertex v is part of a edge, checking at its local
graph for two antipodal vertices possible connected by a bundle of graph for exactly two antipodal vertices */
sedges. */
bool is_part = false;
SM_decorator SD(v); SM_decorator SD(v);
if( !SD.has_loop()) { if(SD.has_loop())
TRACE(SNC_decorator(*this).point(v)<<" is in edge interior? "); return false;
SVertex_iterator sv(SD.svertices_begin()); if(SD.svertices_begin() == SD.svertices_end())
SVertex_handle p1(sv++), p2(sv++); // TODO: is it dangerous? return false;
if( sv == SD.svertices_end()) { if(++(SD.svertices_begin()) == SD.svertices_end())
TRACE("has two svertices? "); return false;
Sphere_point sp1(SD.point(p1)), sp2(SD.point(p2));
if( sp1 == sp2.antipode()) { TRACE(SNC_decorator(*this).point(v)<<" is in edge interior? ");
TRACE("are they antipode? "); SVertex_iterator sv(SD.svertices_begin());
SHalfedge_iterator se; SVertex_handle p1(sv++), p2(sv++);
CGAL_nef3_forall_sedges_of( se, v) { if( sv != SD.svertices_end())
if( (SD.source(se) != p1 && SD.target(se) != p2) && return false;
(SD.source(se) != p2 && SD.target(se) != p1))
break; TRACE("has two svertices ");
} Sphere_point sp1(SD.point(p1)), sp2(SD.point(p2));
is_part = (se == SD.shalfedges_end()) ? true: false; return (sp1 == sp2.antipode());
TRACE("all sedges conect them? ");
}
}
}
TRACEN((is_part?"yes":"no"));
return is_part;
} }
void simplify() { bool vertex_simplification(bool snc_computed = true) {
bool simplified = false;
// SETDTHREAD(41); SNC_io_parser<SNC_structure> IO_parser(std::cerr, *this);
IO = &IO_parser;
SNC_decorator D(*this);
Vertex_iterator v = (*this).vertices_begin();
while( v != (*this).vertices_end()) {
SM_decorator SD(v);
Vertex_iterator v_next(v);
v_next++;
if( is_part_of_volume(v)) {
TRACEN("mark("<<IO->index(v)<<")="<<D.mark(v)<<", "<<
"mark("<<IO->index(D.volume(SD.sfaces_begin()))<<")="<<
SD.mark(SD.sfaces_begin()));
if(D.mark(v) == SD.mark(SD.sfaces_begin())) {
TRACEN("removing isolated vertex "<<IO->index(v));
delete_vertex(v);
simplified = true;
}
}
else if( is_part_of_facet(v)) {
if( D.mark(v) == SD.mark(SD.shalfloop())) {
TRACEN("removing "<<IO->index(v)<<
" on facet ");
delete_vertex(v);
simplified = true;
}
}
else if( is_part_of_edge(v)) {
SVertex_iterator sv(SD.svertices_begin());
Halfedge_handle e1(sv++), e2(sv++);
CGAL_nef3_assertion( sv == SD.svertices_end());
if( D.mark(e1) == D.mark(v) && D.mark(v) == D.mark(e2)) {
TRACEN("merging "<<IO->index(e1)<<" & "<<IO->index(e2)<<
" in "<<IO->index(v));
if(snc_computed)
merge_halfedge_pairs( e1, e2);
else
delete_vertex(v);
simplified = true;
}
}
v = v_next;
}
return simplified;
}
bool simplify() {
bool update_facets = false;
bool update_sfaces = false;
bool update_volumes = false;
TRACEN(">>> simplifying"); TRACEN(">>> simplifying");
SNC_decorator D(*this); SNC_decorator D(*this);
@ -1135,6 +1183,7 @@ public:
merge_sets( c1, c2, hash_volume, uf_volume); merge_sets( c1, c2, hash_volume, uf_volume);
remove_f_including_all_edge_uses_in_its_boundary_cycles remove_f_including_all_edge_uses_in_its_boundary_cycles
(f, hash_sface, uf_sface); (f, hash_sface, uf_sface);
update_sfaces = update_volumes = true;
TRACEN("UNION of "<<IO->index(c1)<<" & "<<IO->index(c2)); TRACEN("UNION of "<<IO->index(c1)<<" & "<<IO->index(c2));
} }
f = f_next; f = f_next;
@ -1163,6 +1212,7 @@ public:
if(D.mark(e) == D.mark(D.volume(D.sface(e)))) { if(D.mark(e) == D.mark(D.volume(D.sface(e)))) {
TRACEN("removing pair "<<IO->index(e)<<' '<<IO->index(D.twin(e))); TRACEN("removing pair "<<IO->index(e)<<' '<<IO->index(D.twin(e)));
delete_halfedge_pair(e); delete_halfedge_pair(e);
update_facets = true;
} }
} }
else { else {
@ -1180,6 +1230,7 @@ public:
TRACEN("BEFORE "<<PFC(e1)<<std::endl<<PFC(D.twin(e2))); TRACEN("BEFORE "<<PFC(e1)<<std::endl<<PFC(D.twin(e2)));
TRACEN("removing "<<IO->index(e)); TRACEN("removing "<<IO->index(e));
remove_edge_and_merge_facet_cycles(e); remove_edge_and_merge_facet_cycles(e);
update_facets = true;
// TRACEN("AFTER "<<PFC(e1)); // e1 not valid after sloop creation // TRACEN("AFTER "<<PFC(e1)); // e1 not valid after sloop creation
} }
} }
@ -1187,54 +1238,19 @@ public:
e = e_next; e = e_next;
} }
/* update_facets = vertex_simplification() || update_facets;
* Vertices simplification
*/
Vertex_iterator v = (*this).vertices_begin();
while( v != (*this).vertices_end()) {
SM_decorator SD(v);
Vertex_iterator v_next(v);
v_next++;
if( is_part_of_volume(v)) {
TRACEN("mark("<<IO->index(v)<<")="<<D.mark(v)<<", "<<
"mark("<<IO->index(D.volume(SD.sfaces_begin()))<<")="<<
D.mark(D.volume(SD.sfaces_begin())));
if(D.mark(v) == D.mark(D.volume(SD.sfaces_begin()))) {
TRACEN("removing isolated vertex "<<IO->index(v));
delete_vertex(v);
}
}
else if( is_part_of_facet(v)) {
CGAL_nef3_assertion( D.facet(SD.shalfloop()) != Halffacet_handle());
if( D.mark(v) == D.mark(D.facet(SD.shalfloop()))) {
TRACEN("removing "<<IO->index(v)<<
" on facet "<<IO->index(D.facet(SD.shalfloop())));
delete_vertex(v);
}
}
else if( is_part_of_edge(v)) {
SVertex_iterator sv(SD.svertices_begin());
Halfedge_handle e1(sv++), e2(sv++);
CGAL_nef3_assertion( sv == SD.svertices_end());
if( D.mark(e1) == D.mark(v) && D.mark(v) == D.mark(e2)) {
TRACEN("merging "<<IO->index(e1)<<" & "<<IO->index(e2)<<
" in "<<IO->index(v));
merge_halfedge_pairs( e1, e2);
}
}
v = v_next;
}
purge_no_find_objects(hash_volume, hash_facet, hash_sface, uf_volume,
uf_facet, uf_sface);
create_boundary_links_forall_sfaces( hash_sface, uf_sface);
create_boundary_links_forall_facets( hash_facet, uf_facet);
create_boundary_links_forall_volumes( hash_volume, uf_volume);
TRACEN(">>> simplifying done");
SETDTHREAD(1); SETDTHREAD(1);
purge_no_find_objects(hash_volume, hash_facet, hash_sface, uf_volume,
uf_facet, uf_sface);
if(update_sfaces || true) create_boundary_links_forall_sfaces( hash_sface, uf_sface);
if(update_facets || true) create_boundary_links_forall_facets( hash_facet, uf_facet);
if(update_volumes|| true) create_boundary_links_forall_volumes( hash_volume, uf_volume);
TRACEN(">>> simplifying done ");
return update_sfaces || update_facets || update_volumes;
} }
void remove_edge_and_merge_facet_cycles( Halfedge_handle e) { void remove_edge_and_merge_facet_cycles( Halfedge_handle e) {

View File

@ -842,17 +842,21 @@ public:
SNC_visualizor_OGL(const SNC_structure& N) : Base(const_cast<SNC_&>(N)) SNC_visualizor_OGL(const SNC_structure& N) : Base(const_cast<SNC_&>(N))
{ ppoly_ = & CGAL::OGL::add_polyhedron(); } { ppoly_ = & CGAL::OGL::add_polyhedron(); }
OGL::Double_point double_point(const Point_3& p) const OGL::Double_point double_point(const Point_3& p) const {
{ return OGL::Double_point(CGAL::to_double(p.x()), double x = CGAL::to_double(p.hx().eval_at(1));
CGAL::to_double(p.y()), double y = CGAL::to_double(p.hy().eval_at(1));
CGAL::to_double(p.z())); } double z = CGAL::to_double(p.hz().eval_at(1));
double w = CGAL::to_double(p.hw().eval_at(1));
return OGL::Double_point(x/w,y/w,z/w);
}
OGL::Double_segment double_segment(const Segment_3& s) const OGL::Double_segment double_segment(const Segment_3& s) const
{ return OGL::Double_segment(double_point(s.source()), { return OGL::Double_segment(double_point(s.source()),
double_point(s.target())); } double_point(s.target()));
}
void draw(Vertex_handle v) const void draw(Vertex_handle v) const
{ {
Point_3 bp = Infi_box::box_point(point(v)); Point_3 bp = Infi_box::box_point(point(v));
TRACEN("vertex " << bp); TRACEN("vertex " << bp);
ppoly_->push_back(double_point(bp), mark(v)); ppoly_->push_back(double_point(bp), mark(v));
@ -883,15 +887,17 @@ public:
} }
} }
Vector_3 v = orthogonal_vector(f); Vector_3 v = orthogonal_vector(f);
g.set_normal(CGAL::to_double(v.x()), double x = CGAL::to_double(v.hx().eval_at(1));
CGAL::to_double(v.y()), double y = CGAL::to_double(v.hy().eval_at(1));
CGAL::to_double(v.z()), double z = CGAL::to_double(v.hz().eval_at(1));
mark(f)); double w = CGAL::to_double(v.hw().eval_at(1));
g.set_normal(x/w, y/w, z/w, mark(f));
ppoly_->push_back(g); ppoly_->push_back(g);
} }
void draw() const void draw() const
{ {
// SETDTHREAD(53);
Vertex_iterator v; Vertex_iterator v;
CGAL_nef3_forall_vertices(v,*sncp()) draw(v); CGAL_nef3_forall_vertices(v,*sncp()) draw(v);
ppoly_->bbox() = sncp()->bounded_bbox(); ppoly_->bbox() = sncp()->bounded_bbox();