mirror of https://github.com/CGAL/cgal
cleaning up + comments
This commit is contained in:
parent
e8775c9c96
commit
93c5bceda9
|
|
@ -16,7 +16,7 @@
|
|||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Claudia Werner
|
||||
// Author(s) : Claudia Werner, Mariette Yvinec
|
||||
|
||||
#ifndef CGAL_CONSTRAINED_TRIANGULATION_FACE_BASE_SPHERE_2_H
|
||||
#define CGAL_CONSTRAINED_TRIANGULATION_FACE_BASE_SPHERE_2_H
|
||||
|
|
@ -156,4 +156,4 @@ cw_permute()
|
|||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif //CGAL_CONSTRAINED_TRIANGULATION_FACE_BASE_2_H
|
||||
#endif //CGAL_CONSTRAINED_TRIANGULATION_FACE_BASE_SPHERE_2_H
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <CGAL/Triangulation_sphere_2.h>
|
||||
#include <CGAL/Triangulation_face_base_sphere_2.h>
|
||||
#include <CGAL/Regular_triangulation_vertex_base_2.h>
|
||||
#include <CGAL/Triangulation_vertex_base_2.h>
|
||||
#include <CGAL/utility.h>
|
||||
#include <fstream>
|
||||
|
||||
|
|
@ -46,8 +46,7 @@ public:
|
|||
typedef typename Base::Solid_faces_iterator Solid_faces_iterator;
|
||||
typedef typename Base::Solid_edges_iterator Solid_edges_iterator;
|
||||
typedef typename Base::Contour_edges_iterator Contour_edges_iterator;
|
||||
//typedef typename Base::Vertex_list Vertex_list;
|
||||
//typedef typename Vertex_list::iterator Vertex_list_iterator;
|
||||
|
||||
|
||||
#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
|
||||
using Base::cw;
|
||||
|
|
@ -88,7 +87,8 @@ public:
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
//class for sorting points lexicographically.
|
||||
//This sorting is used for the perturbation in power_test
|
||||
class Perturbation_order {
|
||||
const Self *t;
|
||||
public:
|
||||
|
|
@ -610,7 +610,7 @@ insert(const Point &p, Face_handle start)
|
|||
return vertices_begin();
|
||||
return (loc->vertex(li));
|
||||
}
|
||||
default:
|
||||
default: //point can be inserted
|
||||
return insert(p, lt, loc, li);
|
||||
}
|
||||
}
|
||||
|
|
@ -783,7 +783,9 @@ insert_outside_affine_hull_regular(const Point& p)
|
|||
|
||||
|
||||
|
||||
/*method to marc faces incident to v as ghost-faces or solid-faces.
|
||||
/*method to mark faces incident to v as ghost-faces or solid-faces.
|
||||
bool first defines whether dimension of the triangulation increased
|
||||
from one to two by inserting v
|
||||
If first == true all faces are updated.
|
||||
*/
|
||||
template < class Gt, class Tds >
|
||||
|
|
@ -791,6 +793,9 @@ bool
|
|||
Delaunay_triangulation_sphere_2<Gt,Tds>::
|
||||
update_ghost_faces(Vertex_handle v, bool first)
|
||||
{
|
||||
if (number_of_vertices()<3)
|
||||
return false;
|
||||
|
||||
bool neg_found=false;
|
||||
if(dimension()==1){
|
||||
All_edges_iterator eit=all_edges_begin();
|
||||
|
|
@ -890,9 +895,9 @@ remove_2D(Vertex_handle v)
|
|||
{
|
||||
CGAL_triangulation_precondition(dimension()==2);
|
||||
|
||||
if (test_dim_down(v)) {
|
||||
if (test_dim_down(v)) { //resulting triangulation has dim 1
|
||||
this->_tds.remove_dim_down(v);
|
||||
update_ghost_faces();
|
||||
update_ghost_faces(); //1d triangulation, no vertex needed to update ghost-faces
|
||||
}
|
||||
else {
|
||||
std::list<Edge> hole;
|
||||
|
|
@ -922,17 +927,13 @@ test_dim_down(Vertex_handle v)
|
|||
if (it != v)
|
||||
points.push_back(it->point());
|
||||
|
||||
for(int i=0; i<points.size()-4; i++){
|
||||
for(int i=0; i<(int)points.size()-4; i++){
|
||||
Orientation s = power_test(points.at(i), points.at(i+1),points.at(i+2),points.at(i+3));
|
||||
dim1 = dim1 && s == ON_ORIENTED_BOUNDARY ;
|
||||
if (!dim1)
|
||||
return dim1;
|
||||
}return true;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -941,7 +942,8 @@ template <class Gt, class Tds >
|
|||
bool
|
||||
Delaunay_triangulation_sphere_2<Gt,Tds>::
|
||||
test_dim_up(const Point &p) const
|
||||
{
|
||||
{
|
||||
CGAL_triangulation_precondition(dimension()!=2);
|
||||
Face_handle f=all_edges_begin()->first;
|
||||
Vertex_handle v1=f->vertex(0);
|
||||
Vertex_handle v2=f->vertex(1);
|
||||
|
|
|
|||
|
|
@ -43,8 +43,11 @@ private:
|
|||
}
|
||||
|
||||
};
|
||||
|
||||
//the following two different adaptors are necessary because the Predicates don not need _sphere
|
||||
//compared to Predicates from Delaunay_sphere_traits
|
||||
|
||||
|
||||
//adaptor for calling the Predicate_ with the points projected on the sphere
|
||||
template < class K, class P, class Predicate_ >
|
||||
class Traits_with_projection_adaptor {
|
||||
public:
|
||||
|
|
@ -82,7 +85,7 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
//adaptor for calling the Predicate_ with the points projected on the sphere for predicates from the Kernel
|
||||
template < class K, class P, class Predicate_ >
|
||||
class Traits_with_projection_adaptorKernel {
|
||||
public:
|
||||
|
|
@ -194,12 +197,10 @@ struct Construct_projected_point_3
|
|||
{
|
||||
const Base_point& sphere_center;
|
||||
|
||||
Point_2 operator()(const Base_point& pt) const
|
||||
{
|
||||
return Point_2(pt, sphere_center);
|
||||
}
|
||||
Point_2 operator()(const Base_point& pt) const
|
||||
{ return Point_2(pt, sphere_center); }
|
||||
|
||||
Construct_projected_point_3(const Base_point& sc)
|
||||
Construct_projected_point_3(const Base_point& sc)
|
||||
:sphere_center(sc) {}
|
||||
};
|
||||
|
||||
|
|
@ -217,7 +218,7 @@ protected :
|
|||
template < class R >
|
||||
Projection_sphere_traits_3<R> ::
|
||||
Projection_sphere_traits_3(const Base_point& sphere, double radius)
|
||||
: _sphere(sphere), _radius(radius)
|
||||
: _radius(radius), _sphere(sphere)
|
||||
{}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
// $Id: Triangulation_face_base_sphere_2.h 28567 2006-02-16 14:30:13Z lsaboret $
|
||||
//
|
||||
//
|
||||
// Author(s) : Mariette Yvinec
|
||||
// Author(s) : Mariette Yvinec, Claudia Werner
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_FACE_BASE_SPHERE_2_H
|
||||
#define CGAL_TRIANGULATION_FACE_BASE_SPHERE_2_H
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef CGAL_TRIANGULATION_SPHERE_2_H
|
||||
#define CGAL_TRIANGULATION_SPHERE_2_H
|
||||
|
||||
//#define HALF_SPHERE
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
|
@ -90,11 +89,11 @@ class Ghost_tester
|
|||
return fit->is_ghost();
|
||||
}
|
||||
bool operator()(const All_edges_iterator & eit) const {
|
||||
int dim = t->dimension();
|
||||
//int dim = t->dimension();
|
||||
Face_handle f = eit->first;
|
||||
bool edge1 = f->is_ghost();
|
||||
Face_handle f2 = f->neighbor(eit->second);
|
||||
bool edge2b = f2->is_ghost();
|
||||
//bool edge2b = f2->is_ghost();
|
||||
bool edge2 = (f->neighbor(eit->second))->is_ghost();
|
||||
bool result = edge1&&edge2;
|
||||
return !result;
|
||||
|
|
@ -150,7 +149,7 @@ protected:
|
|||
|
||||
Gt _gt;
|
||||
Tds _tds;
|
||||
Face_handle _ghost;
|
||||
Face_handle _ghost; //stores an arbitary ghost-face
|
||||
double _minDistSquared; //minimal distance of two points to each other
|
||||
double _minRadiusSquared;//minimal distance of a point from center of the sphere
|
||||
double _maxRadiusSquared; //maximal distance of a point from center of the sphere
|
||||
|
|
@ -175,7 +174,7 @@ public:
|
|||
void set_radius(double radius){
|
||||
clear();
|
||||
init(radius);
|
||||
}
|
||||
}
|
||||
|
||||
//Assignement
|
||||
Triangulation_sphere_2 &operator=(const Triangulation_sphere_2 &tr);
|
||||
|
|
@ -204,7 +203,7 @@ void set_radius(double radius){
|
|||
|
||||
int dimension() const { return _tds.dimension();}
|
||||
size_type number_of_vertices() const {return _tds.number_of_vertices();}
|
||||
size_type number_of_faces() const{return _tds.number_of_faces();}
|
||||
size_type number_of_faces() const{return _tds.number_of_faces();}//total number of faces (solid + ghost)
|
||||
|
||||
int number_of_ghost_faces();
|
||||
|
||||
|
|
@ -227,7 +226,7 @@ size_type number_of_faces() const{return _tds.number_of_faces();}
|
|||
Oriented_side oriented_side(Face_handle f, const Point &p) const;
|
||||
bool xy_equal(const Point& p, const Point& q) const;
|
||||
bool collinear_between(const Point& p, const Point& q, const Point& r) const;
|
||||
Orientation coplanar_orientation(const Point& p, const Point& q,const Point& r ) const;
|
||||
//Orientation coplanar_orientation(const Point& p, const Point& q,const Point& r ) const;
|
||||
Orientation coplanar_orientation(const Point& p, const Point& q,const Point& r, const Point& s ) const;
|
||||
//------------------------------------------------------------------DEBUG---------------------------------------------------
|
||||
void show_all() const;
|
||||
|
|
@ -280,7 +279,7 @@ return CGAL::filter_iterator( all_faces_end(),
|
|||
|
||||
Solid_faces_iterator solid_faces_end() const {
|
||||
return CGAL::filter_iterator( all_faces_end(),
|
||||
Ghost_tester(this) );;
|
||||
Ghost_tester(this) );
|
||||
}
|
||||
|
||||
Solid_edges_iterator solid_edges_begin() const {
|
||||
|
|
@ -466,7 +465,8 @@ swap(Triangulation_sphere_2 &tr)
|
|||
|
||||
//--------------------------CHECKING---------------------------
|
||||
|
||||
|
||||
//is_valid is used by in the instream method, Delaunay_tri...
|
||||
//has its own is_valid
|
||||
|
||||
template <class Gt, class Tds >
|
||||
bool
|
||||
|
|
@ -549,7 +549,7 @@ is_too_close(const Point& p, const Point& q)const{
|
|||
|
||||
/*location for degenerated cases: locates the conflicting edge in a 1 dimensional triangulation.
|
||||
This methode is used, when the new point is coplanar with the existing vertices.
|
||||
bool plane defines if the points are also coplanar with the center of the sphere (true) or not (false).
|
||||
bool plane defines whether the points are also coplanar with the center of the sphere (true) or not (false).
|
||||
*/
|
||||
|
||||
template <class Gt, class Tds>
|
||||
|
|
@ -1022,7 +1022,7 @@ compare_xyz(const Point &p, const Point &q) const
|
|||
return geom_traits().compare_xyz_3_object()(p, q);
|
||||
}
|
||||
|
||||
/*check whether two points are equal*/
|
||||
|
||||
template <class Gt, class Tds >
|
||||
bool
|
||||
Triangulation_sphere_2<Gt, Tds>::
|
||||
|
|
@ -1078,7 +1078,7 @@ orientation(const Point&p, const Point &q, const Point &r, const Point & s)const
|
|||
return geom_traits().orientation_2_object()(p,q,r,s);
|
||||
}
|
||||
|
||||
|
||||
//returns true if p,q, and O (center of the sphere) are aligned and if p (q) is located in the segment Oq (Op)
|
||||
template <class Gt, class Tds >
|
||||
bool
|
||||
Triangulation_sphere_2<Gt, Tds>::
|
||||
|
|
@ -1087,11 +1087,12 @@ xy_equal(const Point& p, const Point& q) const
|
|||
return geom_traits().coradial_sphere_2_object()(p,q);
|
||||
}
|
||||
|
||||
// return true if r lies inside the cone defined by trait.sphere, p and q
|
||||
template <class Gt, class Tds >
|
||||
bool
|
||||
Triangulation_sphere_2<Gt, Tds>::
|
||||
collinear_between(const Point& p, const Point& q, const Point& r) const
|
||||
{ // return true if r lies inside the cone defined by trait.sphere, p and q
|
||||
{
|
||||
return geom_traits().inside_cone_2_object()(p,q,r);
|
||||
}
|
||||
//------------------------------------------------------------------------------DEBUG-------------------------------------------------
|
||||
|
|
@ -1140,7 +1141,7 @@ show_all() const
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
//returns the number of ghost_faces
|
||||
template <class Gt, class Tds >
|
||||
int
|
||||
Triangulation_sphere_2<Gt, Tds>::
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Claudia Werner
|
||||
// Author(s) : Claudia Werner, Mariette Yvinec
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_SPHERE_LINE_FACE_CIRCULATOR_2_H
|
||||
#define CGAL_TRIANGULATION_SPHERE_LINE_FACE_CIRCULATOR_2_H
|
||||
|
|
@ -137,7 +137,7 @@ private:
|
|||
Face_circulator done(fc);
|
||||
int ic = fc->index(v);
|
||||
Vertex_handle vt= fc->vertex(cw(ic));
|
||||
Orientation o = _tr->orientation(p, q, vt->point());
|
||||
//Orientation o = _tr->orientation(p, q, vt->point());
|
||||
while( _tr->orientation(p, q, vt->point()) != LEFT_TURN) {
|
||||
++fc;
|
||||
ic = fc->index(v);
|
||||
|
|
|
|||
|
|
@ -24,16 +24,7 @@ int main()
|
|||
|
||||
Gt::Construct_projected_point_3 cst =
|
||||
traits.construct_projected_point_3_object();
|
||||
|
||||
|
||||
//make_transform_iterator(points.begin(), cst),
|
||||
//boost::make_transform_iterator(points.end(), cst)
|
||||
|
||||
|
||||
|
||||
//Gt traits=Gt();
|
||||
// Operations
|
||||
Power_test_2 power_test = traits.power_test_2_object();
|
||||
Power_test_2 power_test = traits.power_test_2_object();
|
||||
Orientation_2 orientation = traits.orientation_2_object();
|
||||
Coradial_sphere_2 coradial = traits.coradial_sphere_2_object();
|
||||
Inside_cone_2 inside_cone = traits.inside_cone_2_object();
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@
|
|||
|
||||
|
||||
//convex Hull
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/point_generators_3.h>
|
||||
#include <CGAL/algorithm.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/convex_hull_3.h>
|
||||
|
|
@ -66,11 +64,8 @@ int main(){
|
|||
|
||||
|
||||
std::vector<Point> points;
|
||||
//std::vector<Point> points2(points.size()+1);
|
||||
std::vector<Point> points2;
|
||||
//std::vector<Vertex_handle> vertices;
|
||||
//vertices.reserve(nu_of_pts);
|
||||
|
||||
|
||||
points2.push_back(Point(0,0,0));
|
||||
|
||||
for (int count=0; count<nu_of_pts; count++) {
|
||||
|
|
|
|||
|
|
@ -16,12 +16,6 @@
|
|||
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef CGAL::Delaunay_triangulation_sphere_traits_2<K> Gt;
|
||||
typedef CGAL::Projection_sphere_traits_3<K> Gt2;
|
||||
typedef CGAL::Delaunay_triangulation_sphere_2<Gt> RTOS;
|
||||
|
|
@ -46,12 +40,10 @@ void test1(){
|
|||
RTOS::Vertex_handle v3 = rtos.insert(c);
|
||||
RTOS::Vertex_handle v4 = rtos.insert(d);
|
||||
RTOS::Vertex_handle v5 = rtos.insert(e);
|
||||
int test = rtos.number_of_ghost_faces();
|
||||
assert(rtos.number_of_ghost_faces()==2);
|
||||
assert(rtos.dimension()==2);
|
||||
|
||||
rtos.remove(v1);
|
||||
int test2 = rtos.dimension();
|
||||
assert(rtos.dimension()==1);
|
||||
rtos.remove(v2);
|
||||
assert(rtos.dimension()==1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue