mirror of https://github.com/CGAL/cgal
- Items are in separates files, now, in order to allow code reuse in SNC_indexed_items
- SNC_external_structure contains half of the code of the old SNC_constructor
This commit is contained in:
parent
a3923877cf
commit
b7f15c8bac
|
|
@ -1472,6 +1472,16 @@ Nef_3/doc_tex/Nef_3_ref/fig/snc.eps -text svneol=unset#application/postscript
|
|||
Nef_3/doc_tex/Nef_3_ref/fig/snc.gif -text svneol=unset#image/gif
|
||||
Nef_3/doc_tex/Nef_3_ref/fig/snc.pdf -text svneol=unset#application/pdf
|
||||
Nef_3/examples/Nef_3/complex_construction.cin -text
|
||||
Nef_3/include/CGAL/Nef_3/Halfedge.h -text
|
||||
Nef_3/include/CGAL/Nef_3/Halffacet.h -text
|
||||
Nef_3/include/CGAL/Nef_3/ID_support_handler.h -text
|
||||
Nef_3/include/CGAL/Nef_3/SFace.h -text
|
||||
Nef_3/include/CGAL/Nef_3/SHalfedge.h -text
|
||||
Nef_3/include/CGAL/Nef_3/SHalfloop.h -text
|
||||
Nef_3/include/CGAL/Nef_3/SNC_external_structure.h -text
|
||||
Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h -text
|
||||
Nef_3/include/CGAL/Nef_3/Vertex.h -text
|
||||
Nef_3/include/CGAL/Nef_3/Volume.h -text
|
||||
Nef_3/performance/Nef_3/cube.nef3 -text svneol=native#application/octet-stream
|
||||
Nef_3/performance/Nef_3/nef3/grid_15_15_15_12345.nef3 -text svneol=native#application/octet-stream
|
||||
Nef_3/performance/Nef_3/nef3/tetrahedra_15_15_15_12345.nef3 -text svneol=native#application/octet-stream
|
||||
|
|
|
|||
|
|
@ -0,0 +1,164 @@
|
|||
// Copyright (c) 1997-2002 Max-Planck-Institute Saarbruecken (Germany).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
// the terms of the Q Public License version 1.0.
|
||||
// See the file LICENSE.QPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL: svn+ssh://hachenb@scm.gforge.inria.fr/svn/cgal/branches/Filtered_Nef/Nef_3/include/CGAL/Nef_3/Halfedge.h $
|
||||
// $Id: Halfedge.h 35450 2006-12-06 10:43:20Z hachenb $
|
||||
//
|
||||
//
|
||||
// Author(s) : Michael Seel <seel@mpi-sb.mpg.de>
|
||||
// Miguel Granados <granados@mpi-sb.mpg.de>
|
||||
// Susan Hert <hert@mpi-sb.mpg.de>
|
||||
// Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
// Peter Hachenberger <hachenberger@mpi-sb.mpg.de>
|
||||
#ifndef CGAL_NEF_HALFEDGE_H
|
||||
#define CGAL_NEF_HALFEDGE_H
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <CGAL/IO/Verbose_ostream.h>
|
||||
#include <CGAL/Nef_3/SNC_iteration.h>
|
||||
|
||||
#undef CGAL_NEF_DEBUG
|
||||
#define CGAL_NEF_DEBUG 83
|
||||
#include <CGAL/Nef_2/debug.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <typename Refs>
|
||||
class Halfedge_base
|
||||
{ // == Halfedge
|
||||
typedef void* GenPtr;
|
||||
typedef typename Refs::Mark Mark;
|
||||
typedef typename Refs::Vector_3 Vector_3;
|
||||
typedef typename Refs::Sphere_point Sphere_point;
|
||||
typedef typename Refs::Vertex_handle Vertex_handle;
|
||||
typedef typename Refs::Halfedge_handle Halfedge_handle;
|
||||
typedef typename Refs::SVertex_handle SVertex_handle;
|
||||
typedef typename Refs::SHalfedge_handle SHalfedge_handle;
|
||||
typedef typename Refs::SFace_handle SFace_handle;
|
||||
typedef typename Refs::Vertex_const_handle Vertex_const_handle;
|
||||
typedef typename Refs::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef typename Refs::SVertex_const_handle SVertex_const_handle;
|
||||
typedef typename Refs::SHalfedge_const_handle SHalfedge_const_handle;
|
||||
typedef typename Refs::SFace_const_handle SFace_const_handle;
|
||||
|
||||
Vertex_handle center_vertex_;
|
||||
Mark mark_;
|
||||
SVertex_handle twin_;
|
||||
SHalfedge_handle out_sedge_;
|
||||
SFace_handle incident_sface_;
|
||||
GenPtr info_;
|
||||
Sphere_point point_;
|
||||
|
||||
public:
|
||||
|
||||
Halfedge_base() : center_vertex_(), mark_(), twin_(),
|
||||
out_sedge_(), incident_sface_(),
|
||||
info_(), point_() {}
|
||||
|
||||
Halfedge_base(Mark m) : center_vertex_(), mark_(m), twin_(),
|
||||
out_sedge_(), incident_sface_(),
|
||||
info_(), point_() {}
|
||||
|
||||
~Halfedge_base() {
|
||||
CGAL_NEF_TRACEN(" destroying Halfedge item "<<&*this);
|
||||
}
|
||||
|
||||
Halfedge_base(const Halfedge_base<Refs>& e)
|
||||
{ center_vertex_ = e.center_vertex_;
|
||||
point_ = e.point_;
|
||||
mark_ = e.mark_;
|
||||
twin_ = e.twin_;
|
||||
out_sedge_ = e.out_sedge_;
|
||||
incident_sface_ = e.incident_sface_;
|
||||
info_ = 0;
|
||||
}
|
||||
|
||||
Halfedge_base<Refs>& operator=(const Halfedge_base<Refs>& e)
|
||||
{ center_vertex_ = e.center_vertex_;
|
||||
point_ = e.point_;
|
||||
mark_ = e.mark_;
|
||||
twin_ = e.twin_;
|
||||
out_sedge_ = e.out_sedge_;
|
||||
incident_sface_ = e.incident_sface_;
|
||||
info_ = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vertex_handle& center_vertex() { return center_vertex_; }
|
||||
Vertex_const_handle center_vertex() const { return center_vertex_; }
|
||||
|
||||
Vertex_handle& source() { return center_vertex_; }
|
||||
Vertex_const_handle source() const { return center_vertex_; }
|
||||
|
||||
Vertex_handle& target() { return twin()->source(); }
|
||||
Vertex_const_handle target() const { return twin()->source(); }
|
||||
|
||||
Mark& mark() { return mark_; }
|
||||
const Mark& mark() const { return mark_; }
|
||||
|
||||
Vector_3 vector() const { return (point_ - CGAL::ORIGIN); }
|
||||
Sphere_point& point(){ return point_; }
|
||||
const Sphere_point& point() const { return point_; }
|
||||
|
||||
SVertex_handle& twin() { return twin_; }
|
||||
SVertex_const_handle twin() const { return twin_; }
|
||||
|
||||
SHalfedge_handle& out_sedge() { return out_sedge_; }
|
||||
SHalfedge_const_handle out_sedge() const { return out_sedge_; }
|
||||
|
||||
SFace_handle& incident_sface() { return incident_sface_; }
|
||||
SFace_const_handle incident_sface() const { return incident_sface_; }
|
||||
|
||||
bool is_isolated() const { return (out_sedge() == SHalfedge_handle()); }
|
||||
|
||||
GenPtr& info() { return info_; }
|
||||
const GenPtr& info() const { return info_; }
|
||||
|
||||
public:
|
||||
std::string debug() const
|
||||
{ std::stringstream os;
|
||||
set_pretty_mode(os);
|
||||
os<<"sv [ "<<point_<<info_<<" ] ";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
bool is_twin() const { return (&*twin_ < this); }
|
||||
|
||||
bool is_valid( bool verb = false, int level = 0) const {
|
||||
|
||||
Verbose_ostream verr(verb);
|
||||
verr << "begin CGAL::SNC_items<...>::Halfedge_base::is_valid( verb=true, "
|
||||
"level = " << level << "):" << std::endl;
|
||||
|
||||
bool valid = (center_vertex_ != NULL && center_vertex_ != Vertex_handle());
|
||||
valid = valid && (twin_ != NULL && twin_ != SVertex_handle() &&
|
||||
twin_ != SVertex_handle());
|
||||
// valid = valid && (out_sedge_ != NULL);
|
||||
// valid = valid && (incident_sface_ != SFace_handle());
|
||||
|
||||
// valid = valid &&((out_sedge_ != NULL && incident_sface_ == NULL) ||
|
||||
// (out_sedge_ == NULL && incident_sface_ != NULL));
|
||||
|
||||
valid = valid && (out_sedge_ != NULL || incident_sface_ != NULL);
|
||||
|
||||
verr << "end of CGAL::SNC_items<...>::Halfedge_base::is_valid(): structure is "
|
||||
<< ( valid ? "valid." : "NOT VALID.") << std::endl;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
}; // Halfedge_base
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
#endif //CGAL_NEF_HALFEDGE_H
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
// Copyright (c) 1997-2002 Max-Planck-Institute Saarbruecken (Germany).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
// the terms of the Q Public License version 1.0.
|
||||
// See the file LICENSE.QPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL: svn+ssh://hachenb@scm.gforge.inria.fr/svn/cgal/branches/Filtered_Nef/Nef_3/include/CGAL/Nef_3/Halffacet.h $
|
||||
// $Id: Halffacet.h 35450 2006-12-06 10:43:20Z hachenb $
|
||||
//
|
||||
//
|
||||
// Author(s) : Michael Seel <seel@mpi-sb.mpg.de>
|
||||
// Miguel Granados <granados@mpi-sb.mpg.de>
|
||||
// Susan Hert <hert@mpi-sb.mpg.de>
|
||||
// Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
// Peter Hachenberger <hachenberger@mpi-sb.mpg.de>
|
||||
#ifndef CGAL_NEF_HALFFACET_H
|
||||
#define CGAL_NEF_HALFFACET_H
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <CGAL/IO/Verbose_ostream.h>
|
||||
#include <CGAL/Nef_3/SNC_iteration.h>
|
||||
|
||||
#undef CGAL_NEF_DEBUG
|
||||
#define CGAL_NEF_DEBUG 83
|
||||
#include <CGAL/Nef_2/debug.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <typename Refs>
|
||||
class Halffacet_base {
|
||||
|
||||
typedef void* GenPtr;
|
||||
typedef typename Refs::Mark Mark;
|
||||
typedef typename Refs::Plane_3 Plane_3;
|
||||
typedef typename Refs::Halffacet_handle Halffacet_handle;
|
||||
typedef typename Refs::Halffacet_const_handle Halffacet_const_handle;
|
||||
typedef typename Refs::Volume_handle Volume_handle;
|
||||
typedef typename Refs::Volume_const_handle Volume_const_handle;
|
||||
typedef typename Refs::Object_list Object_list;
|
||||
typedef typename Refs::Halffacet_cycle_iterator
|
||||
Halffacet_cycle_iterator;
|
||||
typedef typename Refs::Halffacet_cycle_const_iterator
|
||||
Halffacet_cycle_const_iterator;
|
||||
|
||||
Plane_3 supporting_plane_;
|
||||
Mark mark_;
|
||||
Halffacet_handle twin_;
|
||||
Volume_handle volume_;
|
||||
Object_list boundary_entry_objects_; // SEdges, SLoops
|
||||
|
||||
public:
|
||||
|
||||
Halffacet_base() : supporting_plane_(), mark_() {}
|
||||
|
||||
Halffacet_base(const Plane_3& h, Mark m) :
|
||||
supporting_plane_(h), mark_(m) {}
|
||||
|
||||
~Halffacet_base() {
|
||||
CGAL_NEF_TRACEN(" destroying Halffacet_base item "<<&*this);
|
||||
}
|
||||
|
||||
Halffacet_base(const Halffacet_base<Refs>& f)
|
||||
{ supporting_plane_ = f.supporting_plane_;
|
||||
mark_ = f.mark_;
|
||||
twin_ = f.twin_;
|
||||
CGAL_NEF_TRACEN("VOLUME const");
|
||||
volume_ = f.volume_;
|
||||
boundary_entry_objects_ = f.boundary_entry_objects_;
|
||||
}
|
||||
|
||||
Halffacet_base<Refs>& operator=(const Halffacet_base<Refs>& f)
|
||||
{ if (this == &f) return *this;
|
||||
supporting_plane_ = f.supporting_plane_;
|
||||
mark_ = f.mark_;
|
||||
twin_ = f.twin_;
|
||||
CGAL_NEF_TRACEN("VOLUME op=");
|
||||
volume_ = f.volume_;
|
||||
boundary_entry_objects_ = f.boundary_entry_objects_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Mark& mark() { return mark_; }
|
||||
const Mark& mark() const { return mark_; }
|
||||
|
||||
Halffacet_handle& twin() { return twin_; }
|
||||
Halffacet_const_handle twin() const { return twin_; }
|
||||
|
||||
Plane_3& plane() { return supporting_plane_; }
|
||||
const Plane_3& plane() const { return supporting_plane_; }
|
||||
|
||||
Volume_handle& incident_volume() { return volume_; }
|
||||
Volume_const_handle incident_volume() const { return volume_; }
|
||||
|
||||
Object_list& boundary_entry_objects() { return boundary_entry_objects_; }
|
||||
const Object_list& boundary_entry_objects() const { return boundary_entry_objects_; }
|
||||
|
||||
GenPtr& info() { return this->info_; }
|
||||
const GenPtr& info() const { return this->info_; }
|
||||
|
||||
Halffacet_cycle_iterator facet_cycles_begin()
|
||||
{ return boundary_entry_objects_.begin(); }
|
||||
Halffacet_cycle_iterator facet_cycles_end()
|
||||
{ return boundary_entry_objects_.end(); }
|
||||
Halffacet_cycle_const_iterator facet_cycles_begin() const
|
||||
{ return boundary_entry_objects_.begin(); }
|
||||
Halffacet_cycle_const_iterator facet_cycles_end() const
|
||||
{ return boundary_entry_objects_.end(); }
|
||||
|
||||
bool is_twin() const { return (&*twin_ < this); }
|
||||
|
||||
bool is_valid( bool verb = false, int level = 0) const {
|
||||
|
||||
Verbose_ostream verr(verb);
|
||||
verr << "begin CGAL::SNC_items<...>::Halffacet_base::is_valid( verb=true, "
|
||||
"level = " << level << "):" << std::endl;
|
||||
|
||||
bool valid = (twin_ != NULL && twin_ != Halffacet_handle());
|
||||
valid = valid && (volume_ != NULL && volume_ != Volume_handle());
|
||||
|
||||
valid = valid && (supporting_plane_.a() != 0 ||
|
||||
supporting_plane_.b() != 0 ||
|
||||
supporting_plane_.c() != 0);
|
||||
|
||||
valid = valid && (!boundary_entry_objects_.empty());
|
||||
|
||||
verr << "end of CGAL::SNC_items<...>::Halffacet_base::is_valid(): structure is "
|
||||
<< ( valid ? "valid." : "NOT VALID.") << std::endl;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
}; // Halffacet_base
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
#endif //CGAL_NEF_HALFFACET_H
|
||||
|
|
@ -0,0 +1,353 @@
|
|||
#ifndef CGAL_ID_SUPPORT_HANDLER
|
||||
#define CGAL_ID_SUPPORT_HANDLER
|
||||
|
||||
#include <CGAL/Nef_3/SNC_indexed_items.h>
|
||||
#include <CGAL/Unique_hash_map.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template<typename Items, typename Decorator>
|
||||
class ID_support_handler {
|
||||
|
||||
typedef typename Decorator::SVertex_handle SVertex_handle;
|
||||
typedef typename Decorator::SHalfedge_handle SHalfedge_handle;
|
||||
|
||||
typedef typename Decorator::SVertex_const_handle SVertex_const_handle;
|
||||
typedef typename Decorator::SHalfedge_const_handle SHalfedge_const_handle;
|
||||
typedef typename Decorator::SHalfloop_const_handle SHalfloop_const_handle;
|
||||
|
||||
public:
|
||||
ID_support_handler() {}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SHalfedge_const_handle se1,
|
||||
SHalfedge_const_handle se2) {}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SHalfloop_const_handle sl1,
|
||||
SHalfloop_const_handle sl2) {}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SHalfloop_const_handle sl1,
|
||||
SHalfedge_const_handle se2) {}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SHalfedge_const_handle se1,
|
||||
SHalfloop_const_handle sl2) {}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SHalfedge_const_handle se1,
|
||||
SVertex_const_handle sv2) {}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SVertex_const_handle sv1,
|
||||
SHalfedge_const_handle se2) {}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SVertex_const_handle sv1,
|
||||
SVertex_const_handle sv2) {}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SVertex_const_handle sv0) {}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SVertex_const_handle sv1,
|
||||
SHalfloop_const_handle sl2) {}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SHalfloop_const_handle sl1,
|
||||
SVertex_const_handle sv2) {}
|
||||
|
||||
void handle_support(SHalfedge_handle se,
|
||||
SHalfedge_const_handle se1,
|
||||
SHalfedge_const_handle se2) {}
|
||||
|
||||
void handle_support(SHalfedge_handle se,
|
||||
SHalfedge_const_handle se1) {}
|
||||
|
||||
void handle_support(SHalfedge_handle se,
|
||||
SHalfloop_const_handle sl1) {}
|
||||
|
||||
void handle_support(SHalfedge_handle se,
|
||||
SHalfedge_const_handle se1,
|
||||
SHalfloop_const_handle sl2) {}
|
||||
|
||||
void handle_support(SHalfedge_handle se,
|
||||
SHalfloop_const_handle sl1,
|
||||
SHalfedge_const_handle se2) {}
|
||||
|
||||
void handle_support(SHalfedge_handle se,
|
||||
SHalfloop_const_handle sl1,
|
||||
SHalfloop_const_handle sl2) {}
|
||||
};
|
||||
|
||||
template<typename Decorator>
|
||||
class ID_support_handler<SNC_indexed_items, Decorator> {
|
||||
|
||||
typedef typename Decorator::SVertex_handle SVertex_handle;
|
||||
typedef typename Decorator::SHalfedge_handle SHalfedge_handle;
|
||||
|
||||
typedef typename Decorator::SVertex_const_handle SVertex_const_handle;
|
||||
typedef typename Decorator::SHalfedge_const_handle SHalfedge_const_handle;
|
||||
typedef typename Decorator::SHalfloop_const_handle SHalfloop_const_handle;
|
||||
typedef typename Decorator::Halffacet_const_handle Halffacet_const_handle;
|
||||
|
||||
typedef CGAL::Unique_hash_map<Halffacet_const_handle, int> F2E;
|
||||
CGAL::Unique_hash_map<Halffacet_const_handle, F2E> f2m;
|
||||
|
||||
public:
|
||||
ID_support_handler() {}
|
||||
|
||||
void hash_facet_pair(SVertex_handle sv,
|
||||
Halffacet_const_handle f1,
|
||||
Halffacet_const_handle f2) {
|
||||
// std::cerr << "hash_facet_pair " << sv->point() << std::endl
|
||||
// << " " << f1->plane() << &f1 << std::endl
|
||||
// << " " << f2->plane() << &f2 << std::endl;
|
||||
|
||||
if(f2m[f1][f2]==0) {
|
||||
sv->set_index();
|
||||
f2m[f1][f2] = sv->get_index();
|
||||
// std::cerr << "insert " << sv->point() << &*sv
|
||||
// << ": " << f2m[f1][f2] << std::endl;
|
||||
// std::cerr << "not defined, yet" << std::endl;
|
||||
}
|
||||
else {
|
||||
// std::cerr << "access " << sv->point() << &*sv << std::endl;
|
||||
sv->set_index(f2m[f1][f2]);
|
||||
// std::cerr << "combine " << sv->point() << "+" << f2e[f2]->point() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SHalfedge_const_handle se1,
|
||||
SHalfedge_const_handle se2) {
|
||||
// std::cerr << "handle support ee " << sv->point() << std::endl;
|
||||
Halffacet_const_handle f1 = se1->facet();
|
||||
if(f1->is_twin()) f1 = f1->twin();
|
||||
Halffacet_const_handle f2 = se2->facet();
|
||||
if(f2->is_twin()) f2 = f2->twin();
|
||||
hash_facet_pair(sv, f1,f2);
|
||||
}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SHalfloop_const_handle sl1,
|
||||
SHalfloop_const_handle sl2) {
|
||||
Halffacet_const_handle f1 = sl1->facet();
|
||||
if(f1->is_twin()) f1 = f1->twin();
|
||||
Halffacet_const_handle f2 = sl2->facet();
|
||||
if(f2->is_twin()) f2 = f2->twin();
|
||||
hash_facet_pair(sv, f1,f2);
|
||||
}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SHalfloop_const_handle sl1,
|
||||
SHalfedge_const_handle se2,
|
||||
bool inverse_order = false) {
|
||||
// std::cerr << "handle support el " << sv->point() << std::endl;
|
||||
Halffacet_const_handle f1 = sl1->facet();
|
||||
if(f1->is_twin()) f1 = f1->twin();
|
||||
Halffacet_const_handle f2 = se2->facet();
|
||||
if(f2->is_twin()) f2 = f2->twin();
|
||||
if(inverse_order)
|
||||
hash_facet_pair(sv, f2,f1);
|
||||
else
|
||||
hash_facet_pair(sv, f1,f2);
|
||||
}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SHalfedge_const_handle se1,
|
||||
SHalfloop_const_handle sl2) {
|
||||
handle_support(sv,sl2,se1,true);
|
||||
}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SHalfedge_const_handle se1,
|
||||
SVertex_const_handle sv2) {
|
||||
// std::cerr << "handle support ev " << sv->point() << std::endl;
|
||||
sv->set_index(sv2->get_index());
|
||||
}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SVertex_const_handle sv1,
|
||||
SHalfedge_const_handle se2) {
|
||||
// std::cerr << "handle support ve " << sv->point() << std::endl;
|
||||
handle_support(sv,se2,sv1);
|
||||
}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SVertex_const_handle sv1,
|
||||
SVertex_const_handle sv2) {
|
||||
// std::cerr << "handle support vv " << sv->point() << std::endl;
|
||||
// std::cerr << " supported by " << sv1->point() << std::endl;
|
||||
// std::cerr << " supported by " << sv2->point() << std::endl;
|
||||
if(sv1->get_index() < sv2->get_index())
|
||||
sv->set_index(sv1->get_index());
|
||||
else
|
||||
sv->set_index(sv2->get_index());
|
||||
}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SVertex_const_handle sv0) {
|
||||
// std::cerr << "handle support v " << sv->point() << std::endl;
|
||||
sv->set_index(sv0->get_index());
|
||||
}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SVertex_const_handle sv1,
|
||||
SHalfloop_const_handle sl2) {
|
||||
// std::cerr << "handle support vl " << sv->point() << std::endl;
|
||||
sv->set_index(sv1->get_index());
|
||||
}
|
||||
|
||||
void handle_support(SVertex_handle sv,
|
||||
SHalfloop_const_handle sl1,
|
||||
SVertex_const_handle sv2) {
|
||||
// std::cerr << "handle support lv " << sv->point() << std::endl;
|
||||
handle_support(sv, sv2, sl1);
|
||||
}
|
||||
|
||||
void handle_support(SHalfedge_handle se,
|
||||
SHalfedge_const_handle se1) {
|
||||
CGAL_assertion(se->circle() == se1->circle());
|
||||
se->set_index(se1->get_index());
|
||||
se->twin()->set_index(se1->twin()->get_index());
|
||||
// std::cerr << "se " << se->source()->point()
|
||||
// << "->" << se->twin()->source()->point()
|
||||
// << "|" << se->circle() << std::endl;
|
||||
// std::cerr << "se1 " << se1->get_index() << std::endl;
|
||||
// std::cerr << "se1->twin() " << se1->twin()->get_index() << std::endl;
|
||||
// std::cerr << "result " << se->get_index()
|
||||
// << ", " << se->twin()->get_index() << std::endl;
|
||||
}
|
||||
|
||||
void handle_support(SHalfedge_handle se,
|
||||
SHalfloop_const_handle sl1) {
|
||||
CGAL_assertion(se->circle() == sl1->circle());
|
||||
se->set_index(sl1->get_index());
|
||||
se->twin()->set_index(sl1->twin()->get_index());
|
||||
// std::cerr << "se " << se->source()->point()
|
||||
// << "->" << se->twin()->source()->point()
|
||||
// << "|" << se->circle() << std::endl;
|
||||
// std::cerr << "sl1 " << sl1->get_index() << std::endl;
|
||||
// std::cerr << "sl1->twin() " << sl1->twin()->get_index() << std::endl;
|
||||
// std::cerr << "result " << se->get_index()
|
||||
// << ", " << se->twin()->get_index() << std::endl;
|
||||
}
|
||||
|
||||
int set_se_index(int index1, int index2,
|
||||
bool v1, bool v2) {
|
||||
if(v1)
|
||||
if(v2)
|
||||
return index1<index2 ? index1 : index2;
|
||||
else
|
||||
return index1;
|
||||
if(v2)
|
||||
return index2;
|
||||
return index1<index2 ? index1 : index2;
|
||||
}
|
||||
|
||||
void handle_support(SHalfedge_handle se,
|
||||
SHalfedge_const_handle se1,
|
||||
SHalfedge_const_handle se2) {
|
||||
CGAL_assertion(se->circle() == se1->circle());
|
||||
CGAL_assertion(se->circle() == se2->circle());
|
||||
// std::cerr << "se " << se->source()->point()
|
||||
// << "->" << se->twin()->source()->point()
|
||||
// << "|" << se->circle() << std::endl;
|
||||
// std::cerr << vs1 << vs2 << vt1 << vt2 << std::endl;
|
||||
// std::cerr << "se1 " << se1->get_index() << std::endl;
|
||||
// std::cerr << "se2 " << se2->get_index() << std::endl;
|
||||
// std::cerr << "se1->twin() " << se1->twin()->get_index() << std::endl;
|
||||
// std::cerr << "se2->twin() " << se2->twin()->get_index() << std::endl;
|
||||
/*
|
||||
se->set_index(set_se_index(se1->get_index(),
|
||||
se2->get_index(),
|
||||
vs1, vs2));
|
||||
se->twin()->set_index(set_se_index(se1->twin()->get_index(),
|
||||
se2->twin()->get_index(),
|
||||
vt1, vt2));
|
||||
*/
|
||||
if(se1->get_index()<se2->get_index()) {
|
||||
// if(se1->get_index() < hash[se2->get_index()])
|
||||
// hash[se2->get_index()] = se1->get_index();
|
||||
se->set_index(se1->get_index());
|
||||
} else {
|
||||
// if(se2->get_index() < hash[se1->get_index()])
|
||||
// hash[se1->get_index()] = se2->get_index();
|
||||
se->set_index(se2->get_index());
|
||||
}
|
||||
if(se1->twin()->get_index()<se2->twin()->get_index()) {
|
||||
// if(se1->twin()->get_index() < hash[se2->twin()->get_index()])
|
||||
// hash[se2->twin()->get_index()] = se1->twin()->get_index();
|
||||
se->twin()->set_index(se1->twin()->get_index());
|
||||
} else {
|
||||
// if(se2->twin()->get_index() < hash[se1->twin()->get_index()])
|
||||
// hash[se1->twin()->get_index()] = se2->twin()->get_index();
|
||||
se->twin()->set_index(se2->twin()->get_index());
|
||||
}
|
||||
// std::cerr << "result " << se->get_index()
|
||||
// << ", " << se->twin()->get_index() << std::endl;
|
||||
}
|
||||
|
||||
void handle_support(SHalfedge_handle se,
|
||||
SHalfedge_const_handle se1,
|
||||
SHalfloop_const_handle sl2) {
|
||||
CGAL_assertion(se->circle() == se1->circle());
|
||||
CGAL_assertion(se->circle() == sl2->circle());
|
||||
if(se1->get_index()<sl2->get_index()) {
|
||||
// if(se1->get_index() < hash[sl2->get_index()])
|
||||
// hash[sl2->get_index()] = se1->get_index();
|
||||
se->set_index(se1->get_index());
|
||||
} else {
|
||||
// if(sl2->get_index() < hash[se1->get_index()])
|
||||
// hash[se1->get_index()] = sl2->get_index();
|
||||
se->set_index(sl2->get_index());
|
||||
}
|
||||
if(se1->twin()->get_index()<sl2->twin()->get_index()) {
|
||||
// if(se1->twin()->get_index() < hash[sl2->twin()->get_index()])
|
||||
// hash[sl2->twin()->get_index()] = se1->twin()->get_index();
|
||||
se->twin()->set_index(se1->twin()->get_index());
|
||||
} else {
|
||||
// if(sl2->twin()->get_index() < hash[se1->twin()->get_index()])
|
||||
// hash[se1->twin()->get_index()] = sl2->twin()->get_index();
|
||||
se->twin()->set_index(sl2->twin()->get_index());
|
||||
}
|
||||
}
|
||||
|
||||
void handle_support(SHalfedge_handle se,
|
||||
SHalfloop_const_handle sl1,
|
||||
SHalfedge_const_handle se2) {
|
||||
handle_support(se,se2,sl1);
|
||||
}
|
||||
|
||||
void handle_support(SHalfedge_handle se,
|
||||
SHalfloop_const_handle sl1,
|
||||
SHalfloop_const_handle sl2) {
|
||||
CGAL_assertion(se->circle() == sl1->circle());
|
||||
CGAL_assertion(se->circle() == sl2->circle());
|
||||
if(sl1->get_index()<sl2->get_index()) {
|
||||
// if(sl1->get_index() < hash[sl2->get_index()])
|
||||
// hash[sl2->get_index()] = sl1->get_index();
|
||||
se->set_index(sl1->get_index());
|
||||
} else {
|
||||
// if(sl2->get_index() < hash[sl1->get_index()])
|
||||
// hash[sl1->get_index()] = sl2->get_index();
|
||||
se->set_index(sl2->get_index());
|
||||
}
|
||||
if(sl1->twin()->get_index()< sl2->twin()->get_index()) {
|
||||
// if(sl1->twin()->get_index() < hash[sl2->twin()->get_index()])
|
||||
// hash[sl2->twin()->get_index()] = sl1->twin()->get_index();
|
||||
se->twin()->set_index(sl1->twin()->get_index());
|
||||
} else {
|
||||
// if(sl2->twin()->get_index() < hash[sl1->twin()->get_index()])
|
||||
// hash[sl1->twin()->get_index()] = sl2->twin()->get_index();
|
||||
se->twin()->set_index(sl2->twin()->get_index());
|
||||
}
|
||||
}
|
||||
|
||||
// int& hash_index(const int i) { return hash[i]; }
|
||||
};
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
#endif // CGAL_ID_SUPPORT_HANDLER
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
// Copyright (c) 1997-2002 Max-Planck-Institute Saarbruecken (Germany).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
// the terms of the Q Public License version 1.0.
|
||||
// See the file LICENSE.QPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL: svn+ssh://hachenb@scm.gforge.inria.fr/svn/cgal/branches/Filtered_Nef/Nef_3/include/CGAL/Nef_3/SFace.h $
|
||||
// $Id: SFace.h 35450 2006-12-06 10:43:20Z hachenb $
|
||||
//
|
||||
//
|
||||
// Author(s) : Michael Seel <seel@mpi-sb.mpg.de>
|
||||
// Miguel Granados <granados@mpi-sb.mpg.de>
|
||||
// Susan Hert <hert@mpi-sb.mpg.de>
|
||||
// Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
// Peter Hachenberger <hachenberger@mpi-sb.mpg.de>
|
||||
#ifndef CGAL_NEF_SFACE_H
|
||||
#define CGAL_NEF_SFACE_H
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <CGAL/IO/Verbose_ostream.h>
|
||||
#include <CGAL/Nef_3/SNC_iteration.h>
|
||||
|
||||
#undef CGAL_NEF_DEBUG
|
||||
#define CGAL_NEF_DEBUG 83
|
||||
#include <CGAL/Nef_2/debug.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <typename Refs>
|
||||
class SFace_base {
|
||||
typedef void* GenPtr;
|
||||
typedef typename Refs::Mark Mark;
|
||||
typedef typename Refs::Vertex_handle Vertex_handle;
|
||||
typedef typename Refs::Vertex_const_handle Vertex_const_handle;
|
||||
typedef typename Refs::SFace_handle SFace_handle;
|
||||
typedef typename Refs::SFace_const_handle SFace_const_handle;
|
||||
typedef typename Refs::Volume_handle Volume_handle;
|
||||
typedef typename Refs::Volume_const_handle Volume_const_handle;
|
||||
typedef typename Refs::Object_list Object_list;
|
||||
typedef typename Refs::SFace_cycle_iterator SFace_cycle_iterator;
|
||||
typedef typename Refs::SFace_cycle_const_iterator
|
||||
SFace_cycle_const_iterator;
|
||||
Vertex_handle center_vertex_;
|
||||
Volume_handle volume_;
|
||||
// Object_list boundary_entry_objects_; // SEdges, SLoops, SVertices
|
||||
GenPtr info_;
|
||||
// temporary needed:
|
||||
Mark mark_;
|
||||
|
||||
public:
|
||||
Object_list boundary_entry_objects_; // SEdges, SLoops, SVertices
|
||||
|
||||
SFace_base() : center_vertex_(), volume_(), info_(), mark_() {}
|
||||
|
||||
~SFace_base() {
|
||||
CGAL_NEF_TRACEN(" destroying SFace_base item "<<&*this);
|
||||
}
|
||||
|
||||
SFace_base(const SFace_base<Refs>& f)
|
||||
{ center_vertex_ = f.center_vertex_;
|
||||
volume_ = f.volume_;
|
||||
boundary_entry_objects_ = f.boundary_entry_objects_;
|
||||
info_ = 0;
|
||||
mark_ = f.mark_;
|
||||
}
|
||||
|
||||
SFace_base<Refs>& operator=(const SFace_base<Refs>& f)
|
||||
{ if (this == &f) return *this;
|
||||
center_vertex_ = f.center_vertex_;
|
||||
volume_ = f.volume_;
|
||||
boundary_entry_objects_ = f.boundary_entry_objects_;
|
||||
info_ = 0;
|
||||
mark_ = f.mark_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SFace_cycle_iterator sface_cycles_begin()
|
||||
{ return boundary_entry_objects_.begin(); }
|
||||
SFace_cycle_iterator sface_cycles_end()
|
||||
{ return boundary_entry_objects_.end(); }
|
||||
SFace_cycle_const_iterator sface_cycles_begin() const
|
||||
{ return boundary_entry_objects_.begin(); }
|
||||
SFace_cycle_const_iterator sface_cycles_end() const
|
||||
{ return boundary_entry_objects_.end(); }
|
||||
|
||||
Mark& mark() { return mark_; }
|
||||
const Mark& mark() const { return mark_; }
|
||||
|
||||
Vertex_handle& center_vertex() { return center_vertex_; }
|
||||
Vertex_const_handle center_vertex() const { return center_vertex_; }
|
||||
|
||||
Volume_handle& volume() { return volume_; }
|
||||
Volume_const_handle volume() const { return volume_; }
|
||||
|
||||
Object_list& boundary_entry_objects() { return boundary_entry_objects_; }
|
||||
const Object_list& boundary_entry_objects() const { return boundary_entry_objects_; }
|
||||
|
||||
GenPtr& info() { return info_; }
|
||||
const GenPtr& info() const { return info_; }
|
||||
|
||||
bool is_valid( bool verb = false, int level = 0) const {
|
||||
|
||||
Verbose_ostream verr(verb);
|
||||
verr << "begin CGAL::SNC_items<...>::SFace_base::is_valid( verb=true, "
|
||||
"level = " << level << "):" << std::endl;
|
||||
|
||||
bool valid =(center_vertex_ != Vertex_handle() && center_vertex_ != NULL);
|
||||
valid = valid && (volume_ != Volume_handle() &&
|
||||
volume_ != NULL);
|
||||
|
||||
if(boundary_entry_objects_.empty()) {
|
||||
valid = valid &&
|
||||
(center_vertex_->shalfedges_begin() == center_vertex_->shalfedges_end());
|
||||
}
|
||||
verr << "end of CGAL::SNC_items<...>::SFace_base::is_valid(): structure is "
|
||||
<< ( valid ? "valid." : "NOT VALID.") << std::endl;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
}; // SFace_base
|
||||
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
#endif //CGAL_NEF_SFACE_H
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
// Copyright (c) 1997-2002 Max-Planck-Institute Saarbruecken (Germany).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
// the terms of the Q Public License version 1.0.
|
||||
// See the file LICENSE.QPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL: svn+ssh://hachenb@scm.gforge.inria.fr/svn/cgal/branches/Filtered_Nef/Nef_3/include/CGAL/Nef_3/SHalfedge.h $
|
||||
// $Id: SHalfedge.h 35450 2006-12-06 10:43:20Z hachenb $
|
||||
//
|
||||
//
|
||||
// Author(s) : Michael Seel <seel@mpi-sb.mpg.de>
|
||||
// Miguel Granados <granados@mpi-sb.mpg.de>
|
||||
// Susan Hert <hert@mpi-sb.mpg.de>
|
||||
// Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
// Peter Hachenberger <hachenberger@mpi-sb.mpg.de>
|
||||
#ifndef CGAL_NEF_SHALFEDGE_H
|
||||
#define CGAL_NEF_SHALFEDGE_H
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <CGAL/IO/Verbose_ostream.h>
|
||||
#include <CGAL/Nef_3/SNC_iteration.h>
|
||||
|
||||
#undef CGAL_NEF_DEBUG
|
||||
#define CGAL_NEF_DEBUG 83
|
||||
#include <CGAL/Nef_2/debug.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <typename Refs>
|
||||
class SHalfedge_base {
|
||||
typedef void* GenPtr;
|
||||
typedef typename Refs::Mark Mark;
|
||||
typedef typename Refs::Sphere_circle Sphere_circle;
|
||||
|
||||
typedef typename Refs::Halfedge_handle Halfedge_handle;
|
||||
typedef typename Refs::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef typename Refs::SVertex_handle SVertex_handle;
|
||||
typedef typename Refs::SVertex_const_handle SVertex_const_handle;
|
||||
typedef typename Refs::SHalfedge_handle SHalfedge_handle;
|
||||
typedef typename Refs::SHalfedge_const_handle SHalfedge_const_handle;
|
||||
typedef typename Refs::SFace_handle SFace_handle;
|
||||
typedef typename Refs::SFace_const_handle SFace_const_handle;
|
||||
typedef typename Refs::Halffacet_handle Halffacet_handle;
|
||||
typedef typename Refs::Halffacet_const_handle Halffacet_const_handle;
|
||||
|
||||
// Role within local graph:
|
||||
SVertex_handle source_;
|
||||
SHalfedge_handle sprev_, snext_;
|
||||
SFace_handle incident_sface_;
|
||||
SHalfedge_handle twin_;
|
||||
// Topology within global Nef structure:
|
||||
SHalfedge_handle prev_, next_;
|
||||
Halffacet_handle facet_;
|
||||
GenPtr info_;
|
||||
// temporary needed:
|
||||
Mark mark_;
|
||||
Sphere_circle circle_;
|
||||
|
||||
public:
|
||||
|
||||
SHalfedge_base() : source_(), sprev_(), snext_(),
|
||||
incident_sface_(), twin_(),
|
||||
prev_(), next_(), facet_(),
|
||||
info_(), mark_(), circle_() {}
|
||||
|
||||
~SHalfedge_base() {
|
||||
CGAL_NEF_TRACEN(" destroying SHalfedge_base item "<<&*this);
|
||||
}
|
||||
|
||||
SHalfedge_base(const SHalfedge_base<Refs>& e)
|
||||
{
|
||||
source_ = e.source_;
|
||||
sprev_ = e.sprev_;
|
||||
snext_ = e.snext_;
|
||||
incident_sface_ = e.incident_sface_;
|
||||
twin_ = e.twin_;
|
||||
prev_ = e.prev_;
|
||||
next_ = e.next_;
|
||||
facet_ = e.facet_;
|
||||
info_ = 0;
|
||||
mark_ = e.mark_;
|
||||
circle_ = e.circle_;
|
||||
}
|
||||
|
||||
SHalfedge_base<Refs>& operator=(const SHalfedge_base<Refs>& e)
|
||||
{
|
||||
source_ = e.source_;
|
||||
sprev_ = e.sprev_;
|
||||
snext_ = e.snext_;
|
||||
incident_sface_ = e.incident_sface_;
|
||||
twin_ = e.twin_;
|
||||
prev_ = e.prev_;
|
||||
next_ = e.next_;
|
||||
facet_ = e.facet_;
|
||||
info_ = 0;
|
||||
mark_ = e.mark_;
|
||||
circle_ = e.circle_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Mark& mark() { return mark_; }
|
||||
const Mark& mark() const { return mark_; }
|
||||
|
||||
SHalfedge_handle& twin() { return twin_; }
|
||||
SHalfedge_const_handle twin() const { return twin_; }
|
||||
|
||||
SVertex_handle& source() { return source_; }
|
||||
SVertex_const_handle source() const { return source_; }
|
||||
|
||||
SVertex_handle& target() { return twin()->source(); }
|
||||
SVertex_const_handle target() const { return twin()->source(); }
|
||||
|
||||
SHalfedge_handle& prev() { return prev_; }
|
||||
SHalfedge_const_handle prev() const { return prev_; }
|
||||
|
||||
SHalfedge_handle& next() { return next_; }
|
||||
SHalfedge_const_handle next() const { return next_; }
|
||||
|
||||
SHalfedge_handle& sprev() { return sprev_; }
|
||||
SHalfedge_const_handle sprev() const { return sprev_; }
|
||||
|
||||
SHalfedge_handle& snext() { return snext_; }
|
||||
SHalfedge_const_handle snext() const { return snext_; }
|
||||
|
||||
SHalfedge_handle& cyclic_adj_succ()
|
||||
{ return sprev()->twin(); }
|
||||
SHalfedge_const_handle cyclic_adj_succ() const
|
||||
{ return sprev()->twin(); }
|
||||
|
||||
SHalfedge_handle& cyclic_adj_pred(SHalfedge_const_handle e)
|
||||
{ return e->twin()->snext(); }
|
||||
SHalfedge_const_handle cyclic_adj_pred(SHalfedge_const_handle e) const
|
||||
{ return e->twin()->snext(); }
|
||||
|
||||
Sphere_circle& circle() { return circle_; }
|
||||
const Sphere_circle& circle() const { return circle_; }
|
||||
|
||||
SFace_handle& incident_sface() { return incident_sface_; }
|
||||
SFace_const_handle incident_sface() const { return incident_sface_; }
|
||||
|
||||
Halffacet_handle& facet() { return facet_; }
|
||||
Halffacet_const_handle facet() const { return facet_; }
|
||||
|
||||
GenPtr& info() { return info_; }
|
||||
const GenPtr& info() const { return info_; }
|
||||
|
||||
public:
|
||||
std::string debug() const
|
||||
{ std::stringstream os;
|
||||
set_pretty_mode(os);
|
||||
os <<"e[ "<<source_->debug()<<", "
|
||||
<<twin_->source_->debug()<<" "<<info_<<" ] ";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
bool is_twin() const { return (&*twin_ < this); }
|
||||
|
||||
bool is_valid( bool verb = false, int level = 0) const {
|
||||
|
||||
Verbose_ostream verr(verb);
|
||||
verr << "begin CGAL::SNC_items<...>::SHalfedge_base::is_valid( verb=true, "
|
||||
"level = " << level << "):" << std::endl;
|
||||
|
||||
bool valid = (source_ != SVertex_handle() &&
|
||||
source_ != NULL &&
|
||||
source_ != Halfedge_handle());
|
||||
valid = valid && (twin_ != SHalfedge_handle() && twin_ != NULL);
|
||||
valid = valid && (sprev_ != SHalfedge_handle() && sprev_ != NULL);
|
||||
valid = valid && (snext_ != SHalfedge_handle() && snext_ != NULL);
|
||||
valid = valid && (prev_ != SHalfedge_handle() && prev_ != NULL);
|
||||
valid = valid && (next_ != SHalfedge_handle() && next_ != NULL);
|
||||
|
||||
valid = valid && (incident_sface_ != SFace_handle() &&
|
||||
incident_sface_ != NULL);
|
||||
valid = valid && (facet_ != Halffacet_handle() &&
|
||||
facet_ != NULL);
|
||||
valid = valid && (circle_.d() == 0);
|
||||
valid = valid && (circle_.a() != 0 || circle_.b() != 0 || circle_.c() !=0);
|
||||
|
||||
verr << "end of CGAL::SNC_items<...>::SHalfedge_base::is_valid(): structure is "
|
||||
<< ( valid ? "valid." : "NOT VALID.") << std::endl;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
}; // SHalfedge_base
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
#endif //CGAL_NEF_SHALFEDGE_H
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
// Copyright (c) 1997-2002 Max-Planck-Institute Saarbruecken (Germany).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
// the terms of the Q Public License version 1.0.
|
||||
// See the file LICENSE.QPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL: svn+ssh://hachenb@scm.gforge.inria.fr/svn/cgal/branches/Filtered_Nef/Nef_3/include/CGAL/Nef_3/SHalfloop.h $
|
||||
// $Id: SHalfloop.h 35450 2006-12-06 10:43:20Z hachenb $
|
||||
//
|
||||
//
|
||||
// Author(s) : Michael Seel <seel@mpi-sb.mpg.de>
|
||||
// Miguel Granados <granados@mpi-sb.mpg.de>
|
||||
// Susan Hert <hert@mpi-sb.mpg.de>
|
||||
// Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
// Peter Hachenberger <hachenberger@mpi-sb.mpg.de>
|
||||
#ifndef CGAL_NEF_SHALFLOOP_H
|
||||
#define CGAL_NEF_SHALFLOOP_H
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <CGAL/IO/Verbose_ostream.h>
|
||||
#include <CGAL/Nef_3/SNC_iteration.h>
|
||||
|
||||
#undef CGAL_NEF_DEBUG
|
||||
#define CGAL_NEF_DEBUG 83
|
||||
#include <CGAL/Nef_2/debug.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <typename Refs>
|
||||
class SHalfloop_base {
|
||||
typedef void* GenPtr;
|
||||
typedef typename Refs::Mark Mark;
|
||||
typedef typename Refs::Sphere_circle Sphere_circle;
|
||||
typedef typename Refs::SHalfloop_handle SHalfloop_handle;
|
||||
typedef typename Refs::SHalfloop_const_handle SHalfloop_const_handle;
|
||||
typedef typename Refs::SFace_handle SFace_handle;
|
||||
typedef typename Refs::SFace_const_handle SFace_const_handle;
|
||||
typedef typename Refs::Halffacet_handle Halffacet_handle;
|
||||
typedef typename Refs::Halffacet_const_handle Halffacet_const_handle;
|
||||
|
||||
SHalfloop_handle twin_;
|
||||
SFace_handle incident_sface_;
|
||||
Halffacet_handle facet_;
|
||||
GenPtr info_;
|
||||
// temporary needed:
|
||||
Mark mark_;
|
||||
Sphere_circle circle_;
|
||||
|
||||
public:
|
||||
|
||||
SHalfloop_base() : twin_(), incident_sface_(), facet_(),
|
||||
info_(), mark_(), circle_() {}
|
||||
|
||||
~SHalfloop_base() {
|
||||
CGAL_NEF_TRACEN(" destroying SHalfloop_base item "<<&*this);
|
||||
}
|
||||
SHalfloop_base(const SHalfloop_base<Refs>& l)
|
||||
{ twin_ = l.twin_;
|
||||
incident_sface_ = l.incident_sface_;
|
||||
facet_ = l.facet_;
|
||||
info_ = 0;
|
||||
mark_ = l.mark_;
|
||||
circle_ = l.circle_;
|
||||
}
|
||||
|
||||
SHalfloop_base<Refs>& operator=(const SHalfloop_base<Refs>& l)
|
||||
{ twin_ = l.twin_;
|
||||
incident_sface_ = l.incident_sface_;
|
||||
facet_ = l.facet_;
|
||||
info_ = 0;
|
||||
mark_ = l.mark_;
|
||||
circle_ = l.circle_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Mark& mark() { return mark_;}
|
||||
const Mark& mark() const { return mark_; }
|
||||
|
||||
SHalfloop_handle& twin() { return twin_; }
|
||||
SHalfloop_const_handle twin() const { return twin_; }
|
||||
|
||||
Sphere_circle& circle() { return circle_; }
|
||||
const Sphere_circle& circle() const { return circle_; }
|
||||
|
||||
SFace_handle& incident_sface() { return incident_sface_; }
|
||||
SFace_const_handle incident_sface() const { return incident_sface_; }
|
||||
|
||||
Halffacet_handle& facet() { return facet_; }
|
||||
Halffacet_const_handle facet() const { return facet_; }
|
||||
|
||||
GenPtr& info() { return info_; }
|
||||
const GenPtr& info() const { return info_; }
|
||||
|
||||
public:
|
||||
std::string debug() const
|
||||
{ std::stringstream os;
|
||||
set_pretty_mode(os);
|
||||
os<<"sl [ "<<circle_<<" ] ";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
bool is_twin() const { return (&*twin_ < this); }
|
||||
|
||||
bool is_valid( bool verb = false, int level = 0) const {
|
||||
|
||||
Verbose_ostream verr(verb);
|
||||
verr << "begin CGAL::SNC_items<...>::SHalfloop_base::is_valid( verb=true, "
|
||||
"level = " << level << "):" << std::endl;
|
||||
|
||||
bool valid = (twin_ != SHalfloop_handle() && twin_ != NULL);
|
||||
valid = valid && (incident_sface_ != SFace_handle() &&
|
||||
incident_sface_ != NULL);
|
||||
valid = valid && (facet_ != Halffacet_handle() &&
|
||||
facet_ != NULL);
|
||||
valid = valid && (circle_.d() == 0);
|
||||
valid = valid && (circle_.a() != 0 || circle_.b() != 0 || circle_.c() !=0);
|
||||
|
||||
verr << "end of CGAL::SNC_items<...>::SHalfloop_base::is_valid(): structure is "
|
||||
<< ( valid ? "valid." : "NOT VALID.") << std::endl;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
}; // SHalfloop_base
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
#endif //CGAL_NEF_SHALFLOOP_H
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,95 @@
|
|||
#ifndef CGAL_NEF_SNC_ITEMS_H
|
||||
#define CGAL_NEF_SNC_ITEMS_H
|
||||
#include <CGAL/Nef_3/Vertex.h>
|
||||
#include <CGAL/Nef_3/Halfedge.h>
|
||||
#include <CGAL/Nef_3/Halffacet.h>
|
||||
#include <CGAL/Nef_3/Volume.h>
|
||||
#include <CGAL/Nef_3/SHalfedge.h>
|
||||
#include <CGAL/Nef_3/SHalfloop.h>
|
||||
#include <CGAL/Nef_3/SFace.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
class Index_generator {
|
||||
|
||||
static int unique;
|
||||
public:
|
||||
static int get_unique_index() { return unique++; }
|
||||
};
|
||||
|
||||
int Index_generator::unique = 0;
|
||||
|
||||
class SNC_indexed_items {
|
||||
public:
|
||||
template <class Refs> class Vertex : public Vertex_base<Refs> {};
|
||||
template <class Refs> class Halffacet : public Halffacet_base<Refs> {};
|
||||
template <class Refs> class Volume : public Volume_base<Refs> {};
|
||||
template <class Refs> class SFace : public SFace_base<Refs> {};
|
||||
|
||||
template <class Refs> class SHalfloop : public SHalfloop_base<Refs> {
|
||||
typedef SHalfloop_base<Refs> Base;
|
||||
int index;
|
||||
public:
|
||||
SHalfloop() : Base(), index(0) {}
|
||||
SHalfloop(const SHalfloop<Refs>& sl) : Base(sl), index(0) {}
|
||||
SHalfloop<Refs>& operator=(const SHalfloop<Refs>& sl) {
|
||||
(Base) *this = (Base) sl;
|
||||
index = sl.index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void set_index(int idx = Index_generator::get_unique_index())
|
||||
{ index = idx; }
|
||||
int get_index() const { return index; }
|
||||
};
|
||||
|
||||
template <class Refs> class SHalfedge : public SHalfedge_base<Refs> {
|
||||
typedef SHalfedge_base<Refs> Base;
|
||||
int index;
|
||||
int index2;
|
||||
public:
|
||||
SHalfedge() : Base(), index(0), index2(0) {}
|
||||
SHalfedge(const SHalfedge<Refs>& se)
|
||||
: Base(se), index(se.index), index2(se.index2) {}
|
||||
SHalfedge<Refs>& operator=(const SHalfedge<Refs>& se) {
|
||||
(Base) *this = (Base) se;
|
||||
index = se.index;
|
||||
index2 = se.index2;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void set_index(int idx = Index_generator::get_unique_index())
|
||||
{ index = index2 = idx; }
|
||||
int get_index() const {
|
||||
// CGAL_assertion(index==index2);
|
||||
return index;
|
||||
}
|
||||
void set_forward_index(int idx) { index = idx;}
|
||||
void set_backward_index(int idx) { index2 = idx;}
|
||||
int get_forward_index() const { return index; }
|
||||
int get_backward_index() const { return index2; }
|
||||
int get_smaller_index() const { return index < index2 ? index : index2; }
|
||||
};
|
||||
|
||||
template <class Refs> class SVertex : public Halfedge_base<Refs> {
|
||||
typedef Halfedge_base<Refs> Base;
|
||||
typedef typename Refs::Mark Mark;
|
||||
int index;
|
||||
public:
|
||||
SVertex() : Base(), index(0) {}
|
||||
SVertex(Mark m) : Base(m), index(0) {}
|
||||
SVertex(const SVertex<Refs>& sv) : Base(sv) { index = sv.index; }
|
||||
SVertex<Refs>& operator=(const SVertex<Refs>& sv) {
|
||||
(Base) *this = (Base) sv;
|
||||
index = sv.index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void set_index(int idx = Index_generator::get_unique_index())
|
||||
{ index = idx; }
|
||||
int get_index() const { return index; }
|
||||
};
|
||||
};
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
#endif // CGAL_NEF_SNC_ITEMS_H
|
||||
|
|
@ -0,0 +1,365 @@
|
|||
// Copyright (c) 1997-2002 Max-Planck-Institute Saarbruecken (Germany).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
// the terms of the Q Public License version 1.0.
|
||||
// See the file LICENSE.QPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL: svn+ssh://hachenb@scm.gforge.inria.fr/svn/cgal/branches/Filtered_Nef/Nef_3/include/CGAL/Nef_3/Vertex.h $
|
||||
// $Id: Vertex.h 35450 2006-12-06 10:43:20Z hachenb $
|
||||
//
|
||||
//
|
||||
// Author(s) : Michael Seel <seel@mpi-sb.mpg.de>
|
||||
// Miguel Granados <granados@mpi-sb.mpg.de>
|
||||
// Susan Hert <hert@mpi-sb.mpg.de>
|
||||
// Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
// Peter Hachenberger <hachenberger@mpi-sb.mpg.de>
|
||||
#ifndef CGAL_NEF_VERTEX_H
|
||||
#define CGAL_NEF_VERTEX_H
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <CGAL/IO/Verbose_ostream.h>
|
||||
#include <CGAL/Nef_3/SNC_iteration.h>
|
||||
|
||||
#undef CGAL_NEF_DEBUG
|
||||
#define CGAL_NEF_DEBUG 83
|
||||
#include <CGAL/Nef_2/debug.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template<class Refs>
|
||||
class Vertex_base {
|
||||
|
||||
typedef void* GenPtr;
|
||||
typedef typename Refs::Mark Mark;
|
||||
typedef typename Refs::Point_3 Point_3;
|
||||
|
||||
typedef typename Refs::Vertex_handle Vertex_handle;
|
||||
typedef typename Refs::SHalfloop_handle SHalfloop_handle;
|
||||
|
||||
typedef typename Refs::Vertex_iterator Vertex_iterator;
|
||||
typedef typename Refs::SVertex_iterator SVertex_iterator;
|
||||
typedef typename Refs::SHalfedge_iterator SHalfedge_iterator;
|
||||
typedef typename Refs::SHalfloop_iterator SHalfloop_iterator;
|
||||
typedef typename Refs::SFace_iterator SFace_iterator;
|
||||
|
||||
typedef typename Refs::Vertex_const_iterator Vertex_const_iterator;
|
||||
typedef typename Refs::SVertex_const_iterator SVertex_const_iterator;
|
||||
typedef typename Refs::SHalfedge_const_iterator SHalfedge_const_iterator;
|
||||
typedef typename Refs::SFace_const_iterator SFace_const_iterator;
|
||||
typedef typename Refs::SHalfloop_const_handle SHalfloop_const_handle;
|
||||
|
||||
typedef typename Refs::Size_type Size_type;
|
||||
|
||||
Point_3 point_at_center_;
|
||||
Mark mark_;
|
||||
// local view (surface graph):
|
||||
public:
|
||||
Refs* sncp_;
|
||||
SVertex_iterator svertices_begin_, svertices_last_;
|
||||
SHalfedge_iterator shalfedges_begin_, shalfedges_last_;
|
||||
SFace_iterator sfaces_begin_, sfaces_last_;
|
||||
SHalfloop_iterator shalfloop_;
|
||||
GenPtr info_;
|
||||
|
||||
public:
|
||||
|
||||
Vertex_base() : point_at_center_(), mark_(), sncp_(),
|
||||
svertices_begin_(), svertices_last_(),
|
||||
shalfedges_begin_(), shalfedges_last_(),
|
||||
sfaces_begin_(), sfaces_last_(), shalfloop_(),
|
||||
info_()
|
||||
// , sm_(Vertex_handle((SNC_in_place_list_vertex<Vertex_base>*) this))
|
||||
{}
|
||||
|
||||
Vertex_base(const Point_3& p, Mark m) :
|
||||
point_at_center_(p), mark_(m), sncp_(),
|
||||
svertices_begin_(), svertices_last_(),
|
||||
shalfedges_begin_(), shalfedges_last_(),
|
||||
sfaces_begin_(), sfaces_last_(), shalfloop_(),
|
||||
info_()
|
||||
// , sm_(Vertex_handle((SNC_in_place_list_vertex<Vertex_base>*) this))
|
||||
{}
|
||||
|
||||
Vertex_base(const Vertex_base<Refs>& v)
|
||||
// : sm_(Vertex_handle((SNC_in_place_list_vertex<Vertex_base>*)this))
|
||||
{
|
||||
point_at_center_ = v.point_at_center_;
|
||||
mark_ = v.mark_;
|
||||
sncp_ = v.sncp_;
|
||||
svertices_begin_ = v.svertices_begin_;
|
||||
svertices_last_ = v.svertices_last_;
|
||||
shalfedges_begin_ = v.shalfedges_begin_;
|
||||
shalfedges_last_ = v.shalfedges_last_;
|
||||
sfaces_begin_ = v.sfaces_begin_;
|
||||
sfaces_last_ = v.sfaces_last_;
|
||||
shalfloop_ = v.shalfloop_;
|
||||
info_ = 0;
|
||||
}
|
||||
|
||||
Vertex_base<Refs>& operator=(const Vertex_base<Refs>& v)
|
||||
{ if (this == &v) return *this;
|
||||
point_at_center_ = v.point_at_center_;
|
||||
mark_ = v.mark_;
|
||||
sncp_ = v.sncp_;
|
||||
svertices_begin_ = v.svertices_begin_;
|
||||
svertices_last_ = v.svertices_last_;
|
||||
shalfedges_begin_ = v.shalfedges_begin_;
|
||||
shalfedges_last_ = v.shalfedges_last_;
|
||||
sfaces_begin_ = v.sfaces_begin_;
|
||||
sfaces_last_ = v.sfaces_last_;
|
||||
shalfloop_ = v.shalfloop_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Refs* sncp() const { return sncp_; }
|
||||
Refs*& sncp() { return sncp_; }
|
||||
|
||||
/* all sobjects of the local graph are stored in a global list
|
||||
where each vertex has a continous range in each list for its
|
||||
sobjects. All objects of the range [sxxx_begin_,sxxx_last_]
|
||||
belong to a vertex. This range is empty iff
|
||||
sxxx_begin_ == sxxx_last_ == sncp()->sxxx_end()
|
||||
( the latter being the standard end iterator of the
|
||||
corresponding list )
|
||||
for the past the end iterator we have to increment sxxx_last_
|
||||
once iff the range is non-empty. */
|
||||
|
||||
void init_range(SVertex_iterator it)
|
||||
{ svertices_begin_ = svertices_last_ = it; }
|
||||
void init_range(SHalfedge_iterator it)
|
||||
{ shalfedges_begin_ = shalfedges_last_ = it; }
|
||||
void init_range(SFace_iterator it)
|
||||
{ sfaces_begin_ = sfaces_last_ = it; }
|
||||
|
||||
SVertex_iterator& svertices_begin()
|
||||
{ return svertices_begin_; }
|
||||
SVertex_iterator& svertices_last()
|
||||
{ return svertices_last_; }
|
||||
SVertex_iterator svertices_end()
|
||||
{ if ( svertices_last_ == sncp()->svertices_end() )
|
||||
return svertices_last_;
|
||||
else
|
||||
return ++SVertex_iterator(svertices_last_); }
|
||||
|
||||
SHalfedge_iterator& shalfedges_begin()
|
||||
{ return shalfedges_begin_; }
|
||||
SHalfedge_iterator& shalfedges_last()
|
||||
{ return shalfedges_last_; }
|
||||
SHalfedge_iterator shalfedges_end()
|
||||
{ if ( shalfedges_last_ == sncp()->shalfedges_end() )
|
||||
return shalfedges_last_;
|
||||
else
|
||||
return ++SHalfedge_iterator(shalfedges_last_); }
|
||||
|
||||
SFace_iterator& sfaces_begin()
|
||||
{ return sfaces_begin_; }
|
||||
SFace_iterator& sfaces_last()
|
||||
{ return sfaces_last_; }
|
||||
SFace_iterator sfaces_end()
|
||||
{ if ( sfaces_last_ == sncp()->sfaces_end() )
|
||||
return sfaces_last_;
|
||||
else
|
||||
return ++SFace_iterator(sfaces_last_); }
|
||||
|
||||
SVertex_const_iterator svertices_begin() const
|
||||
{ return svertices_begin_; }
|
||||
SVertex_const_iterator svertices_last() const
|
||||
{ return svertices_last_; }
|
||||
SVertex_const_iterator svertices_end() const
|
||||
{ if ( svertices_last_ == sncp()->svertices_end() )
|
||||
return svertices_last_;
|
||||
else
|
||||
return ++SVertex_const_iterator(svertices_last_); }
|
||||
|
||||
SHalfedge_const_iterator shalfedges_begin() const
|
||||
{ return shalfedges_begin_; }
|
||||
SHalfedge_const_iterator shalfedges_last() const
|
||||
{ return shalfedges_last_; }
|
||||
SHalfedge_const_iterator shalfedges_end() const
|
||||
{ if ( shalfedges_last_ == sncp()->shalfedges_end() )
|
||||
return shalfedges_last_;
|
||||
else
|
||||
return ++SHalfedge_const_iterator(shalfedges_last_); }
|
||||
|
||||
SFace_const_iterator sfaces_begin() const
|
||||
{ return sfaces_begin_; }
|
||||
SFace_const_iterator sfaces_last() const
|
||||
{ return sfaces_last_; }
|
||||
SFace_const_iterator sfaces_end() const
|
||||
{ if ( sfaces_last_ == sncp()->sfaces_end() )
|
||||
return sfaces_last_;
|
||||
else
|
||||
return ++SFace_const_iterator(sfaces_last_); }
|
||||
|
||||
SHalfloop_handle& shalfloop() { return shalfloop_; }
|
||||
SHalfloop_handle shalfloop() const { return shalfloop_; }
|
||||
|
||||
bool has_shalfloop() const {
|
||||
return shalfloop_ != sncp()->shalfloops_end();
|
||||
}
|
||||
|
||||
Size_type number_of_svertices() const
|
||||
/*{\Mop returns the number of vertices.}*/
|
||||
{ Size_type n(0);
|
||||
SVertex_const_iterator vit;
|
||||
CGAL_forall_svertices(vit, *this) ++n;
|
||||
return n; }
|
||||
|
||||
Size_type number_of_shalfedges() const
|
||||
/*{\Mop returns the number of halfedges.}*/
|
||||
{ Size_type n(0);
|
||||
SHalfedge_const_iterator eit;
|
||||
CGAL_forall_shalfedges(eit, *this) ++n;
|
||||
return n;}
|
||||
|
||||
Size_type number_of_sedges() const
|
||||
/*{\Mop returns the number of edges.}*/
|
||||
{ return number_of_shalfedges()/2; }
|
||||
|
||||
Size_type number_of_shalfloops() const
|
||||
/*{\Mop returns the number of halfloops.}*/
|
||||
{ return ( has_shalfloop() ? 2 : 0); }
|
||||
|
||||
Size_type number_of_sloops() const
|
||||
/*{\Mop returns the number of loops.}*/
|
||||
{ return number_of_shalfloops()/2; }
|
||||
|
||||
Size_type number_of_sfaces() const
|
||||
/*{\Mop returns the number of faces.}*/
|
||||
{ Size_type n(0);
|
||||
SFace_const_iterator fit;
|
||||
CGAL_forall_sfaces(fit, *this) ++n;
|
||||
return n; }
|
||||
|
||||
|
||||
/*{\Xtext Vertices provide access to their local graphs via
|
||||
the iterator ranges:
|
||||
\begin{Mverb}
|
||||
SVertex_iterator svertices_begin()/svertices_end()
|
||||
SHalfedge_iterator shalfedges_begin()/shalfedges_end()
|
||||
SFace_iterator sfaces_begin()/sfaces_end()
|
||||
SHalfloop_handle shalfloop()
|
||||
\end{Mverb}
|
||||
}*/
|
||||
|
||||
void clear()
|
||||
/*{\Xop clears the local graph.}*/ {
|
||||
SFace_iterator fit = sfaces_begin(),
|
||||
fend = sfaces_end();
|
||||
while (fit != fend) {
|
||||
SFace_iterator fdel = fit++;
|
||||
/* TO VERIFY: next statement needs access to a private attribute */
|
||||
sncp()->reset_sm_object_list(fdel->boundary_entry_objects_);
|
||||
sncp()->delete_sface_only(fdel);
|
||||
}
|
||||
sfaces_begin_ = sfaces_last_ = sncp()->sfaces_end();
|
||||
|
||||
if ( shalfloop() != sncp()->shalfloops_end() ) {
|
||||
sncp()->delete_shalfloop_only(shalfloop_->twin());
|
||||
sncp()->delete_shalfloop_only(shalfloop_);
|
||||
shalfloop_ = sncp()->shalfloops_end();
|
||||
}
|
||||
|
||||
SHalfedge_iterator eit = shalfedges_begin(),
|
||||
eend = shalfedges_end();
|
||||
while (eit != eend) {
|
||||
SHalfedge_iterator edel = eit++;
|
||||
sncp()->delete_shalfedge_only(edel);
|
||||
}
|
||||
shalfedges_begin_ = shalfedges_last_ = sncp()->shalfedges_end();
|
||||
|
||||
SVertex_iterator vit = svertices_begin(),
|
||||
vend = svertices_end();
|
||||
while (vit != vend) {
|
||||
SVertex_iterator vdel = vit++;
|
||||
sncp()->delete_halfedge_only(vdel);
|
||||
}
|
||||
svertices_begin_ = svertices_last_ = sncp()->halfedges_end();
|
||||
}
|
||||
|
||||
Point_3& point() { return point_at_center_; }
|
||||
const Point_3& point() const { return point_at_center_; }
|
||||
Mark& mark() { return mark_; }
|
||||
const Mark& mark() const { return mark_;}
|
||||
GenPtr& info() { return info_; }
|
||||
const GenPtr& info() const { return info_; }
|
||||
|
||||
~Vertex_base() {
|
||||
CGAL_NEF_TRACEN(" destroying Vertex item "<<&*this);
|
||||
}
|
||||
|
||||
public:
|
||||
std::string debug() const
|
||||
{ std::stringstream os;
|
||||
set_pretty_mode(os);
|
||||
os<<"{ addr, point, mark, snc, svb, sve, seb, see, sfb, sfe, sl,"
|
||||
<<" info }"<<std::endl;
|
||||
os<<"{ "<<this<<", "<<point_at_center_<<", "<<mark_<<", "<<&*sncp_<<", "
|
||||
<<&*svertices_begin_ <<", "<<&*svertices_last_ <<", "
|
||||
<<&*shalfedges_begin_<<", "<<&*shalfedges_last_<<", "
|
||||
<<&*sfaces_begin_ <<", "<<&*sfaces_last_ <<", "
|
||||
<<&*shalfloop_ <<", "
|
||||
<<info_<<" }";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
bool check_basic_functions() {
|
||||
/*
|
||||
if(svertices_begin_ == sncp()->svertices_end())
|
||||
CGAL_assertion(svertices_end() == sncp()->svertices_end());
|
||||
if(shalfedges_begin_ == sncp()->shalfedges_end())
|
||||
CGAL_assertion(shalfedges_end() == sncp()->shalfedges_end());
|
||||
if(sfaces_begin_ == sncp()->sfaces_end())
|
||||
CGAL_assertion(sfaces_end() == sncp()->sfaces_end());
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
bool is_valid( bool verb = false, int level = 0) const {
|
||||
|
||||
Verbose_ostream verr(verb);
|
||||
verr << "begin CGAL::SNC_items<...>::Vertex_base::is_valid( verb=true, "
|
||||
"level = " << level << "):" << std::endl;
|
||||
|
||||
bool valid = (sncp_ != NULL);
|
||||
valid = valid && (svertices_begin_ != NULL && svertices_begin_ != SVertex_iterator());
|
||||
valid = valid && (svertices_last_ != NULL && svertices_last_ != SVertex_iterator());
|
||||
valid = valid && (shalfedges_begin_ != NULL && shalfedges_begin_ != SHalfedge_iterator());
|
||||
valid = valid && (shalfedges_last_ != NULL && shalfedges_last_ != SHalfedge_iterator());
|
||||
valid = valid && (sfaces_begin_ != NULL && sfaces_begin_ != SFace_iterator());
|
||||
valid = valid && (sfaces_last_ != NULL && sfaces_last_ != SFace_iterator());
|
||||
valid = valid && (shalfloop_ != NULL && shalfloop_ != SHalfloop_iterator());
|
||||
|
||||
if(shalfedges_begin_ == sncp()->shalfedges_end()) { // point in volume or on plane, which is either isolated or has one outgoing edge
|
||||
if(shalfloop_ != sncp()->shalfloops_end())
|
||||
valid = valid && (++SFace_const_iterator(sfaces_begin_) == sfaces_last_);
|
||||
else
|
||||
valid = valid && (sfaces_begin_ == sfaces_last_);
|
||||
}
|
||||
|
||||
valid = valid && (sfaces_begin_ != sncp()->sfaces_end());
|
||||
if(sfaces_begin_ == sfaces_last_) {
|
||||
valid = valid && (shalfloop_ == sncp()->shalfloops_end());
|
||||
}
|
||||
else
|
||||
valid = valid && (sfaces_begin_->sface_cycles_begin() !=
|
||||
sfaces_begin_->sface_cycles_end());
|
||||
|
||||
verr << "end of CGAL::SNC_items<...>::Vertex_base::is_valid(): structure is "
|
||||
<< ( valid ? "valid." : "NOT VALID.") << std::endl;
|
||||
return valid;
|
||||
}
|
||||
|
||||
}; // Vertex_base
|
||||
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
#endif // CGAL_NEF_VERTEX_H
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
// Copyright (c) 1997-2002 Max-Planck-Institute Saarbruecken (Germany).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
// the terms of the Q Public License version 1.0.
|
||||
// See the file LICENSE.QPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL: svn+ssh://hachenb@scm.gforge.inria.fr/svn/cgal/branches/Filtered_Nef/Nef_3/include/CGAL/Nef_3/Volume.h $
|
||||
// $Id: Volume.h 35450 2006-12-06 10:43:20Z hachenb $
|
||||
//
|
||||
//
|
||||
// Author(s) : Michael Seel <seel@mpi-sb.mpg.de>
|
||||
// Miguel Granados <granados@mpi-sb.mpg.de>
|
||||
// Susan Hert <hert@mpi-sb.mpg.de>
|
||||
// Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
// Peter Hachenberger <hachenberger@mpi-sb.mpg.de>
|
||||
#ifndef CGAL_NEF_VOLUME_H
|
||||
#define CGAL_NEF_VOLUME_H
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <CGAL/IO/Verbose_ostream.h>
|
||||
#include <CGAL/Nef_3/SNC_iteration.h>
|
||||
|
||||
#undef CGAL_NEF_DEBUG
|
||||
#define CGAL_NEF_DEBUG 83
|
||||
#include <CGAL/Nef_2/debug.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <typename Refs>
|
||||
class Volume_base {
|
||||
typedef void* GenPtr;
|
||||
typedef typename Refs::Mark Mark;
|
||||
typedef typename Refs::Volume_handle Volume_handle;
|
||||
typedef typename Refs::Volume_const_handle Volume_const_handle;
|
||||
typedef typename Refs::Object_list Object_list;
|
||||
typedef typename Refs::Shell_entry_iterator
|
||||
Shell_entry_iterator;
|
||||
typedef typename Refs::Shell_entry_const_iterator
|
||||
Shell_entry_const_iterator;
|
||||
|
||||
Mark mark_;
|
||||
Object_list shell_entry_objects_; // SFaces
|
||||
|
||||
public:
|
||||
|
||||
Volume_base() {}
|
||||
|
||||
Volume_base(Mark m) : mark_(m) {}
|
||||
|
||||
~Volume_base() {
|
||||
CGAL_NEF_TRACEN(" destroying Volume_base item "<<&*this);
|
||||
}
|
||||
|
||||
Volume_base(const Volume_base<Refs>& v)
|
||||
{ mark_ = v.mark_;
|
||||
shell_entry_objects_ = v.shell_entry_objects_;
|
||||
}
|
||||
|
||||
Volume_base<Refs>& operator=(const Volume_base<Refs>& v)
|
||||
{ if (this == &v) return *this;
|
||||
mark_ = v.mark_;
|
||||
shell_entry_objects_ = v.shell_entry_objects_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Mark& mark() { return mark_; }
|
||||
const Mark& mark() const { return mark_; }
|
||||
|
||||
GenPtr& info() { return this->info_; }
|
||||
const GenPtr& info() const { return this->info_; }
|
||||
|
||||
Object_list& shell_entry_objects() { return shell_entry_objects_; }
|
||||
const Object_list& shell_entry_objects() const {
|
||||
return shell_entry_objects_;
|
||||
}
|
||||
|
||||
Shell_entry_iterator shells_begin()
|
||||
{ return shell_entry_objects_.begin(); }
|
||||
Shell_entry_iterator shells_end()
|
||||
{ return shell_entry_objects_.end(); }
|
||||
Shell_entry_const_iterator shells_begin() const
|
||||
{ return shell_entry_objects_.begin(); }
|
||||
Shell_entry_const_iterator shells_end() const
|
||||
{ return shell_entry_objects_.end(); }
|
||||
|
||||
bool is_valid( bool verb = false, int level = 0) const {
|
||||
|
||||
Verbose_ostream verr(verb);
|
||||
verr << "begin CGAL::SNC_items<...>::Volume_base::is_valid( verb=true, "
|
||||
"level = " << level << "):" << std::endl;
|
||||
|
||||
bool valid = (!shell_entry_objects_.empty());
|
||||
|
||||
verr << "end of CGAL::SNC_items<...>::Volume_base::is_valid(): structure is "
|
||||
<< ( valid ? "valid." : "NOT VALID.") << std::endl;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
}; // Volume_base
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
#endif //CGAL_NEF_VOLUME_H
|
||||
Loading…
Reference in New Issue