This commit is contained in:
Giles Bathgate 2025-12-03 14:01:24 +01:00 committed by GitHub
commit b7e30b78a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 45 additions and 8 deletions

View File

@ -62,9 +62,10 @@ class Shell_to_nef_3
private:
SNC_structure& S;
bool preserve_marks;
public:
Shell_to_nef_3(SNC_structure& S_) : S(S_) {}
Shell_to_nef_3(SNC_structure& S_, bool m_) : S(S_), preserve_marks(m_) {}
void visit(Vertex_const_handle ) {}
void visit(Halfedge_const_handle ) {}
@ -83,7 +84,7 @@ class Shell_to_nef_3
Vertex_const_handle pv = sf->center_vertex();
Vertex_handle nv = S.new_vertex();
nv->point() = pv->point();
nv->mark() = true;
nv->mark() = preserve_marks ? pv->mark() : true;
SM_decorator SM(&*nv);
SHalfedge_around_sface_const_circulator
@ -91,7 +92,7 @@ class Shell_to_nef_3
SVertex_handle sv_0 =
SM.new_svertex(pe->source()->point());
sv_0->mark() = true;
sv_0->mark() = preserve_marks ? pe->source()->mark() : true;
#ifndef CGAL_NEF_NO_INDEXED_ITEMS
sv_0->set_index(pe->source()->get_index());
#endif
@ -100,7 +101,7 @@ class Shell_to_nef_3
do {
SVertex_handle sv = SM.new_svertex(pe->source()->point());
sv->mark() = true;
sv->mark() = preserve_marks ? pe->source()->mark() : true;
#ifndef CGAL_NEF_NO_INDEXED_ITEMS
sv->set_index(pe->source()->get_index());
#endif
@ -108,7 +109,8 @@ class Shell_to_nef_3
SHalfedge_handle e = SM.new_shalfedge_pair(sv_prev, sv);
e->circle() = pe_prev->circle();
e->twin()->circle() = pe_prev->twin()->circle();
e->mark() = e->twin()->mark() = true;
e->mark() = preserve_marks ? pe_prev->mark() : true;
e->twin()->mark() = preserve_marks ? pe_prev->twin()->mark() : true;
#ifndef CGAL_NEF_NO_INDEXED_ITEMS
e->set_index(pe_prev->get_index());
e->twin()->set_index(pe_prev->twin()->get_index());
@ -123,7 +125,8 @@ class Shell_to_nef_3
e = SM.new_shalfedge_pair(sv_prev, sv_0);
e->circle() = pe_prev->circle();
e->twin()->circle() = pe_prev->twin()->circle();
e->mark() = e->twin()->mark() = true;
e->mark() = preserve_marks ? pe_prev->mark() : true;
e->twin()->mark() = preserve_marks ? pe_prev->twin()->mark() : true;
#ifndef CGAL_NEF_NO_INDEXED_ITEMS
e->set_index(pe_prev->get_index());
e->twin()->set_index(pe_prev->twin()->get_index());
@ -144,9 +147,10 @@ class Shell_to_nef_3
template <class Nef_polyhedron>
void shell_to_nef_3(const Nef_polyhedron& N,
typename Nef_polyhedron::SFace_const_handle sf,
typename Nef_polyhedron::SNC_structure& S)
typename Nef_polyhedron::SNC_structure& S,
bool preserve_marks = false)
{
Shell_to_nef_3<typename Nef_polyhedron::SNC_structure> s2n(S);
Shell_to_nef_3<typename Nef_polyhedron::SNC_structure> s2n(S,preserve_marks);
N.visit_shell_objects(sf, s2n);
}

View File

@ -1523,6 +1523,39 @@ protected:
return res;
}
Nef_polyhedron_3<Kernel,Items, Mark>
append(const Nef_polyhedron_3<Kernel,Items, Mark>& N1)
/*{\Mop returns |\Mvar| with N1 appended }*/ {
CGAL_NEF_TRACEN(" append between nef3 "<<&*this<<" and "<<&N1);
Shell_entry_const_iterator si;
CGAL_forall_shells_of(si,N1.volumes_begin())
CGAL::shell_to_nef_3(N1,si,snc(),true);
SNC_external_structure es(snc());
es.clear_external_structure();
build_external_structure();
mark_bounded_volumes();
return *this;
}
template <typename Range>
Nef_polyhedron_3<Kernel,Items, Mark>
append(const Range& N)
/*{\Mop returns |\Mvar| with the range N appended }*/ {
for(typename Range::const_iterator N1=N.begin(); N1!=N.end(); ++N1) {
CGAL_NEF_TRACEN(" append between nef3 "<<&*this<<" and "<<&*N1);
Shell_entry_const_iterator si;
CGAL_forall_shells_of(si,N1->volumes_begin())
CGAL::shell_to_nef_3(*N1,si,snc(),true);
}
SNC_external_structure es(snc());
es.clear_external_structure();
build_external_structure();
mark_bounded_volumes();
return *this;
}
Nef_polyhedron_3<Kernel,Items, Mark>
difference(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) const
/*{\Mop returns |\Mvar| $-$ |N1|. }*/ {