stable version

This commit is contained in:
Peter Hachenberger 2007-04-12 10:20:45 +00:00
parent a3814513a1
commit edc4799d95
4 changed files with 707 additions and 383 deletions

File diff suppressed because it is too large Load Diff

View File

@ -180,7 +180,6 @@ class SM_walls : SM_decorator<SMap> {
bool legal_direction(Sphere_segment seg, Object_handle& o, Sphere_point& ip) {
CGAL_NEF_TRACEN( "legal_direction " << seg );
// CGAL_NEF_SETDTHREAD(47);
SM_point_locator P(this->sphere_map());
o = P.ray_shoot(seg, ip, false, false);
@ -355,10 +354,7 @@ class SM_walls : SM_decorator<SMap> {
Sphere_point ip;
SM_point_locator P(this->sphere_map());
// CGAL_NEF_SETDTHREAD(47);
Object_handle o = P.ray_shoot(sphere_ray.source(), sphere_ray.sphere_circle(), ip);
// CGAL_NEF_SETDTHREAD(1);
if(compare_to_dir && dir != sphere_ray.source() && dir != ip) {
Sphere_segment test_seg(sphere_ray.source(), ip, sphere_ray.sphere_circle());
if(test_seg.has_on(dir)) {
@ -420,11 +416,11 @@ class SM_walls : SM_decorator<SMap> {
#ifdef CGAL_NEF_INDEXED_ITEMS
void add_sedge_between(SVertex_handle sv1, SVertex_handle sv2,
int& index1, int& index2,
Sphere_circle c = Sphere_circle()) {
Sphere_circle c) {
#else
void add_sedge_between(SVertex_handle sv1, SVertex_handle sv2,
Sphere_circle c = Sphere_circle()) { // = Sphere_circle(sv1->point(),sv2->point())) {
Sphere_circle c) { // = Sphere_circle(sv1->point(),sv2->point())) {
#endif
CGAL_NEF_TRACEN( "add sedges between " << sv1->point()
<< ", " << sv2->point()
@ -432,7 +428,7 @@ class SM_walls : SM_decorator<SMap> {
/*
Sphere_circle test(Sphere_circle(sv1->point(),sv2->point()));
CGAL_assertion(c == normalized(test) ||
CGAL_assertion(normalized(c) == normalized(test) ||
sv1->point().antipode() == sv2->point());
*/
@ -451,16 +447,19 @@ class SM_walls : SM_decorator<SMap> {
unlink_as_isolated_vertex(sv2);
}
if(c == Sphere_circle()) {
c = Sphere_circle(sv1->point(), sv2->point());
c = normalized(c);
}
SHalfedge_handle cap1 = find_cap(sv1,sv2->point(),c);
if(cap1 != SHalfedge_handle()) CGAL_assertion(cap1->source()==sv1);
SHalfedge_handle cap2 = find_cap(sv2,sv1->point(),c.opposite());
if(cap2 != SHalfedge_handle()) CGAL_assertion(cap2->source()==sv2);
if(split_sface &&
cap1->incident_sface() == cap2->incident_sface()) {
SHalfedge_around_sface_circulator sfc(cap1), send(sfc);
CGAL_For_all(sfc,send)
if(is_sm_boundary_object(sfc))
unlink_as_face_cycle(sfc);
}
/*
bool same_sface;
SHalfedge_handle entry;
@ -506,6 +505,7 @@ class SM_walls : SM_decorator<SMap> {
se_new->mark() = se_new->twin()->mark() = true; // = se_new->incident_sface()->mark();
#ifdef CGAL_NEF_INDEXED_ITEMS
CGAL_assertion(index1==0 || index1!=index2);
if(index1==0) {
se_new->set_index();
se_new->twin()->set_index();
@ -533,14 +533,9 @@ class SM_walls : SM_decorator<SMap> {
SFace_handle sf_new = this->new_sface();
SFace_handle sf_old = cap1->incident_sface();
CGAL_NEF_TRACEN("sf_new->mark()=" << sf_old->mark());
sf_new->mark() = sf_old->mark();
/*
SHalfedge_around_sface_circulator sfc(cap1), send(sfc);
CGAL_For_all(sfc,send)
if(is_sm_boundary_object(sfc))
unlink_as_face_cycle(sfc);
*/
unlink_as_face_cycle(sf_old->sface_cycles_begin());
CGAL_assertion(sf_old->mark());
link_as_face_cycle(se_new, sf_new);
link_as_face_cycle(se_new->twin(), sf_old);
} else {

View File

@ -1,27 +1,27 @@
#include <CGAL/Nef_3/SNC_structure.h>
#include <CGAL/Nef_3/SNC_decorator.h>
#include <CGAL/Nef_3/SNC_io_parser.h>
#ifndef CGAL_MINKOWSKI_GAUSSIAN_MAP_TO_NEF3_H
#define CGAL_MINKOWSKI_GAUSSIAN_MAP_TO_NEF3_H
#include <CGAL/Nef_S2/SM_decorator.h>
#include <CGAL/Nef_S2/Gausian_map.h>
#include <CGAL/Modifier_base.h>
CGAL_BEGIN_NAMESPACE
template<typename Kernel_, typename Items_, typename Mark_>
class gausian_map_to_nef_3 : public Modifier_base<SNC_structure<Kernel_,Items_,Mark_> > {
template<typename Nef3>
class gausian_map_to_nef_3 : public Modifier_base<typename Nef3::SNC_structure > {
typedef Kernel_ Kernel;
typedef Items_ Items;
typedef Mark_ Mark;
typedef CGAL::SNC_structure<Kernel,Items,Mark> SNC_structure;
typedef CGAL::SNC_decorator<SNC_structure> SNC_decorator;
typedef typename Nef3::Kernel Kernel;
typedef typename Nef3::SNC_structure SNC_structure;
typedef typename SNC_structure::Sphere_map Sphere_map;
typedef CGAL::SM_decorator<Sphere_map> SM_decorator;
typedef CGAL::Gausian_map<Kernel> Gausian_map;
typedef typename Gausian_map::SFace_const_iterator SFace_const_iterator;
typedef typename Gausian_map::SFace_const_handle SFace_const_handle;
typedef typename Gausian_map::SHalfedge_const_iterator SHalfedge_const_iterator;
typedef typename Gausian_map::SHalfedge_const_handle SHalfedge_const_handle;
typedef typename Gausian_map::SVertex_const_iterator SVertex_const_iterator;
typedef typename Gausian_map::SVertex_const_handle SVertex_const_handle;
typedef typename Gausian_map::SHalfedge_around_sface_const_circulator
SHalfedge_around_sface_const_circulator;
@ -33,20 +33,35 @@ template<typename Kernel_, typename Items_, typename Mark_>
typedef typename SNC_structure::Sphere_circle Sphere_circle;
typedef typename SNC_structure::Sphere_point Sphere_point;
Gausian_map& G;
const Gausian_map& G;
public:
gausian_map_to_nef_3(Gausian_map& Gin) : G(Gin) {}
gausian_map_to_nef_3(const Gausian_map& Gin) : G(Gin) {}
void operator()(SNC_structure& snc) {
Unique_hash_map<SFace_const_handle, Vertex_handle> sface2vertex;
SNC_decorator SD(snc);
#ifdef CGAL_NEF_INDEXED_ITEMS
CGAL::Unique_hash_map<SHalfedge_const_handle, int> SE2i;
SHalfedge_const_iterator sei;
CGAL_forall_sedges(sei, G) {
SE2i[sei] = Index_generator::get_unique_index();
SE2i[sei->twin()] = SE2i[sei];
}
CGAL::Unique_hash_map
<SVertex_const_handle, std::pair<int, int> > SV2i;
SVertex_const_iterator svi;
CGAL_forall_svertices(svi, G)
SV2i[svi] = std::pair<int, int>
(Index_generator::get_unique_index(),
Index_generator::get_unique_index());
#endif
CGAL::Unique_hash_map<SFace_const_handle, Vertex_handle> sface2vertex;
SFace_const_iterator sfi;
for(sfi = G.sfaces_begin(); sfi != G.sfaces_end(); ++sfi) {
sface2vertex[sfi] = snc.new_vertex(sfi->mark().point(),true);
sface2vertex[sfi] = snc.new_vertex(sfi->mark().point(),
sfi->mark().boolean());
}
for(sfi = G.sfaces_begin(); sfi != G.sfaces_end(); ++sfi) {
@ -60,23 +75,40 @@ template<typename Kernel_, typename Items_, typename Mark_>
SHalfedge_handle se, se_prev, se_first;
sv_first =
SM.new_svertex(sface2vertex[sfc->twin()->incident_sface()]->point()-v->point());
sv_first->mark() = true;
sv_first->mark() = sfc->mark().boolean();
#ifdef CGAL_NEF_INDEXED_ITEMS
sv_first->set_index(SE2i[sfc]);
#endif
++sfc;
sv_prev = sv =
SM.new_svertex(sface2vertex[sfc->twin()->incident_sface()]->point()-v->point());
sv->mark() = true;
++sfc;
sv->mark() = sfc->mark().boolean();
#ifdef CGAL_NEF_INDEXED_ITEMS
sv->set_index(SE2i[sfc]);
#endif
se_first = se_prev = SM.new_shalfedge_pair(sv_first, sv_prev);
se_first->mark() = se_first->twin()->mark() = true;
se_first->mark() = se_first->twin()->mark() = sfc->source()->mark().boolean();
#ifdef CGAL_NEF_INDEXED_ITEMS
se_first->set_index(SV2i[sfc->source()].first);
se_first->twin()->set_index(SV2i[sfc->source()].second);
#endif
se_first->circle() = Sphere_circle(sv_first->point(), sv->point());
se_first->circle() = normalized(se_first->circle());
se_first->twin()->circle() = se_first->circle().opposite();
++sfc;
CGAL_For_all(sfc,sfcend) {
sv = SM.new_svertex(sface2vertex[sfc->twin()->incident_sface()]->point()-v->point());
sv->mark() = true;
sv->mark() = sfc->mark().boolean();
#ifdef CGAL_NEF_INDEXED_ITEMS
sv->set_index(SE2i[sfc]);
#endif
se = SM.new_shalfedge_pair(sv_prev, sv);
se->mark() = se->twin()->mark() = true;
se->mark() = se->twin()->mark() = sfc->source()->mark().boolean();
#ifdef CGAL_NEF_INDEXED_ITEMS
se->set_index(SV2i[sfc->source()].first);
se->twin()->set_index(SV2i[sfc->source()].second);
#endif
se->circle() = Sphere_circle(sv_prev->point(), sv->point());
se->circle() = normalized(se->circle());
se->twin()->circle() = se->circle().opposite();
@ -87,7 +119,11 @@ template<typename Kernel_, typename Items_, typename Mark_>
}
se = SM.new_shalfedge_pair(sv_prev, sv_first);
se->mark() = se->twin()->mark() = true;
se->mark() = se->twin()->mark() = sfc->source()->mark().boolean();
#ifdef CGAL_NEF_INDEXED_ITEMS
se->set_index(SV2i[sfc->source()].first);
se->twin()->set_index(SV2i[sfc->source()].second);
#endif
se->circle() = Sphere_circle(sv_prev->point(), sv_first->point());
se->circle() = normalized(se->circle());
se->twin()->circle() = se->circle().opposite();
@ -103,14 +139,6 @@ template<typename Kernel_, typename Items_, typename Mark_>
sf0->mark() = false;
sf1->mark() = true;
/*
Sphere_point p1 = se->source()->point();
Sphere_point p2 = se->snext()->source()->point();
Sphere_point p3 = se->snext()->snext()->source()->point();
if(spherical_orientation(p1,p2,p3) > 0)
se = se->twin();
*/
SM.link_as_face_cycle(se,sf0);
SM.link_as_face_cycle(se->twin(),sf1);
}
@ -124,3 +152,4 @@ template<typename Kernel_, typename Items_, typename Mark_>
};
CGAL_END_NAMESPACE
#endif // CGAL_MINKOWSKI_GAUSSIAN_MAP_TO_NEF3_H

View File

@ -25,8 +25,7 @@ class gausian_map_to_polyhedron_3 : public CGAL::Modifier_base<HDS> {
int i = 0;
SFace_const_iterator fi;
for(fi = G.sfaces_begin(); fi != G.sfaces_end(); ++fi) {
// B.add_vertex(fi->mark().point());
B.add_vertex(fi->mark());
B.add_vertex(fi->mark().point());
SFace2int[fi] = i++;
}