Small steps on boolean operations.

This commit is contained in:
Miguel Granados 2002-06-21 17:57:44 +00:00
parent a03d5b7160
commit e0bc7dda2c
14 changed files with 185 additions and 128 deletions

View File

@ -1,8 +1,11 @@
Nef_3 Package: TODO
---------------------------------------------------------------------
- Solve null pointer info on sphere vertices problem when the overlayer
is called.
- Qualify x with respect to P(1-i).
- Binary operations
- Replace new and delete instructions by the corresponding Allocator methods.
- Change &D.mark() to D.set_mark(...) and D.get_mark(...)
- Extended kernel with infimaximal box
- Define endpoint of segments used for ray shoting to be in the

View File

@ -115,7 +115,7 @@ check_order_preserving_embedding(SVertex_const_handle v) const
!strictly_ordered_ccw_at(p,direction(e),direction(en),
direction(ef)) ) {
error_status << "ccw order violate!" << endl << '\0';
CGAL_assertion_msg(0,error_status.str());
CGAL_nef3_assertion_msg(0,error_status.str());
}
e = en;
}
@ -137,7 +137,7 @@ void SNC_SM_checker<Decorator_>::
check_is_triangulation() const
{
check_integrity_and_topological_planarity(false);
CGAL_assertion(number_of_connected_components() == 1);
CGAL_nef3_assertion(number_of_connected_components() == 1);
check_order_preserving_embedding();
std::ostrstream error_status;
@ -151,7 +151,7 @@ check_is_triangulation() const
error_status << PH(hit);
++edges_in_face_cycle;
}
CGAL_assertion_msg(edges_in_face_cycle==3,error_status.str());
CGAL_nef3_assertion_msg(edges_in_face_cycle==3,error_status.str());
}
error_status.freeze(0);
}

View File

@ -142,6 +142,7 @@ the sphere map of |v|.}*/
Vertex_handle center_vertex() const { return psm_; }
/* This code chunk should be in SNC_SM_const_decorator */
SVertex_const_handle source(SHalfedge_const_handle e) const
{ return e->source_; }
SVertex_const_handle target(SHalfedge_const_handle e) const

View File

@ -226,13 +226,13 @@ bool SNC_SM_io_parser<Refs_>::read_edge(SHalfedge_handle e)
!(in >> m) || !check_sep("}") ||
!(in >> k) || !check_sep("}") )
return false;
CGAL_assertion_msg
CGAL_nef3_assertion_msg
(eo >= 0 && eo < en && epr >= 0 && epr < en && ene >= 0 && ene < en &&
v >= 0 && v < vn && f >= 0 && f < fn ,
"wrong index in read_edge");
// precond: features exist!
CGAL_assertion(EI[twin(e)]);
CGAL_nef3_assertion(EI[twin(e)]);
set_prev(e,Edge_of[epr]);
set_next(e,Edge_of[ene]);
set_source(e,Vertex_of[v]);
@ -262,7 +262,7 @@ bool SNC_SM_io_parser<Refs_>::read_loop(SHalfloop_handle l)
!(in >> m) || !check_sep("}") ||
!(in >> k) || !check_sep("}") )
return false;
CGAL_assertion_msg(
CGAL_nef3_assertion_msg(
(lo >= 0 && lo < 2 && f >= 0 && f < fn),"wrong index in read_edge");
set_face(l,Face_of[f]);
@ -294,17 +294,17 @@ bool SNC_SM_io_parser<Refs_>::read_face(SFace_handle f)
int n, ei, vi, li; Mark m;
if ( !(in >> n) || !check_sep("{") ) return false;
while (in >> ei) {
CGAL_assertion_msg(ei >= 0 && ei < en, "wrong index in face cycle list.");
CGAL_nef3_assertion_msg(ei >= 0 && ei < en, "wrong index in face cycle list.");
store_boundary_object(Edge_of[ei],f);
} in.clear();
if (!check_sep(",")) { return false; }
while (in >> vi) {
CGAL_assertion_msg(vi >= 0 && vi < vn, "wrong index in iso vertex list.");
CGAL_nef3_assertion_msg(vi >= 0 && vi < vn, "wrong index in iso vertex list.");
store_boundary_object(Vertex_of[vi],f);
} in.clear();
if (!check_sep(",")) { return false; }
while (in >> li) {
CGAL_assertion_msg(li >= 0 && li < 2, "wrong index in iso vertex list.");
CGAL_nef3_assertion_msg(li >= 0 && li < 2, "wrong index in iso vertex list.");
store_boundary_object(Loop_of[li],f);
} in.clear();
if (!check_sep(",") || !(in >> m) || !check_sep("}") )
@ -346,15 +346,15 @@ template <typename Refs_>
void SNC_SM_io_parser<Refs_>::read()
{
if ( !check_sep("Sphere Map") )
CGAL_assertion_msg(0,"SNC_SM_io_parser::read: no embedded_PM header.");
CGAL_nef3_assertion_msg(0,"SNC_SM_io_parser::read: no embedded_PM header.");
if ( !(check_sep("svertices") && (in >> vn)) )
CGAL_assertion_msg(0,"SNC_SM_io_parser::read: wrong vertex line.");
CGAL_nef3_assertion_msg(0,"SNC_SM_io_parser::read: wrong vertex line.");
if ( !(check_sep("shalfedges") && (in >> en) && (en%2==0)) )
CGAL_assertion_msg(0,"SNC_SM_io_parser::read: wrong edge line.");
CGAL_nef3_assertion_msg(0,"SNC_SM_io_parser::read: wrong edge line.");
if ( !(check_sep("shalfloops") && (in >> ln)) )
CGAL_assertion_msg(0,"SNC_SM_io_parser::read: wrong loop line.");
CGAL_nef3_assertion_msg(0,"SNC_SM_io_parser::read: wrong loop line.");
if ( !(check_sep("sfaces") && (in >> fn)) )
CGAL_assertion_msg(0,"SNC_SM_io_parser::read: wrong face line.");
CGAL_nef3_assertion_msg(0,"SNC_SM_io_parser::read: wrong face line.");
Vertex_of.reserve(vn);
Edge_of.reserve(en);
@ -369,18 +369,18 @@ void SNC_SM_io_parser<Refs_>::read()
for(i=0; i<vn; i++) {
if (!read_vertex(Vertex_of[i]))
CGAL_assertion_msg(0,"SNC_SM_io_parser::read: error in node line");
CGAL_nef3_assertion_msg(0,"SNC_SM_io_parser::read: error in node line");
}
for(i=0; i<en; i++) {
if (!read_edge(Edge_of[i]))
CGAL_assertion_msg(0,"SNC_SM_io_parser::read: error in edge line");
CGAL_nef3_assertion_msg(0,"SNC_SM_io_parser::read: error in edge line");
}
if ( ln == 2 ) {
read_loop(Loop_of[0]); read_loop(Loop_of[1]);
}
for(i=0; i<fn; i++) {
if (!read_face(Face_of[i]))
CGAL_assertion_msg(0,"SNC_SM_io_parser::read: error in face line");
CGAL_nef3_assertion_msg(0,"SNC_SM_io_parser::read: error in face line");
}
}

View File

@ -788,6 +788,14 @@ subdivide(Vertex_handle v0, Vertex_handle v1)
SHalfedge_handle e;
SNC_SM_output O(*this,PI,From);
/* DEBUG CODE: to do: have all svertices a halfedge below associated? */
TRACEN("Vertex info before swep");
SVertex_iterator svi;
for( svi=svertices_begin(); svi!=svertices_end(); svi++) {
GenPtr i = info(svi);
TRACEN("vertex "<<point(svi)<<" info "<<i);
}
typedef typename PHS_traits::INPUT Input_range;
Positive_halfsphere_sweep SP(
Input_range(L_pos.begin(),L_pos.end()),O,
@ -804,6 +812,12 @@ subdivide(Vertex_handle v0, Vertex_handle v1)
// v = first vertex of CC in negative x-sphere
// e = first edge of CC in negative x-sphere
/* DEBUG CODE: to do: have all svertices a halfedge below associated? */
TRACEN("Vertex info after swep");
for( svi=svertices_begin(); svi!=svertices_end(); svi++) {
GenPtr i = info(svi);
TRACEN("vertex "<<point(svi)<<" info "<<i);
}
create_face_objects(shalfedges_begin(), e, svertices_begin(), v, O,
PH_geometry());
create_face_objects(e, shalfedges_end(), v, svertices_end(), O,

View File

@ -355,7 +355,7 @@ public:
else if( assign(f, o)) {
TRACEN("facet below from from facet...");
f_below = get_visible_facet(f, ray);
CGAL_assertion( f_below != Halffacet_handle());
CGAL_nef3_assertion( f_below != Halffacet_handle());
}
else { TRACEN("no facet below found..."); }
return f_below;
@ -678,7 +678,7 @@ create_volumes() const
SFace_const_handle sfc;
if( !assign(sfc, o) || Shell[sfc] != i) { /*UNTESTED CASE: !assign(sfc,o)*/
SFace_handle f = EntrySFace[i];
CGAL_assertion( Shell[EntrySFace[i]] == i );
CGAL_nef3_assertion( Shell[EntrySFace[i]] == i );
if( Closed[f] ) {
SM_decorator SD(v);
Volume_handle c = sncp()->new_volume();

View File

@ -204,16 +204,16 @@ public:
SFace_handle adjacent_sface(Halffacet_handle f) const {
Halffacet_cycle_iterator fc(f->facet_cycles_begin());
CGAL_assertion( fc != f->facet_cycles_end());
CGAL_nef3_assertion( fc != f->facet_cycles_end());
SHalfedge_handle se;
if ( assign(se, fc) ) {
CGAL_assertion( facet(se) == f);
CGAL_assertion( sface(se) != SFace_handle());
CGAL_assertion( volume(sface(twin(se))) == volume(f));
CGAL_nef3_assertion( facet(se) == f);
CGAL_nef3_assertion( sface(se) != SFace_handle());
CGAL_nef3_assertion( volume(sface(twin(se))) == volume(f));
return sface(twin(se));
}
else
CGAL_assertion_msg( 0, "Facet outer cycle entry point"
CGAL_nef3_assertion_msg( 0, "Facet outer cycle entry point"
"is not an SHalfedge? ");
return SFace_handle(); // never reached
}
@ -276,7 +276,7 @@ public:
template <typename H>
void undo_boundary_object(H h, Halffacet_handle f) const
{ CGAL_assertion(sncp()->is_boundary_object(h));
{ CGAL_nef3_assertion(sncp()->is_boundary_object(h));
Halffacet_cycle_iterator it = sncp()->boundary_item(h);
sncp()->undef_boundary_item(h);
f->boundary_entry_objects_.erase(it);
@ -302,7 +302,7 @@ public:
template <typename H>
void undo_boundary_object(H h, Volume_handle c) const
{ CGAL_assertion(sncp()->is_boundary_object(h));
{ CGAL_nef3_assertion(sncp()->is_boundary_object(h));
Shell_entry_iterator it = sncp()->boundary_item(h);
sncp()->undef_boundary_item(h);
c->shell_entry_objects_.erase(it);
@ -327,7 +327,7 @@ public:
};
void link_as_outer_shell( SFace_handle f, Volume_handle c ) const {
CGAL_assertion(c->shell_entry_objects_.size() == 0);
CGAL_nef3_assertion(c->shell_entry_objects_.size() == 0);
Shell_volume_setter Setter(*this, c);
visit_shell_objects( f, Setter );
TRACEN("Volume "<<&*c<<", outer shell "<<&*f);
@ -335,7 +335,7 @@ public:
}
void link_as_inner_shell( SFace_handle f, Volume_handle c ) const {
// CGAL_assertion(c->shell_entry_objects_.size() > 0);
// CGAL_nef3_assertion(c->shell_entry_objects_.size() > 0);
Shell_volume_setter Setter(*this, c);
visit_shell_objects( f, Setter );
TRACEN("Volume "<<&*c<<", inner shell "<<&*f);
@ -356,7 +356,7 @@ public:
void clear_outer_box_marks() {
SFace_handle sf;
CGAL_assertion( assign( sf, shells_begin(volumes_begin())));
CGAL_nef3_assertion( assign( sf, shells_begin(volumes_begin())));
assign( sf, shells_begin(volumes_begin()));
Shell_mark_setter Setter( *this, false);
visit_shell_objects( sf, Setter );
@ -376,7 +376,7 @@ public:
l->incident_facet_ = f;
SD.twin(l)->incident_facet_ = twin(f);
} else {
CGAL_assertion( facet_plane.opposite() == SD.circle(l));
CGAL_nef3_assertion( facet_plane.opposite() == SD.circle(l));
l->incident_facet_ = twin(f);
SD.twin(l)->incident_facet_ = f;
}
@ -409,13 +409,13 @@ public:
\precondition |ray| target is on |v| and the intersection between
|ray| and the 2-skeleton incident to v is empty. }*/ {
Halffacet_handle f_visible;
CGAL_assertion( ray.target() == point(v));
CGAL_nef3_assertion( ray.target() == point(v));
Sphere_point sp(ray.source() - point(v));
TRACEN( "Locating " << sp <<" in " << point(v));
SM_point_locator L(v);
SObject_handle o = L.locate(sp);
SFace_const_handle sf;
CGAL_assertion( assign( sf, o));
CGAL_nef3_assertion( assign( sf, o));
assign( sf, o);
SFace_cycle_const_iterator fc = sf->sface_cycles_begin(),
fce = sf->sface_cycles_end();
@ -435,7 +435,7 @@ public:
f_visible = facet(twin(sl));
}
else
CGAL_assertion_msg(0, "Damn, wrong handle.");
CGAL_nef3_assertion_msg(0, "Damn, wrong handle.");
}
return f_visible;
}
@ -447,7 +447,7 @@ public:
facets in the adjacency list of |e| that could be 'seen' from the
piercing point of the |ray| on the local (virtual) view of |e|
\precondition |ray| target belongs to |e|. }*/ {
CGAL_assertion( segment(e).has_on( ray.target()));
CGAL_nef3_assertion( segment(e).has_on( ray.target()));
SM_decorator SD;
if( SD.is_isolated(e))
return Halffacet_handle();
@ -491,19 +491,23 @@ public:
}
template <typename Selection>
void binop_local_views( Vertex_handle v0, Vertex_handle v1,
const Selection& BOP)
Vertex_handle binop_local_views( Vertex_handle v0, Vertex_handle v1,
const Selection& BOP)
/*{\op }*/ {
typedef SNC_SM_io_parser<SNC_structure> SNC_SM_io_parser;
SNC_SM_io_parser IO0( std::cerr, v0);
SNC_SM_io_parser IO1( std::cerr, v1);
TRACEN(v0->debug());
TRACEN(v1->debug());
IO0.print();
IO1.print();
SM_overlayer O(v0);
Vertex_handle v01 = sncp()->new_vertex();
SM_overlayer O(v01);
O.subdivide( v0, v1);
O.select( BOP);
O.simplify();
return v01;
}
#ifdef DEADCODE
@ -526,6 +530,7 @@ public:
Vertex_handle create_local_view_on( const Point_3& p, Halfedge_handle e) {
SNC_constructor C(*sncp());
TRACEN("<-> edge local view on "<<p);
return C.create_from_edge( e, p);
/*
@ -582,6 +587,7 @@ public:
Vertex_handle create_local_view_on( const Point_3& p, Halffacet_handle f) {
SNC_constructor C(*sncp());
TRACEN("<-> facet local view on "<<p);
return C.create_from_facet( f, p);
/*
@ -610,6 +616,7 @@ public:
SM_decorator D(v);
SFace_handle f = D.new_face();
D.mark(f) = mark(c);
TRACEN("<-> volume local view on "<<p);
return v;
}
@ -622,8 +629,10 @@ public:
Halffacet_handle f;
Volume_handle c;
Object_handle o = rs.locate(p);
if( assign( v, o))
if( assign( v, o)) {
TRACEN("<-> vertex local view on "<<point(v));
return v;
}
else if( assign( e, o))
return create_local_view_on( p, e);
else if( assign( f, o))
@ -637,29 +646,31 @@ public:
template <typename Selection>
void binary_operation( SNC_structure& snc1i, const Selection& BOP)
/*{\op }*/ {
typedef Unique_hash_map<Vertex_handle, bool> Hash_map;
Hash_map Stay(false);
SNC_ray_shoter rs(*sncp());
Vertex_handle v0, v1;
Vertex_iterator v0, v1;
CGAL_nef3_forall_vertices( v0, *sncp()) {
if( Stay[v0]) continue;
v1 = qualify_with_respect( point(v0), snc1i);
binop_local_views( v0, v1, BOP); /* result on v0 */
if( v1->sncp() == sncp())
sncp()->delete_vertex(v1); /* delete v1 only if that sphere map is
a local copy */
TRACEN("bionop of vertices "<<&*v0<<" "<<&*v1);
Stay[binop_local_views( v0, v1, BOP)] = true;
}
CGAL_nef3_forall_vertices( v1, snc1i) {
if( Stay[v1]) continue;
v0 = qualify_with_respect( point(v1), *sncp());
binop_local_views( v0, v1, BOP); /* result on v0 */
TRACEN("bionop of vertices "<<&*v0<<" "<<&*v1);
Stay[binop_local_views( v0, v1, BOP)] = true;
}
Halfedge_handle e0, e1;
Halffacet_handle f0, f1;
Halfedge_iterator e0, e1;
Halffacet_iterator f0, f1;
CGAL_nef3_forall_edges( e0, *sncp()) {
CGAL_nef3_forall_facets( f1, snc1i) {
Point_3 ip;
if( rs.does_intersect_internally( segment(e0), f1, ip )) {
v0 = qualify_with_respect( ip, *sncp());
v1 = qualify_with_respect( ip, snc1i);
binop_local_views( v0, v1, BOP); /* result on vi */
sncp()->delete_vertex(v1);
Stay[binop_local_views( v0, v1, BOP)] = true;
}
}
}
@ -669,8 +680,7 @@ public:
if( rs.does_intersect_internally( segment(e1), f0, ip )) {
v1 = qualify_with_respect( ip, snc1i);
v0 = qualify_with_respect( ip, *sncp());
binop_local_views( v0, v1, BOP); // result on vi
sncp()->delete_vertex(v1);
Stay[binop_local_views( v0, v1, BOP)] = true;
}
}
}
@ -681,15 +691,24 @@ public:
Vertex_handle v0, v1;
v0 = qualify_with_respect( ip, *sncp());
v1 = qualify_with_respect( ip, snc1i);
binop_local_views( v0, v1, BOP); // result on v0
sncp()->delete_vertex(v1);
Stay[binop_local_views( v0, v1, BOP)] = true;
}
}
}
CGAL_nef3_forall_vertices( v0, *sncp())
if( !Stay[v0]) sncp()->delete_vertex(v0);
// remove vertices whose local view is not that of a vertex
// TO VERIFY: clean adjacency information before next step?
// synthesis of spatial structure
// this code corresponds to build_external_extructure on
// Nef_polyhedron_3.h
SNC_constructor C(*sncp());
C.pair_up_halfedges();
C.link_shalfedges_to_facet_cycles();
C.categorize_facet_cycles_and_create_facets();
C.create_volumes();
}
template <typename Visitor>
@ -784,7 +803,7 @@ visit_shell_objects(SFace_handle f, Visitor& V) const
if ( Done[sface(l)] ) continue;
SFaceCandidates.push_back(sface(l));
Done[sface(l)] = true;
} else CGAL_assertion_msg(0,"Damn wrong handle.");
} else CGAL_nef3_assertion_msg(0,"Damn wrong handle.");
}
}
if ( !SFaceCandidates.empty() ) {
@ -820,7 +839,7 @@ visit_shell_objects(SFace_handle f, Visitor& V) const
Halffacet_handle f = facet(twin(l));
if ( Done[f] ) continue;
FacetCandidates.push_back(f); Done[f] = true;
} else CGAL_assertion_msg(0,"Damn wrong handle.");
} else CGAL_nef3_assertion_msg(0,"Damn wrong handle.");
}
}
}

View File

@ -165,7 +165,7 @@ public:
template <typename EW>
SNC_io_parser<EW>::SNC_io_parser(std::istream& is, SNC_structure& W) :
Base(W), in(is), out(std::cout)
{ CGAL_assertion(W.empty());
{ CGAL_nef3_assertion(W.empty());
verbose = false; }
template <typename EW>
@ -263,21 +263,21 @@ template <typename EW>
void SNC_io_parser<EW>::read()
{
if ( !check_sep("Selective Nef Complex") )
CGAL_assertion_msg(0,"SNC_io_parser::read: no embedded_PM header.");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: no embedded_PM header.");
if ( !(check_sep("vertices") && (in >> vn)) )
CGAL_assertion_msg(0,"SNC_io_parser::read: wrong vertex line.");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: wrong vertex line.");
if ( !(check_sep("halfedges") && (in >> en) && (en%2==0)) )
CGAL_assertion_msg(0,"SNC_io_parser::read: wrong edge line.");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: wrong edge line.");
if ( !(check_sep("facets") && (in >> fn) && (fn%2==0)) )
CGAL_assertion_msg(0,"SNC_io_parser::read: wrong facet line.");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: wrong facet line.");
if ( !(check_sep("volumes") && (in >> cn)) )
CGAL_assertion_msg(0,"SNC_io_parser::read: wrong volume line.");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: wrong volume line.");
if ( !(check_sep("shalfedges") && (in >> sen)) )
CGAL_assertion_msg(0,"SNC_io_parser::read: wrong sedge line.");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: wrong sedge line.");
if ( !(check_sep("shalfloops") && (in >> sln)) )
CGAL_assertion_msg(0,"SNC_io_parser::read: wrong sloop line.");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: wrong sloop line.");
if ( !(check_sep("sfaces") && (in >> sfn)) )
CGAL_assertion_msg(0,"SNC_io_parser::read: wrong sface line.");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: wrong sface line.");
Vertex_of.reserve(vn);
Edge_of.reserve(en);
@ -297,31 +297,31 @@ void SNC_io_parser<EW>::read()
for(i=0; i<vn; i++) {
if (!read_vertex(Vertex_of[i]))
CGAL_assertion_msg(0,"SNC_io_parser::read: error in node line");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: error in node line");
}
for(i=0; i<en; i++) {
if (!read_edge(Edge_of[i]))
CGAL_assertion_msg(0,"SNC_io_parser::read: error in edge line");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: error in edge line");
}
for(i=0; i<fn; i++) {
if (!read_facet(Halffacet_of[i]))
CGAL_assertion_msg(0,"SNC_io_parser::read: error in facet line");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: error in facet line");
}
for(i=0; i<cn; i++) {
if (!read_volume(Volume_of[i]))
CGAL_assertion_msg(0,"SNC_io_parser::read: error in volume line");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: error in volume line");
}
for(i=0; i<sen; i++) {
if (!read_sedge(SEdge_of[i]))
CGAL_assertion_msg(0,"SNC_io_parser::read: error in sedge line");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: error in sedge line");
}
for(i=0; i<sln; i++) {
if (!read_sloop(SLoop_of[i]))
CGAL_assertion_msg(0,"SNC_io_parser::read: error in sloop line");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: error in sloop line");
}
for(i=0; i<sfn; i++) {
if (!read_sface(SFace_of[i]))
CGAL_assertion_msg(0,"SNC_io_parser::read: error in sface line");
CGAL_nef3_assertion_msg(0,"SNC_io_parser::read: error in sface line");
}
}
@ -356,7 +356,7 @@ read_vertex(Vertex_handle v) const
!check_sep(",") ||
!(in >> p) ||
!check_sep("}") ) return false;
CGAL_assertion_msg(
CGAL_nef3_assertion_msg(
Vertex_of[n] == v &&
svs >= 0 && svs < en && sve >= 0 && sve < en &&
ses >= 0 && ses < sen && see >= 0 && see < sen &&
@ -397,7 +397,7 @@ read_edge(Halfedge_handle e) const
return false;
if (iso) efm=sfn; else efm=sen;
CGAL_assertion_msg (
CGAL_nef3_assertion_msg (
Edge_of[n] == e &&
et >= 0 && et < en && vs >= 0 && vs < vn &&
ef >= 0 && et < efm , "wrong index in read_edge");
@ -430,13 +430,13 @@ read_facet(Halffacet_handle f) const
int n, ei, li; Mark m;
if ( !(in >> n) || !check_sep("{") ) return false;
while (in >> ei) {
CGAL_assertion_msg(ei >= 0 && ei < sen,
CGAL_nef3_assertion_msg(ei >= 0 && ei < sen,
"wrong index in facet cycle list.");
store_boundary_object(SEdge_of[ei],f);
} in.clear();
if (!check_sep(",")) { return false; }
while (in >> li) {
CGAL_assertion_msg(li >= 0 && li < sln,
CGAL_nef3_assertion_msg(li >= 0 && li < sln,
"wrong index in facet cycle list.");
store_boundary_object(SLoop_of[li],f);
} in.clear();
@ -463,7 +463,7 @@ read_volume(Volume_handle c) const
int n, fi; Mark m;
if ( !(in >> n) || !check_sep("{") ) return false;
while (in >> fi) {
CGAL_assertion_msg(fi >= 0 && fi < sfn,
CGAL_nef3_assertion_msg(fi >= 0 && fi < sfn,
"wrong index in shell list.");
store_boundary_object(SFace_of[fi],c);
} in.clear();
@ -503,7 +503,7 @@ read_sedge(SHalfedge_handle e) const
!(in >> en) || !check_sep(",") ||
!(in >> ft) || !check_sep("}") )
return false;
CGAL_assertion_msg
CGAL_nef3_assertion_msg
(et >= 0 && et < sen && sp >= 0 && sp < sen &&
sn >= 0 && sn < sen && vs >= 0 && vs < en &&
sf >= 0 && sf < sfn && ep >= 0 && ep < sen &&
@ -511,7 +511,7 @@ read_sedge(SHalfedge_handle e) const
"wrong index in read_sedge");
// precond: features exist!
CGAL_assertion(SEdge_of[n]==e);
CGAL_nef3_assertion(SEdge_of[n]==e);
e->sprev_ = SEdge_of[sp];
e->snext_ = SEdge_of[sn];
e->source_ = Edge_of[vs];
@ -543,12 +543,12 @@ read_sloop(SHalfloop_handle l) const
!(in >> sf) || !check_sep(",") ||
!(in >> ft) || !check_sep("}") )
return false;
CGAL_assertion_msg
CGAL_nef3_assertion_msg
(lt >= 0 && lt < sen && sf >= 0 && sf < sfn &&
ft >= 0 && ft < fn ,
"wrong index in read_sedge");
CGAL_assertion(SLoop_of[n]==l);
CGAL_nef3_assertion(SLoop_of[n]==l);
l->twin_ = SLoop_of[lt];
l->incident_sface_ = SFace_of[sf];
l->incident_facet_ = Halffacet_of[ft];
@ -582,22 +582,22 @@ read_sface(SFace_handle f) const
if ( !(in >> n) || !check_sep("{") ||
!(in >> vc) || !check_sep(",") )
return false;
CGAL_assertion(vc >= 0 && vc < vn);
CGAL_nef3_assertion(vc >= 0 && vc < vn);
f->center_vertex_ = Vertex_of[vc];
SM_decorator D(Vertex_of[vc]);
while (in >> ei) {
CGAL_assertion_msg(ei >= 0 && ei < sen,
CGAL_nef3_assertion_msg(ei >= 0 && ei < sen,
"wrong index in sface cycle list.");
D.store_boundary_object(SEdge_of[ei],f);
} in.clear();
while (in >> vi) {
CGAL_assertion_msg(vi >= 0 && vi < en,
CGAL_nef3_assertion_msg(vi >= 0 && vi < en,
"wrong index in sface cycle list.");
D.store_boundary_object(Edge_of[vi],f);
} in.clear();
if (!check_sep(",")) { return false; }
while (in >> li) {
CGAL_assertion_msg(li >= 0 && li < sln,
CGAL_nef3_assertion_msg(li >= 0 && li < sln,
"wrong index in sface cycle list.");
D.store_boundary_object(SLoop_of[li],f);
} in.clear();

View File

@ -287,6 +287,22 @@ public:
Mark& mark() { return mark_; }
GenPtr& info() { return info_; }
public:
std::string debug() const
{ std::stringstream os;
set_pretty_mode(os);
os<<"{ addr, point, mark, snc, svb, sve, seb, see, sfb, sfe, sl,"
<<" mneg, mpos, info }"<<std::endl;
os<<"{ "<<this<<", "<<point_at_center_<<", "<<mark_<<", "<<&*sncp_<<", "
<<&*svertices_begin_ <<", "<<&*svertices_last_ <<", "
<<&*shalfedges_begin_<<", "<<&*shalfedges_last_<<", "
<<&*sfaces_begin_ <<", "<<&*sfaces_last_ <<", "
<<&*shalfloop_ <<", "
<<m_neg_<<", "<<m_pos_<<", "<<info_<<" }";
std::string res(os.str());
return res;
}
}; // Vertex
@ -362,7 +378,7 @@ public:
std::string debug() const
{ std::stringstream os;
set_pretty_mode(os);
os<<"v"<<tmp_point()<<info_<<'\0';
os<<"sv [ "<<tmp_point()<<info_<<" ] ";
std::string res(os.str());
return res;
}
@ -604,8 +620,8 @@ public:
std::string debug() const
{ std::stringstream os;
set_pretty_mode(os);
os <<"e["<<source_->debug()<<","
<<twin_->source_->debug()<<" "<<info_<<"]"<<'\0';
os <<"e[ "<<source_->debug()<<", "
<<twin_->source_->debug()<<" "<<info_<<" ] ";
std::string res(os.str());
return res;
}
@ -680,7 +696,7 @@ public:
std::string debug() const
{ std::stringstream os;
set_pretty_mode(os);
os<<"l"<<tmp_circle()<<'\0';
os<<"sl [ "<<tmp_circle()<<" ] ";
std::string res(os.str());
return res;
}

View File

@ -93,7 +93,7 @@ public:
{ s = Segment_3(s.source(),p); }
bool contains_internally(const Segment_3& s, const Point_3& p) const
{ CGAL_assertion(s.has_on(p));
{ CGAL_nef3_assertion(s.has_on(p));
CGAL::Comparison_result r1 = compare_xyz(s.source(),p);
CGAL::Comparison_result r2 = compare_xyz(s.target(),p);
return (r1 == opposite(r2));

View File

@ -334,7 +334,7 @@ public:
if(os1 != opposite(os2))
return false;
Object o = intersection(hs1, ls2);
CGAL_assertion(assign( p, o));
CGAL_nef3_assertion(assign( p, o));
/* since line(s1) and line(s2) are not parallel they intersects in only
one point */
assign( p ,o);
@ -357,7 +357,7 @@ public:
TRACEN("-> facet plane " << h);
TRACEN("-> a point on " << h.point());
TRACEN("-> seg segment " << seg);
CGAL_assertion( !h.is_degenerate());
CGAL_nef3_assertion( !h.is_degenerate());
if( seg.is_degenerate())
/* no possible internal intersection */
return false;
@ -369,15 +369,15 @@ public:
Oriented_side os1 = h.oriented_side(seg.source());
Oriented_side os2 = h.oriented_side(seg.target());
TRACEN( "-> endpoint plane side " << os1 << " " << os2);
CGAL_assertion( h.has_on(p));
CGAL_assertion( seg.has_on(p));
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);
Segment_3 s;
if ( assign( s, o) ) {
CGAL_assertion( s == seg );
CGAL_nef3_assertion( s == seg );
TRACEN( "-> seg belongs to facet's plane." << p );
return false;
}
@ -398,7 +398,7 @@ public:
typedef Container_from_circulator<Circulator> Container;
Plane_3 h(plane(f));
CGAL_assertion(h.has_on(p));
CGAL_nef3_assertion(h.has_on(p));
Halffacet_cycle_iterator fc = f->facet_cycles_begin();
SHalfedge_handle se;
Bounded_side outer_bound_pos;
@ -406,11 +406,11 @@ public:
SHalfedge_around_facet_circulator hfc(se);
Circulator c(hfc);
Container ct(c);
CGAL_assertion( !is_empty_range(ct.begin(), ct.end()));
CGAL_nef3_assertion( !is_empty_range(ct.begin(), ct.end()));
outer_bound_pos = bounded_side_3(ct.begin(), ct.end(), p, h);
}
else
CGAL_assertion_msg(0, "is facet first cycle a SHalfloop?");
CGAL_nef3_assertion_msg(0, "is facet first cycle a SHalfloop?");
if( outer_bound_pos != CGAL::ON_BOUNDED_SIDE )
return outer_bound_pos;
/* The point p is not in the relative interior of the outer face cycle
@ -433,12 +433,12 @@ public:
SHalfedge_around_facet_circulator hfc(se);
Circulator c(hfc);
Container ct(c);
CGAL_assertion( !is_empty_range(ct.begin(), ct.end()));
CGAL_nef3_assertion( !is_empty_range(ct.begin(), ct.end()));
inner_bound_pos = bounded_side_3( ct.begin(), ct.end(),
p, h.opposite());
}
else
CGAL_assertion_msg(0, "Damn wrong handle.");
CGAL_nef3_assertion_msg(0, "Damn wrong handle.");
if( inner_bound_pos != CGAL::ON_UNBOUNDED_SIDE )
return opposite(inner_bound_pos);
/* At this point the point p belongs to relative interior of the facet's

View File

@ -70,7 +70,7 @@ struct move_shalfedge_around_facet {
template <class Object, class Hash_map, class Union_find>
void merge_sets( Object o1, Object o2, Hash_map& hash, Union_find& uf) {
CGAL_assertion( hash[o1] != 0 && hash[o2] != 0);
CGAL_nef3_assertion( hash[o1] != 0 && hash[o2] != 0);
if( !uf.same_set( hash[o1], hash[o2]))
uf.unify_sets( hash[o1], hash[o2]);
}
@ -849,7 +849,7 @@ public:
/* determines if a vertex v is part of a volume, cheking if its local
graph is trivial (only one sface with no boundary). */ {
SM_decorator SD(v);
CGAL_assertion( !is_empty_range( SD.sfaces_begin(), SD.sfaces_end()));
CGAL_nef3_assertion( !is_empty_range( SD.sfaces_begin(), SD.sfaces_end()));
if( is_empty_range( SD.svertices_begin(), SD.svertices_end()) &&
is_empty_range( SD.shalfedges_begin(), SD.shalfedges_end()) &&
!SD.has_loop())
@ -862,12 +862,16 @@ public:
facet, checking if its local graph consists just of a sloop and
two incident sfaces. */ {
SM_decorator SD(v);
CGAL_assertion(!is_empty_range(SD.svertices_begin(),SD.svertices_end()) ||
CGAL_nef3_assertion(!is_empty_range(SD.svertices_begin(),SD.svertices_end()) ||
is_empty_range(SD.shalfedges_begin(),SD.shalfedges_end()));
return( SD.has_loop() &&
is_empty_range( SD.svertices_begin(), SD.svertices_end()));
}
bool is_vertex(Vertex_handle v) {
return !is_part_of_facet(v) && !is_part_edge(v);
}
bool is_part_of_edge(Vertex_handle v) {
/* 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
@ -937,12 +941,12 @@ public:
while( f != D.halffacets_end() && f->is_twin())
f++;
while( f != D.halffacets_end()) {
CGAL_assertion( !f->is_twin());
CGAL_nef3_assertion( !f->is_twin());
Halffacet_iterator f_next(f);
do
f_next++;
while( f_next != D.halffacets_end() && f_next->is_twin());
CGAL_assertion( f != D.twin(f));
CGAL_nef3_assertion( f != D.twin(f));
Volume_handle c1 = D.volume(f), c2 = D.volume(D.twin(f));
TRACEN(" mark("<<IO->index(c1)<<")="<<D.mark(c1)<<
" mark("<<IO->index(f) <<")="<<D.mark(f) <<
@ -971,7 +975,7 @@ public:
while( e != D.halfedges_end() && e->is_twin())
e++;
while( e != (*this).halfedges_end()) {
CGAL_assertion( !e->is_twin());
CGAL_nef3_assertion( !e->is_twin());
Halfedge_iterator e_next(e);
do
e_next++;
@ -1013,7 +1017,7 @@ public:
Vertex_iterator v_next(v);
v_next++;
CGAL_assertion( SD.sfaces_begin() != SFace_handle());
CGAL_nef3_assertion( SD.sfaces_begin() != SFace_handle());
if( is_part_of_volume(v)) {
TRACEN("mark("<<IO->index(v)<<")="<<D.mark(v)<<", "<<
"mark("<<IO->index(D.volume(SD.sfaces_begin()))<<")="<<
@ -1024,7 +1028,7 @@ public:
}
}
else if( is_part_of_facet(v)) {
CGAL_assertion( D.facet(SD.shalfloop()) != Halffacet_handle());
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())));
@ -1034,7 +1038,7 @@ public:
else if( is_part_of_edge(v)) {
SVertex_iterator sv(SD.svertices_begin());
Halfedge_handle e1(sv++), e2(sv++);
CGAL_assertion( sv == SD.svertices_end());
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));
@ -1055,9 +1059,9 @@ public:
void remove_edge_and_merge_facet_cycles( Halfedge_handle e) {
SNC_decorator D(*this);
CGAL_assertion( D.has_outdeg_two(e));
CGAL_nef3_assertion( D.has_outdeg_two(e));
Halfedge_handle et = D.twin(e);
CGAL_assertion( D.has_outdeg_two(et));
CGAL_nef3_assertion( D.has_outdeg_two(et));
SM_decorator SD1(D.vertex(e));
SM_decorator SD2(D.vertex(et));
SHalfedge_handle e1 = SD1.first_out_edge(e);
@ -1070,18 +1074,18 @@ public:
SVertex_handle v) {
SNC_decorator D(*this);
SM_decorator SD(D.vertex(v));
CGAL_assertion( SD.target(s1) == v);
CGAL_nef3_assertion( SD.target(s1) == v);
SHalfedge_handle s2(SD.next(s1));
CGAL_assertion( SD.source(s2) == v);
CGAL_nef3_assertion( SD.source(s2) == v);
if( s1 == s2) {
TRACEN(IO->index(s1)<<'('<<IO->index(D.twin(s2))<<") to sloop");
SD.convert_edge_to_loop(s1);
CGAL_assertion(SD.shalfloop() != SHalfloop_handle());
CGAL_nef3_assertion(SD.shalfloop() != SHalfloop_handle());
D.add_sloop_to_facet( SD.shalfloop(), D.facet(s1));
TRACEN(IO->index(s2)<<" removed");
}
else {
CGAL_assertion( D.has_outdeg_two(v));
CGAL_nef3_assertion( D.has_outdeg_two(v));
D.link_as_prev_next_pair( s1, D.next(s2));
TRACEN(IO->index(s1)<<" "<<IO->index(D.next(s2))<<" linked.");
D.link_as_prev_next_pair( D.twin(D.next(s2)), D.twin(s1));
@ -1094,9 +1098,9 @@ public:
void merge_halfedge_pairs( SVertex_handle p, SVertex_handle q) {
SNC_decorator D(*this);
CGAL_assertion( D.vertex(p) == D.vertex(q));
CGAL_nef3_assertion( D.vertex(p) == D.vertex(q));
Vertex_handle v(D.vertex(p));
CGAL_assertion( is_part_of_edge(v));
CGAL_nef3_assertion( is_part_of_edge(v));
SM_decorator SD(v);
SHalfedge_around_svertex_circulator s(SD.first_out_edge(p)), se(s);
CGAL_For_all( s, se) {
@ -1152,7 +1156,7 @@ public:
continue;
SM_decorator SD(D.vertex(e));
SFace_handle sf = *(uf.find(hash[D.sface(e)]));
CGAL_assertion( sf != SFace_handle());
CGAL_nef3_assertion( sf != SFace_handle());
SHalfedge_around_sface_circulator c(e), cend(c);
CGAL_For_all( c, cend) {
SD.set_face(c, sf);
@ -1165,7 +1169,7 @@ public:
SM_decorator SD(D.vertex(sv));
if( SD.is_isolated(sv)) {
SFace_handle sf = *(uf.find(hash[D.sface(sv)]));
CGAL_assertion( sf != SFace_handle());
CGAL_nef3_assertion( sf != SFace_handle());
SD.set_face( sv, sf);
SD.store_boundary_object( sv, sf);
}
@ -1200,7 +1204,7 @@ public:
D.store_boundary_object( u_min, f);
else {
SHalfedge_handle f_sedge;
CGAL_assertion( assign( f_sedge, f->boundary_entry_objects_.front()));
CGAL_nef3_assertion( assign( f_sedge, f->boundary_entry_objects_.front()));
assign( f_sedge, f->boundary_entry_objects_.front());
Point_3 p(D.point(D.vertex(f_sedge)));
if( lexicographically_xyz_smaller( D.point(D.vertex(u_min)), p))
@ -1330,8 +1334,8 @@ pointer_update(const SNC_structure<Items>& D)
/* It is possible that the is_twin() property differs for equivalent
facets on both SNC structures. So, we need to store the correct
selection mark in the correct (non-twin) facet of a halffacet pair. */
CGAL_assertion_code( if( fc->is_twin() == f->is_twin())
CGAL_assertion( fc->mark_ == f->mark_));
CGAL_nef3_assertion_code( if( fc->is_twin() == f->is_twin())
CGAL_nef3_assertion( fc->mark_ == f->mark_));
if( !f->is_twin() && fc->is_twin()) f->mark_ = f->twin_->mark_;
}
// Volume update

View File

@ -115,7 +115,7 @@ namespace OGL {
operator double_ptr() const
{ return const_cast<Double_triple&>(*this).coords_; }
double operator[](unsigned i)
{ CGAL_assertion(i<3); return coords_[i]; }
{ CGAL_nef3_assertion(i<3); return coords_[i]; }
}; // Double_triple
static std::ostream& operator << (std::ostream& os,
@ -183,22 +183,22 @@ namespace OGL {
{ return fc_ends_.size(); }
Coord_iterator facet_cycle_begin(unsigned i)
{ CGAL_assertion(i<number_of_facet_cycles());
{ CGAL_nef3_assertion(i<number_of_facet_cycles());
if (i==0) return coords_.begin();
else return coords_.begin()+fc_ends_[i-1]; }
Coord_iterator facet_cycle_end(unsigned i)
{ CGAL_assertion(i<number_of_facet_cycles());
{ CGAL_nef3_assertion(i<number_of_facet_cycles());
if (i<fc_ends_.size()-1) return coords_.begin()+fc_ends_[i];
else return coords_.end(); }
Coord_const_iterator facet_cycle_begin(unsigned i) const
{ CGAL_assertion(i<number_of_facet_cycles());
{ CGAL_nef3_assertion(i<number_of_facet_cycles());
if (i==0) return coords_.begin();
else return coords_.begin()+fc_ends_[i-1]; }
Coord_const_iterator facet_cycle_end(unsigned i) const
{ CGAL_assertion(i<number_of_facet_cycles());
{ CGAL_nef3_assertion(i<number_of_facet_cycles());
if (i<fc_ends_.size()-1) return coords_.begin()+fc_ends_[i];
else return coords_.end(); }
@ -406,7 +406,7 @@ namespace OGL {
{ if (init_) return;
init_ = true;
axes_ = false;
object_list_ = glGenLists(4); CGAL_assertion(object_list_);
object_list_ = glGenLists(4); CGAL_nef3_assertion(object_list_);
fill_display_lists();
}

View File

@ -71,7 +71,7 @@ template <typename T>
std::istream& operator>>(std::istream&, Nef_polyhedron_3<T>&);
template <typename T>
class Nef_polyhedron_3_rep : public Rep
class Nef_polyhedron_3_rep : public Ref_counted
{
typedef Nef_polyhedron_3_rep<T> Self;
friend class Nef_polyhedron_3<T>;
@ -221,7 +221,7 @@ protected:
typedef typename SNC_structure::Sphere_circle Sphere_circle;
Vertex_handle create_cube_corner(int x, int y, int z, bool space=false) {
CGAL_assertion(CGAL_NTS abs(x) ==
CGAL_nef3_assertion(CGAL_NTS abs(x) ==
CGAL_NTS abs(y) ==
CGAL_NTS abs(z) == 1);
Vertex_handle v = snc().new_vertex();