mirror of https://github.com/CGAL/cgal
complete_face_support korrigiert
Callback funktion fuer GLU_TESS_COMBINE hinzugefuegt
This commit is contained in:
parent
534012d0ef
commit
e9d7538aea
|
|
@ -136,8 +136,18 @@ void normalize()
|
|||
/*{\Mop reduces the Pluecker coefficients to a minimal
|
||||
representation. This is done by dividing all Pluecker
|
||||
coefficients by their common gcd.}*/
|
||||
{ RT D = c_[0];
|
||||
for(int i=1; i<6; ++i)
|
||||
{
|
||||
int i=0;
|
||||
while(i<6 && c_[i]==0)
|
||||
i++;
|
||||
|
||||
if(i>5)
|
||||
return;
|
||||
|
||||
RT D = c_[i];
|
||||
CGAL_assertion(D!=0);
|
||||
|
||||
for(++i; i<6; ++i)
|
||||
D = (c_[i]==0 ? D : CGAL_NTS gcd(D, c_[i]));
|
||||
if (D==0) return;
|
||||
for(int i=0; i<6; ++i) c_[i]/=D;
|
||||
|
|
@ -205,7 +215,6 @@ struct Pluecker_line_lt {
|
|||
{ return CGAL::Pluecker_line_3<R>::cmp(l1,l2)<0; }
|
||||
};
|
||||
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
#endif //CGAL_PLUECKER_LINE_3_H
|
||||
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ void SNC_SM_io_parser<Refs_>::debug_edge(SHalfedge_handle e) const
|
|||
{
|
||||
out << index(e)
|
||||
<< "(" << index(source(e)) << "," << index(target(e)) << ") "
|
||||
<< index(twin(e)) << " " << index(face(e))
|
||||
<< index(twin(e)) << " " << index(face(e)) << " " << mark(face(e))
|
||||
<< " ["<< mark(e) << "] " << circle(e) << endl;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -745,29 +745,44 @@ subdivide(Vertex_handle v0, Vertex_handle v1)
|
|||
SVertex_iterator v;
|
||||
CGAL_nef3_forall_svertices(v,PI[i]) {
|
||||
if ( !PI[i].is_isolated(v) ) continue;
|
||||
TRACEN("isolated " << PH(v));
|
||||
L.push_back(trivial_segment(PI[i],v));
|
||||
From[--L.end()] = Seg_info(v,i);
|
||||
}
|
||||
SHalfedge_iterator e;
|
||||
CGAL_nef3_forall_sedges(e,PI[i]) {
|
||||
if ( source(e) == target(e) ) {
|
||||
TRACEN("degenerierte Kante " << PH(e));
|
||||
Seg_pair p = two_segments(PI[i],e);
|
||||
L.push_back(p.first);
|
||||
L.push_back(p.second);
|
||||
From[--L.end()] = From[--(--L.end())] = Seg_info(e,i);
|
||||
} else {
|
||||
TRACEN("normale Kante " << PH(e));
|
||||
L.push_back(segment(PI[i],e));
|
||||
From[--L.end()] = Seg_info(e,i);
|
||||
}
|
||||
}
|
||||
if ( PI[i].has_loop() ) {
|
||||
Seg_pair p = two_segments(PI[i],PI[i].shalfloop());
|
||||
TRACEN("halfloop");
|
||||
SHalfloop_handle shl = PI[i].shalfloop();
|
||||
Seg_pair p = two_segments(PI[i],shl);
|
||||
L.push_back(p.first);
|
||||
L.push_back(p.second);
|
||||
From[--L.end()] = From[--(--L.end())] =
|
||||
Seg_info(PI[i].shalfloop(),i);
|
||||
Seg_info(shl,i);
|
||||
/*
|
||||
p = two_segments(PI[i],PI[i].twin(shl));
|
||||
L.push_back(p.first);
|
||||
L.push_back(p.second);
|
||||
From[--L.end()] = From[--(--L.end())] =
|
||||
Seg_info(PI[i].twin(shl),i);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
typename Seg_list::iterator it;
|
||||
CGAL_nef3_forall_iterators(it,L) TRACEN(" "<<*it);
|
||||
|
||||
Seg_list L_pos,L_neg;
|
||||
partition_to_halfsphere(L.begin(), L.end(), L_pos, From, +1);
|
||||
|
|
@ -814,12 +829,13 @@ subdivide(Vertex_handle v0, Vertex_handle v1)
|
|||
// now two CCs of sphere graph are calculated
|
||||
// v = first vertex of CC in negative x-sphere
|
||||
// e = first edge of CC in negative x-sphere
|
||||
|
||||
|
||||
create_face_objects(shalfedges_begin(), e, svertices_begin(), v, O,
|
||||
PH_geometry());
|
||||
create_face_objects(e, shalfedges_end(), v, svertices_end(), O,
|
||||
NH_geometry());
|
||||
|
||||
|
||||
SHalfedge_iterator u;
|
||||
CGAL_nef3_forall_sedges(u,*this) {
|
||||
Sphere_segment s(point(source(u)),point(target(u)));
|
||||
|
|
@ -830,6 +846,8 @@ subdivide(Vertex_handle v0, Vertex_handle v1)
|
|||
complete_face_support(svertices_begin(), v, O, +1);
|
||||
complete_face_support(v, svertices_end(), O, -1);
|
||||
|
||||
|
||||
|
||||
/* DEBUG CODE: to do: have all svertices a halfedge below associated? */
|
||||
TRACEN("Vertex info after swep");
|
||||
for( svi=svertices_begin(); svi!=svertices_end(); svi++) {
|
||||
|
|
@ -975,12 +993,39 @@ complete_face_support(SVertex_iterator v_start, SVertex_iterator v_end,
|
|||
TRACEN("VERTEX = "<<PH(v));
|
||||
Mark m_buffer[2];
|
||||
SHalfedge_handle e_below = halfedge_below(v);
|
||||
if ( v == v_start ) {
|
||||
for (int i=0; i<2; ++i)
|
||||
m_buffer[i] = PI[i].mark_of_halfsphere(-pos);
|
||||
if ( v == v_start ) {
|
||||
for (int i=0; i<2; ++i){
|
||||
SHalfedge_around_sface_circulator e(first_out_edge(v)), end(e);
|
||||
CGAL_For_all(e,end) {
|
||||
if(supp_object(e,i) != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
if(supp_object(e,i) != NULL) {
|
||||
SHalfedge_handle ei;
|
||||
if ( assign(ei,supp_object(e,i)) ) {
|
||||
if ( PI[i].circle(ei) != circle(e) ) { ei = PI[i].twin(ei); }
|
||||
CGAL_nef3_assertion( PI[i].circle(ei) == circle(e) );
|
||||
TRACEN("initial " << PH(e) << " " << PH(ei)<< " von Ebene " << i);
|
||||
m_buffer[i] = PI[i].mark(PI[i].face(ei));
|
||||
}
|
||||
SHalfloop_handle li;
|
||||
if ( assign(li,supp_object(e,i)) ) {
|
||||
if ( PI[i].circle(li) != circle(e) ) { li = PI[i].twin(li); }
|
||||
m_buffer[i] = PI[i].mark(PI[i].face(li));
|
||||
TRACEN("initial " << PH(li) << " von Ebene " << i);
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_buffer[i] = PI[i].mark_of_halfsphere(-pos);
|
||||
TRACEN("no initial support");
|
||||
}
|
||||
}
|
||||
} else if ( e_below != SHalfedge_handle() ) {
|
||||
for (int i=0; i<2; ++i)
|
||||
for (int i=0; i<2; ++i) {
|
||||
TRACEN("edge below "<< PH(e_below) << " " << mark(e_below,i));
|
||||
m_buffer[i] = incident_mark(e_below,i);
|
||||
}
|
||||
} else { // e_below does not exist
|
||||
CGAL_nef3_assertion( point(v).hz() == 0 &&
|
||||
( pos > 0 ? (point(v).hx() >= 0) : (point(v).hx()<=0)) );
|
||||
|
|
@ -1044,6 +1089,8 @@ complete_face_support(SVertex_iterator v_start, SVertex_iterator v_end,
|
|||
|
||||
TRACEN(" mark of "<<PH(v)<<" "<<mark(v,0)<<" "<<mark(v,1));
|
||||
}
|
||||
|
||||
|
||||
SFace_iterator f;
|
||||
for (f = sfaces_begin(); f != sfaces_end(); ++f) {
|
||||
assoc_info(f);
|
||||
|
|
@ -1055,6 +1102,49 @@ complete_face_support(SVertex_iterator v_start, SVertex_iterator v_end,
|
|||
for (int i=0; i<2; ++i) mark(f,i) = incident_mark(e,i);
|
||||
}
|
||||
|
||||
TRACEN(psm_->point());
|
||||
|
||||
SVertex_handle v;
|
||||
CGAL_nef3_forall_svertices(v,*this)
|
||||
TRACEN(PH(v) << " " << mark(v,0));
|
||||
TRACEN(" ");
|
||||
CGAL_nef3_forall_svertices(v,PI[0])
|
||||
TRACEN(PH(v));
|
||||
TRACEN(" ");
|
||||
CGAL_nef3_forall_svertices(v,*this)
|
||||
TRACEN(PH(v) << " " << mark(v,1));
|
||||
TRACEN(" ");
|
||||
CGAL_nef3_forall_svertices(v,PI[1])
|
||||
TRACEN(PH(v));
|
||||
TRACEN(" ");
|
||||
|
||||
SHalfedge_handle e;
|
||||
CGAL_nef3_forall_shalfedges(e,*this)
|
||||
TRACEN(PH(e)<< " " << mark(e,0));
|
||||
TRACEN(" ");
|
||||
CGAL_nef3_forall_shalfedges(e,PI[0])
|
||||
TRACEN(PH(e)<< " " << PI[0].mark(e) << " " << PI[0].mark(PI[0].face(e)));
|
||||
TRACEN(" ");
|
||||
CGAL_nef3_forall_shalfedges(e,*this)
|
||||
TRACEN(PH(e) << " " << mark(e,1));
|
||||
TRACEN(" ");
|
||||
CGAL_nef3_forall_shalfedges(e,PI[1])
|
||||
TRACEN(PH(e) << " " << PI[1].mark(e) << " " << PI[1].mark(PI[1].face(e)));
|
||||
TRACEN(" ");
|
||||
|
||||
SFace_handle ff;
|
||||
CGAL_nef3_forall_sfaces(ff,*this)
|
||||
TRACEN(&*ff << " " << mark(ff,0));
|
||||
TRACEN(" ");
|
||||
CGAL_nef3_forall_sfaces(ff,PI[0])
|
||||
TRACEN(&*ff << " " << PI[0].mark(ff));
|
||||
TRACEN(" ");
|
||||
CGAL_nef3_forall_sfaces(ff,*this)
|
||||
TRACEN(&*ff << " " << mark(ff,1));
|
||||
TRACEN(" ");
|
||||
CGAL_nef3_forall_sfaces(ff,PI[1])
|
||||
TRACEN(&*ff << " " << PI[1].mark(ff));
|
||||
TRACEN(" ");
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1072,7 +1162,9 @@ merge_nodes(SHalfedge_handle e1, SHalfedge_handle e2,
|
|||
CGAL_For_all(eav,ee) { set_source(eav,v1); }
|
||||
link_as_prev_next_pair(e2,e1);
|
||||
link_as_prev_next_pair(ep1,en2);
|
||||
D.assert_equal_marks(v1,v2);
|
||||
//D.assert_equal_marks(v1,v2);
|
||||
mark(v1,0) = mark(v1,0) || mark(v2,0);
|
||||
mark(v1,1) = mark(v1,1) || mark(v2,1);
|
||||
D.discard_info(v2);
|
||||
delete_vertex_only(v2);
|
||||
}
|
||||
|
|
@ -1107,6 +1199,8 @@ merge_halfsphere_maps(SVertex_handle v1, SVertex_handle v2,
|
|||
set_face(e1,f);
|
||||
if ( e2 == first_out_edge(source(e2)) )
|
||||
set_first_out_edge(source(e2),e1t);
|
||||
mark(e1,0) = mark(e1,0) || mark(e2,0);
|
||||
mark(e1,1) = mark(e1,1) || mark(e2,1);
|
||||
D.discard_info(e2);
|
||||
delete_edge_pair_only(e2);
|
||||
}
|
||||
|
|
@ -1173,6 +1267,23 @@ void SNC_SM_overlayer<Refs_>::simplify() const
|
|||
set_face(target(e),face(e));
|
||||
delete_edge_pair(e);
|
||||
}
|
||||
|
||||
SVertex_handle v;
|
||||
CGAL_nef3_forall_svertices(v,*this)
|
||||
TRACEN(PH(v) << " " << mark(v));
|
||||
TRACEN(" ");
|
||||
|
||||
|
||||
SHalfedge_handle e;
|
||||
CGAL_nef3_forall_shalfedges(e,*this)
|
||||
TRACEN(PH(e)<< " " << mark(e));
|
||||
TRACEN(" ");
|
||||
|
||||
SFace_handle ff;
|
||||
CGAL_nef3_forall_sfaces(ff,*this)
|
||||
TRACEN(&*ff << " " << mark(ff));
|
||||
TRACEN(" ");
|
||||
|
||||
}
|
||||
|
||||
CGAL::Unique_hash_map<SHalfedge_handle,bool> linked(false);
|
||||
|
|
@ -1191,6 +1302,20 @@ void SNC_SM_overlayer<Refs_>::simplify() const
|
|||
link_as_loop(twin(l),f);
|
||||
}
|
||||
|
||||
SVertex_handle vi;
|
||||
CGAL_nef3_forall_svertices(vi,*this)
|
||||
TRACEN(PH(vi) << " " << mark(vi));
|
||||
TRACEN(" ");
|
||||
|
||||
SHalfedge_handle ei;
|
||||
CGAL_nef3_forall_shalfedges(ei,*this)
|
||||
TRACEN(PH(ei)<< " " << mark(ei));
|
||||
TRACEN(" ");
|
||||
|
||||
SFace_handle ff;
|
||||
CGAL_nef3_forall_sfaces(ff,*this)
|
||||
TRACEN(&*ff << " " << mark(ff));
|
||||
TRACEN(" ");
|
||||
|
||||
SVertex_iterator v,vn;
|
||||
for(v = svertices_begin(); v != svertices_end(); v=vn) {
|
||||
|
|
@ -1213,6 +1338,23 @@ void SNC_SM_overlayer<Refs_>::simplify() const
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
CGAL_nef3_forall_svertices(vi,*this)
|
||||
TRACEN(PH(vi) << " " << mark(vi));
|
||||
TRACEN(" ");
|
||||
|
||||
|
||||
CGAL_nef3_forall_shalfedges(ei,*this)
|
||||
TRACEN(PH(ei)<< " " << mark(ei));
|
||||
TRACEN(" ");
|
||||
|
||||
|
||||
|
||||
CGAL_nef3_forall_sfaces(ff,*this)
|
||||
TRACEN(&*ff << " " << mark(ff));
|
||||
TRACEN(" ");
|
||||
|
||||
SFace_iterator fn;
|
||||
for (f = fn = sfaces_begin(); f != sfaces_end(); f=fn) {
|
||||
++fn;
|
||||
|
|
@ -1222,6 +1364,21 @@ void SNC_SM_overlayer<Refs_>::simplify() const
|
|||
}
|
||||
|
||||
|
||||
CGAL_nef3_forall_svertices(vi,*this)
|
||||
TRACEN(PH(vi) << " " << mark(vi));
|
||||
TRACEN(" ");
|
||||
|
||||
|
||||
CGAL_nef3_forall_shalfedges(ei,*this)
|
||||
TRACEN(PH(ei)<< " " << mark(ei));
|
||||
TRACEN(" ");
|
||||
|
||||
|
||||
|
||||
CGAL_nef3_forall_sfaces(ff,*this)
|
||||
TRACEN(&*ff << " " << mark(ff));
|
||||
TRACEN(" ");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include <CGAL/Nef_3/SNC_SM_overlayer.h>
|
||||
#include <CGAL/Nef_3/SNC_SM_point_locator.h>
|
||||
#include <CGAL/Nef_3/SNC_FM_decorator.h>
|
||||
#include <CGAL/Nef_3/SNC_ray_shoter.h>
|
||||
#include <CGAL/Nef_3/SNC_ray_shooter.h>
|
||||
#ifdef SM_VISUALIZOR
|
||||
#include <CGAL/Nef_3/SNC_SM_visualizor.h>
|
||||
#endif // SM_VISUALIZOR
|
||||
|
|
@ -146,7 +146,7 @@ public:
|
|||
typedef CGAL::SNC_constructor<SNC_structure> Self;
|
||||
typedef CGAL::SNC_decorator<SNC_structure> Base;
|
||||
typedef CGAL::SNC_decorator<SNC_structure> SNC_decorator;
|
||||
typedef CGAL::SNC_ray_shoter<SNC_structure> SNC_ray_shoter;
|
||||
typedef CGAL::SNC_ray_shooter<SNC_structure> SNC_ray_shooter;
|
||||
typedef CGAL::SNC_FM_decorator<SNC_structure> FM_decorator;
|
||||
typedef CGAL::SNC_SM_decorator<SNC_structure> SM_decorator;
|
||||
typedef CGAL::SNC_SM_overlayer<SNC_structure> SM_overlayer;
|
||||
|
|
@ -336,14 +336,14 @@ public:
|
|||
}
|
||||
|
||||
Halffacet_handle get_facet_below( Vertex_handle vi) const
|
||||
/*{\Mop determines the facet below a vertex |vi| via ray shoting. }*/ {
|
||||
/*{\Mop determines the facet below a vertex |vi| via ray shooting. }*/ {
|
||||
Halffacet_handle f_below;
|
||||
Point_3 p = point(vi);
|
||||
// ######### Non-generic code ##########
|
||||
Segment_3 ray( p, Point_3( p.hx(), p.hy(), -INT_MAX*p.hw(), p.hw()));
|
||||
// ####################################
|
||||
SNC_ray_shoter rs(*sncp());
|
||||
Object_handle o = rs.shot(ray);
|
||||
SNC_ray_shooter rs(*sncp());
|
||||
Object_handle o = rs.shoot(ray);
|
||||
Vertex_handle v;
|
||||
Halfedge_handle e;
|
||||
Halffacet_handle f;
|
||||
|
|
@ -435,6 +435,8 @@ create_box_corner(int x, int y, int z, bool space, bool boundary) const {
|
|||
// Creates the local graph of a facet f at point p.
|
||||
// Precondition is that p ist part of f.
|
||||
|
||||
#define CGAL_NEF3_BUGGY_CODE
|
||||
|
||||
template <typename SNC_>
|
||||
typename SNC_::Vertex_handle
|
||||
SNC_constructor<SNC_>::
|
||||
|
|
@ -549,17 +551,16 @@ pair_up_halfedges() const
|
|||
CGAL_nef3_forall_halfedges(e,*sncp()) {
|
||||
Point_3 p = point(vertex(e));
|
||||
Pluecker_line_3 l(p, p + tmp_point(e));
|
||||
TRACEN(" "<<p<<" "<<tmp_point(e)<<" "<<&*e<<" "<<l);
|
||||
int inverted;
|
||||
l = categorize(l,inverted);
|
||||
M[l].push_back(Halfedge_key(p,inverted,e,D));
|
||||
TRACEN(" ("<<p<<") ("<<tmp_point(e)<<") "<<&*e<<" |"<<l << " " << inverted);
|
||||
}
|
||||
|
||||
typename Pluecker_line_map::iterator it;
|
||||
CGAL_nef3_forall_iterators(it,M) {
|
||||
it->second.sort(Halfedge_key_lt());
|
||||
TRACEN(" "<<it->first<<"\n "
|
||||
<<(debug_container(it->second),""));
|
||||
TRACEN("search opposite "<<it->first<< "\n " <<(debug_container(it->second),"")<< std::endl);
|
||||
typename Halfedge_list::iterator itl;
|
||||
CGAL_nef3_forall_iterators(itl,it->second) {
|
||||
Halfedge_handle e1 = itl->e;
|
||||
|
|
@ -702,7 +703,7 @@ create_volumes() const
|
|||
V.increment_shell_number();
|
||||
}
|
||||
/* then, we determine the Shells which correspond to Volumes via a ray
|
||||
shotting in the direction (-1,0,0) over the Sphere_map of the minimal
|
||||
shootting in the direction (-1,0,0) over the Sphere_map of the minimal
|
||||
vertex. The Shell corresponds to a Volume if the object hit belongs
|
||||
to another Shell. */
|
||||
sncp()->new_volume(); // outermost volume (nirvana)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
#include <CGAL/Nef_3/SNC_SM_point_locator.h>
|
||||
#include <CGAL/Nef_3/SNC_SM_overlayer.h>
|
||||
#include <CGAL/Nef_3/SNC_SM_io_parser.h>
|
||||
#include <CGAL/Nef_3/SNC_ray_shoter.h>
|
||||
#include <CGAL/Nef_3/SNC_ray_shooter.h>
|
||||
#ifdef CGAL_NEF3_SM_VISUALIZOR
|
||||
#include <CGAL/Nef_3/SNC_SM_visualizor.h>
|
||||
#endif // CGAL_NEF3_SM_VISUALIZOR
|
||||
|
|
@ -54,7 +54,7 @@ class SNC_decorator {
|
|||
typedef SNC_structure_ SNC_structure;
|
||||
typedef SNC_decorator<SNC_structure> Self;
|
||||
typedef SNC_constructor<SNC_structure> SNC_constructor;
|
||||
typedef SNC_ray_shoter<SNC_structure> SNC_ray_shoter;
|
||||
typedef SNC_ray_shooter<SNC_structure> SNC_ray_shooter;
|
||||
typedef SNC_SM_decorator<SNC_structure> SM_decorator;
|
||||
typedef SNC_SM_overlayer<SNC_structure> SM_overlayer;
|
||||
typedef SNC_SM_point_locator<SNC_structure> SM_point_locator;
|
||||
|
|
@ -403,7 +403,7 @@ public:
|
|||
|
||||
Halffacet_handle get_visible_facet( const Vertex_handle v,
|
||||
const Segment_3& ray) const
|
||||
/*{\Mop when one shot a ray |ray| in order to find the facet below to
|
||||
/*{\Mop when one shoot a ray |ray| in order to find the facet below to
|
||||
an object, and vertex |v| is hit, we need to choose one of the facets
|
||||
in the adjacency list of |v| such that it could be 'seen' from the
|
||||
piercing point of the |ray| on the sphere map on |v|. We make it just
|
||||
|
|
@ -445,7 +445,7 @@ public:
|
|||
|
||||
Halffacet_handle get_visible_facet( const Halfedge_handle e,
|
||||
const Segment_3& ray) const
|
||||
/*{\Mop when one shot a ray |ray| in order to find the facet below to
|
||||
/*{\Mop when one shoot a ray |ray| in order to find the facet below to
|
||||
an object, and an edge |e| is hit, we need to choose one of the two
|
||||
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|
|
||||
|
|
@ -479,7 +479,7 @@ public:
|
|||
|
||||
Halffacet_handle get_visible_facet( const Halffacet_handle f,
|
||||
const Segment_3& ray) const
|
||||
/*{\Mop when one shot a ray |ray| in order to find the facet below to
|
||||
/*{\Mop when one shoot a ray |ray| in order to find the facet below to
|
||||
an object, and a facet |f| is hit, we need to choose the right facet
|
||||
from the halffacet pair |f| that could be 'seen' from the
|
||||
piercing point of the |ray| on the local (virtual) view of |f|.
|
||||
|
|
@ -497,6 +497,7 @@ public:
|
|||
Vertex_handle binop_local_views( Vertex_handle v0, Vertex_handle v1,
|
||||
const Selection& BOP, SNC_structure& rsnc)
|
||||
/*{\opOverlays two spheres maps.}*/ {
|
||||
|
||||
#ifdef CGAL_NEF3_DUMP_SPHERE_MAPS
|
||||
typedef SNC_SM_io_parser<SNC_structure> SNC_SM_io_parser;
|
||||
SNC_SM_io_parser IO0( std::cerr, v0);
|
||||
|
|
@ -514,7 +515,7 @@ public:
|
|||
O.subdivide( v0, v1);
|
||||
O.select( BOP);
|
||||
O.simplify();
|
||||
// O.check_integrity_and_topological_planarity();
|
||||
O.check_integrity_and_topological_planarity();
|
||||
|
||||
#ifdef CGAL_NEF3_DUMP_SPHERE_MAPS
|
||||
TRACEN(" result sphere map:");
|
||||
|
|
@ -567,7 +568,7 @@ public:
|
|||
SNC_structure& P1i,
|
||||
SNC_structure& result)
|
||||
/*{\op }*/ {
|
||||
SNC_ray_shoter rs(P1i);
|
||||
SNC_ray_shooter rs(P1i);
|
||||
Vertex_handle v;
|
||||
Halfedge_handle e;
|
||||
Halffacet_handle f;
|
||||
|
|
@ -619,6 +620,8 @@ public:
|
|||
O1.print();
|
||||
#endif // CGAL_NEF3_DUMP_SNC_OPERATORS
|
||||
|
||||
// SETDTHREAD(131*19*43);
|
||||
|
||||
TRACEN("=> for all v0 in snc0, qualify v0 with respect snc1");
|
||||
|
||||
TRACEN("vertices on snc0:");
|
||||
|
|
@ -636,9 +639,8 @@ public:
|
|||
snc1i.number_of_vertices()<<' '<<
|
||||
result.number_of_vertices());
|
||||
|
||||
//cerr << "Checkpoint SNC_d 1 " << std::endl;
|
||||
|
||||
CGAL_nef3_forall_vertices( v0, *sncp()) {
|
||||
|
||||
CGAL_nef3_assertion(!Ignore[v0]);
|
||||
v1 = qualify_with_respect( point(v0), snc1i, result);
|
||||
TRACEN("=> overlay of vertices v0 "<<&*v0<<" v1 "<<&*v1);
|
||||
|
|
@ -648,16 +650,12 @@ public:
|
|||
else
|
||||
Ignore[v1] = true;
|
||||
|
||||
//cerr << "Checkpoint SNC_d 2 " << std::endl;
|
||||
|
||||
TRACEN("vertices on snc0 sn1 snc01: "<<
|
||||
sncp()->number_of_vertices()<<' '<<
|
||||
snc1i.number_of_vertices()<<' '<<
|
||||
result.number_of_vertices());
|
||||
}
|
||||
|
||||
//cerr << "Checkpoint SNC_d 2c " << std::endl;
|
||||
|
||||
TRACEN("=> for all v1 in snc1, qualify v1 with respect snc0");
|
||||
|
||||
TRACEN("vertices on snc0:");
|
||||
|
|
@ -671,6 +669,7 @@ public:
|
|||
TRACEN("end vertices"<<std::endl);
|
||||
|
||||
CGAL_nef3_forall_vertices( v1, snc1i) {
|
||||
|
||||
if( Ignore[v1]) continue;
|
||||
v0 = qualify_with_respect( point(v1), *sncp(), result);
|
||||
TRACEN("=> overlay of vertices v1 "<<&*v1<<" v0 "<<&*v0);
|
||||
|
|
@ -683,9 +682,7 @@ public:
|
|||
snc1i.number_of_vertices()<<' '<<
|
||||
result.number_of_vertices());
|
||||
}
|
||||
|
||||
//cerr << "Checkpoint SNC_d 2d " << std::endl;
|
||||
|
||||
|
||||
TRACEN("=> edge facet intersection");
|
||||
|
||||
TRACEN("vertices on snc0:");
|
||||
|
|
@ -698,30 +695,50 @@ public:
|
|||
CGAL_nef3_forall_vertices( v0, result) TRACEN(point(v0)<<&*(v0->sncp_));
|
||||
TRACEN("end vertices"<<std::endl);
|
||||
|
||||
SNC_ray_shoter rs(*sncp());
|
||||
SNC_ray_shooter rs(*sncp());
|
||||
|
||||
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 )) {
|
||||
TRACEN(" edge0 face1 intersection...");
|
||||
v0 = qualify_with_respect( ip, *sncp(), result);
|
||||
v1 = qualify_with_respect( ip, snc1i, result);
|
||||
binop_local_views( v0, v1, BOP, result);
|
||||
result.delete_vertex(v0);
|
||||
result.delete_vertex(v1);
|
||||
Unique_hash_map<Halfedge_handle, bool> Ignore_halfedge(false);
|
||||
CGAL_nef3_forall_halfedges( e0, *sncp()) {
|
||||
TRACEN(PH(e0));
|
||||
if(!Ignore_halfedge[e0]) {
|
||||
CGAL_nef3_forall_facets( f1, snc1i) {
|
||||
Point_3 ip;
|
||||
if( rs.does_intersect_internally( segment(e0), f1, ip )) {
|
||||
TRACEN(" edge0 face1 intersection...");
|
||||
v0 = qualify_with_respect( ip, *sncp(), result);
|
||||
v1 = qualify_with_respect( ip, snc1i, result);
|
||||
binop_local_views( v0, v1, BOP, result);
|
||||
result.delete_vertex(v0);
|
||||
result.delete_vertex(v1);
|
||||
Ignore_halfedge[twin(e0)]=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CGAL_nef3_forall_edges( e1, snc1i) {
|
||||
CGAL_nef3_forall_facets( f0, *sncp()) {
|
||||
Point_3 ip;
|
||||
if( rs.does_intersect_internally( segment(e1), f0, ip )) {
|
||||
TRACEN(" edge1 face0 intersection...");
|
||||
|
||||
Halffacet_cycle_iterator it;
|
||||
CGAL_nef3_forall_facet_cycles_of(it,f0){
|
||||
TRACEN("facet cycle");
|
||||
SHalfedge_handle es;
|
||||
if ( assign(es,it)) {
|
||||
SHalfedge_around_facet_circulator start(es), end(es);
|
||||
CGAL_For_all(start,end) {
|
||||
TRACEN("vertex " << PH(source(previous(start))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
v1 = qualify_with_respect( ip, snc1i, result);
|
||||
v0 = qualify_with_respect( ip, *sncp(), result);
|
||||
|
||||
binop_local_views( v0, v1, BOP, result);
|
||||
result.delete_vertex(v0);
|
||||
result.delete_vertex(v1);
|
||||
|
|
@ -752,9 +769,7 @@ public:
|
|||
SNC_io_parser<SNC_structure> O(std::cout, result);
|
||||
O.print();
|
||||
#endif // CGAL_NEF3_DUMP_SNC_OPERATORS
|
||||
|
||||
//cerr << "Checkpoint SNC_d 3 " << std::endl;
|
||||
|
||||
|
||||
// remove vertices whose local view is not that of a vertex
|
||||
Vertex_iterator vi, vin;
|
||||
for( vi = result.vertices_begin(); vi != result.vertices_end(); vi = vin) {
|
||||
|
|
@ -771,7 +786,7 @@ public:
|
|||
mark(vi) == SD.mark(SD.svertices_begin())))
|
||||
result.delete_vertex(vi);
|
||||
}
|
||||
|
||||
|
||||
// synthesis of spatial structure
|
||||
SNC_constructor C(result);
|
||||
C.pair_up_halfedges();
|
||||
|
|
@ -780,9 +795,6 @@ public:
|
|||
C.create_volumes();
|
||||
result.simplify();
|
||||
|
||||
|
||||
//cerr << "Checkpoint SNC_d 4 " << std::endl;
|
||||
|
||||
#ifdef CGAL_NEF3_DUMP_SNC_OPERATORS
|
||||
TRACEN("=> construction completed, result: ");
|
||||
SNC_io_parser<SNC_structure> Op(std::cout, result);
|
||||
|
|
|
|||
|
|
@ -244,6 +244,12 @@ namespace OGL {
|
|||
glNormal3dv(pu);
|
||||
}
|
||||
|
||||
inline void combineCallback(GLdouble coords[3], void *vertex_data[4], GLfloat weight[4], void **outData)
|
||||
{
|
||||
|
||||
*outData = vertex_data;
|
||||
}
|
||||
|
||||
class Polyhedron {
|
||||
std::list<DPoint> vertices_;
|
||||
std::list<DSegment> edges_;
|
||||
|
|
@ -320,6 +326,8 @@ namespace OGL {
|
|||
(GLvoid (*)()) &endCallback);
|
||||
gluTessCallback(tess_, GLenum(GLU_TESS_ERROR),
|
||||
(GLvoid (*)()) &errorCallback);
|
||||
gluTessCallback(tess_, GLenum(GLU_TESS_COMBINE),
|
||||
(GLvoid (*)()) &combineCallback);
|
||||
gluTessProperty(tess_, GLenum(GLU_TESS_WINDING_RULE),
|
||||
GLU_TESS_WINDING_POSITIVE);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,23 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
||||
#ifndef CGAL_DEBUG_H
|
||||
#define CGAL_DEBUG_H
|
||||
|
||||
static int debugthread=1;
|
||||
|
||||
template <typename C>
|
||||
void debug_container(const C& container,
|
||||
std::ostream& os = std::cerr)
|
||||
{ typename C::const_iterator it;
|
||||
for(it = container.begin(); it != container.end(); ++it)
|
||||
os << *it << std::endl;
|
||||
}
|
||||
|
||||
#endif //CGAL_DEBUG_H
|
||||
|
||||
#undef TRACE
|
||||
#undef TRACEN
|
||||
#undef TRACEV
|
||||
|
|
@ -77,19 +94,5 @@
|
|||
#define CTRACEN(b,t)
|
||||
#endif
|
||||
|
||||
#ifndef CGAL_DEBUG_H
|
||||
#define CGAL_DEBUG_H
|
||||
|
||||
static int debugthread=3141592;
|
||||
|
||||
template <typename C>
|
||||
void debug_container(const C& container,
|
||||
std::ostream& os = std::cerr)
|
||||
{ typename C::const_iterator it;
|
||||
for(it = container.begin(); it != container.end(); ++it)
|
||||
os << *it << std::endl;
|
||||
}
|
||||
|
||||
#endif //CGAL_DEBUG_H
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#include <CGAL/Nef_3/SNC_decorator.h>
|
||||
#include <CGAL/Nef_3/SNC_constructor.h>
|
||||
#include <CGAL/Nef_3/SNC_io_parser.h>
|
||||
#include <CGAL/Nef_3/SNC_ray_shoter.h>
|
||||
#include <CGAL/Nef_3/SNC_ray_shooter.h>
|
||||
#ifdef CGAL_NEF3_VISUALIZOR
|
||||
#include <CGAL/Nef_3/SNC_visualizor_OGL.h>
|
||||
#endif // CGAL_NEF3_VISUALIZOR
|
||||
|
|
@ -82,7 +82,7 @@ class Nef_polyhedron_3_rep : public Ref_counted
|
|||
typedef CGAL::SNC_structure<T> SNC_structure;
|
||||
typedef CGAL::SNC_decorator<SNC_structure> SNC_decorator;
|
||||
typedef CGAL::SNC_constructor<SNC_structure> SNC_constructor;
|
||||
typedef CGAL::SNC_ray_shoter<SNC_structure> SNC_ray_shoter;
|
||||
typedef CGAL::SNC_ray_shooter<SNC_structure> SNC_ray_shooter;
|
||||
typedef CGAL::SNC_io_parser<SNC_structure> SNC_io_parser;
|
||||
|
||||
#ifdef CGAL_NEF3_VISUALIZOR
|
||||
|
|
@ -151,7 +151,7 @@ protected:
|
|||
typedef typename Nef_rep::SNC_structure SNC_structure;
|
||||
typedef typename Nef_rep::SNC_decorator SNC_decorator;
|
||||
typedef typename Nef_rep::SNC_constructor SNC_constructor;
|
||||
typedef typename Nef_rep::SNC_ray_shoter SNC_ray_shoter;
|
||||
typedef typename Nef_rep::SNC_ray_shooter SNC_ray_shooter;
|
||||
typedef typename Nef_rep::SNC_io_parser SNC_io_parser;
|
||||
|
||||
#ifdef CGAL_NEF3_VISUALIZOR
|
||||
|
|
@ -252,6 +252,7 @@ protected:
|
|||
|
||||
void build_external_structure() {
|
||||
SNC_constructor C(snc());
|
||||
// SETDTHREAD(43);
|
||||
C.pair_up_halfedges();
|
||||
C.link_shalfedges_to_facet_cycles();
|
||||
C.categorize_facet_cycles_and_create_facets();
|
||||
|
|
@ -299,30 +300,32 @@ public:
|
|||
|
||||
class Visitor {
|
||||
|
||||
Object_index<Vertex_iterator> *VI;
|
||||
Polyhedron_incremental_builder_3<HDS> *B;
|
||||
SNC_decorator *D;
|
||||
const Object_index<Vertex_iterator>& VI;
|
||||
Polyhedron_incremental_builder_3<HDS>& B;
|
||||
SNC_decorator& D;
|
||||
|
||||
public:
|
||||
Visitor(Polyhedron_incremental_builder_3<HDS> *BB,
|
||||
SNC_decorator *sd,
|
||||
Object_index<Vertex_iterator> *vi) {B=BB; D=sd; VI=vi;}
|
||||
Visitor(Polyhedron_incremental_builder_3<HDS>& BB,
|
||||
SNC_decorator& sd,
|
||||
Object_index<Vertex_iterator>& vi) : VI(vi), D(sd), B(BB){}
|
||||
|
||||
void visit(Halffacet_handle f) {
|
||||
void visit(Halffacet_handle opposite_facet) {
|
||||
|
||||
SHalfedge_handle se;
|
||||
Halffacet_cycle_iterator fc;
|
||||
|
||||
B->begin_facet();
|
||||
Halffacet_handle f = D.twin(opposite_facet);
|
||||
|
||||
B.begin_facet();
|
||||
fc = f->facet_cycles_begin();
|
||||
assign(se,fc);
|
||||
CGAL_assertion(se!=0);
|
||||
SHalfedge_around_facet_circulator hc_start(se);
|
||||
SHalfedge_around_facet_circulator hc_end(hc_start);
|
||||
CGAL_For_all(hc_start,hc_end) {
|
||||
B->add_vertex_to_facet((*VI)[D->vertex(hc_start)]);
|
||||
B.add_vertex_to_facet(VI[D.vertex(hc_start)]);
|
||||
}
|
||||
B->end_facet();
|
||||
B.end_facet();
|
||||
}
|
||||
|
||||
void visit(SFace_handle s) {}
|
||||
|
|
@ -360,7 +363,7 @@ public:
|
|||
|
||||
int outer_volume = 0;
|
||||
Shell_entry_iterator it;
|
||||
Visitor V(&B,&D,&VI);
|
||||
Visitor V(B,D,VI);
|
||||
Volume_handle c;
|
||||
CGAL_nef3_forall_volumes(c,snc) {
|
||||
if(outer_volume++ > 1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue