mirror of https://github.com/CGAL/cgal
Improve reader sanity
This commit is contained in:
parent
e48bed20cc
commit
8648478b9a
|
|
@ -1,24 +1,22 @@
|
|||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/Delaunay_triangulation_sphere_2.h>
|
||||
#include <CGAL/Delaunay_triangulation_sphere_traits_2.h>
|
||||
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef CGAL::Delaunay_triangulation_sphere_traits_2<K> Traits;
|
||||
typedef CGAL::Delaunay_triangulation_sphere_2<Traits> DToS2;
|
||||
|
||||
typedef CGAL::Delaunay_triangulation_sphere_traits_2<K> Traits;
|
||||
typedef CGAL::Delaunay_triangulation_sphere_2<Traits> DToS2;
|
||||
|
||||
int main()
|
||||
{
|
||||
std::vector<K::Point_3> points;
|
||||
points.push_back( K::Point_3(2,1,1) );
|
||||
points.push_back( K::Point_3(-2,1,1) );
|
||||
points.push_back( K::Point_3(1,2,1) );
|
||||
points.push_back( K::Point_3(1,-2,1) );
|
||||
|
||||
points.push_back(K::Point_3(2,1,1));
|
||||
points.push_back(K::Point_3(-2,1,1));
|
||||
points.push_back(K::Point_3(1,2,1));
|
||||
points.push_back(K::Point_3(1,-2,1));
|
||||
|
||||
Traits traits(K::Point_3(1,1,1));
|
||||
DToS2 dtos(traits);
|
||||
dtos.insert(points.begin(),points.end());
|
||||
dtos.insert(points.begin(), points.end());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,22 @@
|
|||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/Delaunay_triangulation_sphere_2.h>
|
||||
#include <CGAL/Projection_sphere_traits_3.h>
|
||||
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
|
||||
typedef CGAL::Projection_sphere_traits_3<K> Projection_traits;
|
||||
typedef CGAL::Delaunay_triangulation_sphere_2<Projection_traits> Projected_DToS2;
|
||||
|
||||
int main()
|
||||
{
|
||||
std::vector<K::Point_3> points;
|
||||
points.push_back( K::Point_3(3,1,1) );
|
||||
points.push_back( K::Point_3(-8,1,1) );
|
||||
points.push_back( K::Point_3(1,2,1) );
|
||||
points.push_back( K::Point_3(1,-2,1) );
|
||||
|
||||
points.push_back(K::Point_3(3,1,1));
|
||||
points.push_back(K::Point_3(-8,1,1));
|
||||
points.push_back(K::Point_3(1,2,1));
|
||||
points.push_back(K::Point_3(1,-2,1));
|
||||
|
||||
Projection_traits traits(K::Point_3(1,1,1));
|
||||
Projected_DToS2 dtos(traits);
|
||||
|
|
@ -22,11 +24,7 @@ int main()
|
|||
Projection_traits::Construct_projected_point_3 cst =
|
||||
traits.construct_projected_point_3_object();
|
||||
|
||||
|
||||
dtos.insert(
|
||||
boost::make_transform_iterator(points.begin(), cst),
|
||||
boost::make_transform_iterator(points.end(), cst)
|
||||
);
|
||||
dtos.insert(boost::make_transform_iterator(points.begin(), cst),
|
||||
boost::make_transform_iterator(points.end(), cst)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Claudia Werner, Mariette Yvinec
|
||||
|
||||
|
|
@ -24,104 +24,103 @@
|
|||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/Triangulation_ds_face_base_2.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGAL {
|
||||
|
||||
template <class Gt, class Fb = Triangulation_face_base_sphere_2<Gt> >
|
||||
template < class Gt,
|
||||
class Fb = Triangulation_face_base_sphere_2<Gt> >
|
||||
class Constrained_triangulation_face_base_sphere_2
|
||||
: public Fb
|
||||
: public Fb
|
||||
{
|
||||
|
||||
typedef Fb Base;
|
||||
typedef typename Fb::Triangulation_data_structure TDS;
|
||||
|
||||
public:
|
||||
typedef Gt Geom_traits;
|
||||
typedef TDS Triangulation_data_structure;
|
||||
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||
typedef typename TDS::Face_handle Face_handle;
|
||||
typedef Gt Geom_traits;
|
||||
typedef TDS Triangulation_data_structure;
|
||||
|
||||
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||
typedef typename TDS::Face_handle Face_handle;
|
||||
|
||||
template < typename TDS2 >
|
||||
struct Rebind_TDS {
|
||||
typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2;
|
||||
typedef Constrained_triangulation_face_base_sphere_2<Gt,Fb2> Other;
|
||||
struct Rebind_TDS
|
||||
{
|
||||
typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2;
|
||||
typedef Constrained_triangulation_face_base_sphere_2<Gt, Fb2> Other;
|
||||
};
|
||||
|
||||
|
||||
protected:
|
||||
bool C[3];
|
||||
|
||||
|
||||
public:
|
||||
Constrained_triangulation_face_base_sphere_2()
|
||||
: Base()
|
||||
{
|
||||
set_constraints(false,false,false);
|
||||
set_constraints(false, false, false);
|
||||
}
|
||||
|
||||
Constrained_triangulation_face_base_sphere_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2)
|
||||
: Base(v0,v1,v2)
|
||||
Constrained_triangulation_face_base_sphere_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2)
|
||||
: Base(v0, v1, v2)
|
||||
{
|
||||
set_constraints(false,false,false);
|
||||
set_constraints(false, false, false);
|
||||
}
|
||||
|
||||
Constrained_triangulation_face_base_sphere_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2)
|
||||
: Base(v0,v1,v2,n0,n1,n2)
|
||||
Constrained_triangulation_face_base_sphere_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2)
|
||||
: Base(v0, v1, v2, n0, n1, n2)
|
||||
{
|
||||
set_constraints(false,false,false);
|
||||
set_constraints(false, false, false);
|
||||
}
|
||||
|
||||
|
||||
Constrained_triangulation_face_base_sphere_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2,
|
||||
bool c0,
|
||||
bool c1,
|
||||
bool c2 )
|
||||
: Base(v0,v1,v2,n0,n1,n2)
|
||||
Constrained_triangulation_face_base_sphere_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2,
|
||||
bool c0,
|
||||
bool c1,
|
||||
bool c2)
|
||||
: Base(v0, v1, v2, n0, n1, n2)
|
||||
{
|
||||
set_constraints(c0,c1,c2);
|
||||
set_constraints(c0, c1, c2);
|
||||
}
|
||||
|
||||
|
||||
bool is_constrained(int i) const ;
|
||||
void set_constraints(bool c0, bool c1, bool c2) ;
|
||||
void set_constraint(int i, bool b);
|
||||
void reorient();
|
||||
void ccw_permute();
|
||||
void cw_permute();
|
||||
|
||||
};
|
||||
|
||||
template <class Gt, class Fb>
|
||||
inline void
|
||||
Constrained_triangulation_face_base_sphere_2<Gt,Fb>::
|
||||
Constrained_triangulation_face_base_sphere_2<Gt, fb>::
|
||||
set_constraints(bool c0, bool c1, bool c2)
|
||||
{
|
||||
C[0]=c0;
|
||||
C[1]=c1;
|
||||
C[2]=c2;
|
||||
C[0] = c0;
|
||||
C[1] = c1;
|
||||
C[2] = c2;
|
||||
}
|
||||
|
||||
template <class Gt, class Fb>
|
||||
inline void
|
||||
Constrained_triangulation_face_base_sphere_2<Gt,Fb>::
|
||||
Constrained_triangulation_face_base_sphere_2<Gt, fb>::
|
||||
set_constraint(int i, bool b)
|
||||
{
|
||||
CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2);
|
||||
CGAL_triangulation_precondition(i == 0 || i == 1 || i == 2);
|
||||
C[i] = b;
|
||||
}
|
||||
|
||||
|
||||
template <class Gt, class Fb>
|
||||
inline bool
|
||||
Constrained_triangulation_face_base_sphere_2<Gt,Fb>::
|
||||
Constrained_triangulation_face_base_sphere_2<Gt, fb>::
|
||||
is_constrained(int i) const
|
||||
{
|
||||
return(C[i]);
|
||||
|
|
@ -129,31 +128,31 @@ is_constrained(int i) const
|
|||
|
||||
template <class Gt, class Fb>
|
||||
inline void
|
||||
Constrained_triangulation_face_base_sphere_2<Gt,Fb>::
|
||||
Constrained_triangulation_face_base_sphere_2<Gt, fb>::
|
||||
reorient()
|
||||
{
|
||||
Base::reorient();
|
||||
set_constraints(C[1],C[0],C[2]);
|
||||
set_constraints(C[1], c[0], c[2]);
|
||||
}
|
||||
|
||||
template <class Gt, class Fb>
|
||||
inline void
|
||||
Constrained_triangulation_face_base_sphere_2<Gt,Fb>::
|
||||
Constrained_triangulation_face_base_sphere_2<Gt, fb>::
|
||||
ccw_permute()
|
||||
{
|
||||
Base::ccw_permute();
|
||||
set_constraints(C[2],C[0],C[1]);
|
||||
set_constraints(C[2], c[0], c[1]);
|
||||
}
|
||||
|
||||
template <class Gt, class Fb>
|
||||
inline void
|
||||
Constrained_triangulation_face_base_sphere_2<Gt,Fb>::
|
||||
Constrained_triangulation_face_base_sphere_2<Gt, fb>::
|
||||
cw_permute()
|
||||
{
|
||||
Base::cw_permute();
|
||||
set_constraints(C[1],C[2],C[0]);
|
||||
set_constraints(C[1], c[2], c[0]);
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif //CGAL_CONSTRAINED_TRIANGULATION_FACE_BASE_SPHERE_2_H
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,12 +1,27 @@
|
|||
// Author(s) :
|
||||
// Copyright (c) 1997, 2012, 2019 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the Licenxse, or (at your option) any later version.
|
||||
//
|
||||
// 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$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Mariette Yvinec, Claudia Werner
|
||||
|
||||
#ifndef CGAL_DELAUNAY_TRIANGULATION_SPHERE_FILTERED_TRAITS_2_H
|
||||
#define CGAL_DELAUNAY_TRIANGULATION_SPHERE_FILTERED_TRAITS_2_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Delaunay_triangulation_sphere_traits_2.h>
|
||||
#include <CGAL/Filtered_predicate.h>
|
||||
//#include <CGAL/static_in_cone_ntC3.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -34,15 +49,12 @@ struct Delaunay_weighted_converter_2
|
|||
return Target_wp(Converter::operator()(wp.point()),
|
||||
Converter::operator()(wp.weight()));
|
||||
}*/
|
||||
Target_wp
|
||||
operator()(const Source_wp &wp) const
|
||||
{
|
||||
return Converter::operator()(wp);
|
||||
}
|
||||
|
||||
Target_wp operator()(const Source_wp &wp) cons { return Converter::operator()(wp); }
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
|
||||
// The argument is supposed to be a Filtered_kernel like kernel.
|
||||
template < typename K >
|
||||
class Delaunay_triangulation_sphere_filtered_traits_2
|
||||
|
|
@ -99,7 +111,7 @@ public:
|
|||
Delaunay_weighted_converter_2<C2F> > In_cone_3;
|
||||
|
||||
Power_test_2 power_test_2_object() const
|
||||
{ return Power_test_2();}
|
||||
{ return Power_test_2(); }
|
||||
|
||||
Compare_power_distance_2 compare_power_distance_2_object() const
|
||||
{ return Compare_power_distance_2(); }
|
||||
|
|
@ -112,7 +124,7 @@ public:
|
|||
}
|
||||
|
||||
Side_of_oriented_circle_2
|
||||
side_of_oriented_circle_2_object() const {
|
||||
side_of_oriented_circle_2_object() const {
|
||||
return Side_of_oriented_circle_2();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,308 +1,291 @@
|
|||
// Copyright (c) 1997, 2012, 2019 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the Licenxse, or (at your option) any later version.
|
||||
//
|
||||
// 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$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Mariette Yvinec, Claudia Werner
|
||||
|
||||
#ifndef CGAL_DELAUNAY_TRIANGULATION_SPHERE_TRAITS_2_H
|
||||
#define CGAL_DELAUNAY_TRIANGULATION_SPHERE_TRAITS_2_H
|
||||
|
||||
#include <CGAL/number_utils_classes.h>
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/Kernel_traits.h>
|
||||
#include <CGAL/Line_2.h>
|
||||
#include <CGAL/Ray_2.h>
|
||||
#include <CGAL/Point_2.h>
|
||||
#include <CGAL/Segment_2.h>
|
||||
#include <CGAL/Triangle_2.h>
|
||||
#include <CGAL/Line_2.h>
|
||||
#include <CGAL/Ray_2.h>
|
||||
#include <CGAL/predicates_on_points_2.h>
|
||||
#include <CGAL/basic_constructions_2.h>
|
||||
#include <CGAL/distance_predicates_2.h>
|
||||
#include <CGAL/enum.h>
|
||||
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/Segment_2_Segment_2_intersection.h>
|
||||
namespace CGAL {
|
||||
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <typename K >
|
||||
template < typename K >
|
||||
class Power_test_2
|
||||
{
|
||||
public:
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Oriented_side Oriented_side;
|
||||
typedef typename K::Comparison_result Comparison_result;
|
||||
|
||||
public:
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Oriented_side Oriented_side;
|
||||
typedef typename K::Comparison_result Comparison_result;
|
||||
|
||||
Power_test_2(const Point_2& sphere);
|
||||
|
||||
Oriented_side operator() (const Point_2& p,
|
||||
const Point_2& q,
|
||||
const Point_2& r,
|
||||
const Point_2& s) const
|
||||
{ return orientation(p,q,r,s); }
|
||||
|
||||
|
||||
Oriented_side operator() (const Point_2& p,
|
||||
const Point_2& q,
|
||||
const Point_2& r) const
|
||||
Oriented_side operator()(const Point_2& p,
|
||||
const Point_2& q,
|
||||
const Point_2& r,
|
||||
const Point_2& s) const
|
||||
{
|
||||
return -coplanar_orientation(p,q,_sphere,r);
|
||||
return orientation(p, q, r, s);
|
||||
}
|
||||
|
||||
|
||||
Oriented_side operator() (const Point_2& p,
|
||||
const Point_2& q) const
|
||||
Oriented_side operator()(const Point_2& p,
|
||||
const Point_2& q,
|
||||
const Point_2& r) const
|
||||
{
|
||||
Comparison_result pq=compare_xyz(p,q);
|
||||
|
||||
if(pq==EQUAL){
|
||||
return -coplanar_orientation(p, q,_sphere, r);
|
||||
}
|
||||
|
||||
Oriented_side operator()(const Point_2& p,
|
||||
const Point_2& q) const
|
||||
{
|
||||
Comparison_result pq = compare_xyz(p, q);
|
||||
|
||||
if(pq == EQUAL)
|
||||
return ON_ORIENTED_BOUNDARY;
|
||||
}
|
||||
Comparison_result sq=compare_xyz(_sphere,q);
|
||||
if(pq==sq){
|
||||
|
||||
Comparison_result sq = compare_xyz(_sphere, q);
|
||||
if(pq == sq)
|
||||
return ON_POSITIVE_SIDE;
|
||||
}
|
||||
|
||||
return ON_NEGATIVE_SIDE;
|
||||
}
|
||||
public:
|
||||
typedef Oriented_side result_type;
|
||||
|
||||
protected:
|
||||
Point_2 _sphere;
|
||||
public:
|
||||
typedef Oriented_side result_type;
|
||||
|
||||
protected:
|
||||
Point_2 _sphere;
|
||||
};
|
||||
|
||||
|
||||
template < typename K >
|
||||
Power_test_2<K>::
|
||||
Power_test_2(const Point_2& sphere)
|
||||
: _sphere(sphere)
|
||||
{}
|
||||
|
||||
|
||||
: _sphere(sphere)
|
||||
{ }
|
||||
|
||||
template < typename K >
|
||||
class Orientation_sphere_1
|
||||
{
|
||||
public:
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Comparison_result Comparison_result;
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Comparison_result Comparison_result;
|
||||
typedef Comparison_result result_type;
|
||||
|
||||
Orientation_sphere_1(const Point_2& sphere);
|
||||
|
||||
Comparison_result operator()(const Point_2& p, const Point_2& q) const
|
||||
{
|
||||
return coplanar_orientation(_sphere, p, q);
|
||||
}
|
||||
|
||||
Comparison_result operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
|
||||
{
|
||||
return coplanar_orientation(p, q, r, _sphere);
|
||||
}
|
||||
|
||||
Comparison_result operator()(const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& s) const
|
||||
{
|
||||
return coplanar_orientation(p, q, r, s);
|
||||
}
|
||||
|
||||
Orientation_sphere_1(const Point_2& sphere);
|
||||
|
||||
Comparison_result operator()(const Point_2& p, const Point_2& q) const
|
||||
{ return coplanar_orientation(_sphere,p,q);}
|
||||
|
||||
Comparison_result operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
|
||||
{ return coplanar_orientation(p,q,r,_sphere); }
|
||||
|
||||
Comparison_result operator()(const Point_2& p, const Point_2& q, const Point_2& r,const Point_2& s) const
|
||||
{ return coplanar_orientation(p,q,r,s);}
|
||||
|
||||
|
||||
protected :
|
||||
Point_2 _sphere;
|
||||
|
||||
public:
|
||||
typedef Comparison_result result_type;
|
||||
Point_2 _sphere;
|
||||
};
|
||||
|
||||
template < typename K >
|
||||
Orientation_sphere_1<K>::
|
||||
Orientation_sphere_1(const Point_2& sphere)
|
||||
: _sphere(sphere)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
: _sphere(sphere)
|
||||
{ }
|
||||
|
||||
template < typename K >
|
||||
class Orientation_sphere_2
|
||||
{
|
||||
public:
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Comparison_result Comparison_result;
|
||||
|
||||
typedef Comparison_result result_type;
|
||||
|
||||
Orientation_sphere_2(const Point_2& sphere);
|
||||
|
||||
Comparison_result operator()(const Point_2& p, const Point_2& q,
|
||||
const Point_2& r) const
|
||||
{ return orientation(_sphere,p,q,r);}
|
||||
|
||||
Comparison_result operator()(const Point_2& p, const Point_2& q,
|
||||
const Point_2& r, const Point_2 & s) const
|
||||
{return orientation(p,q,r,s);}
|
||||
|
||||
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef typename K::Comparison_result Comparison_result;
|
||||
|
||||
typedef Comparison_result result_type;
|
||||
|
||||
Orientation_sphere_2(const Point_2& sphere);
|
||||
|
||||
Comparison_result operator()(const Point_2& p, const Point_2& q,
|
||||
const Point_2& r) const
|
||||
{ return orientation(_sphere, p, q, r); }
|
||||
|
||||
Comparison_result operator()(const Point_2& p, const Point_2& q,
|
||||
const Point_2& r, const Point_2& s) const
|
||||
{ return orientation(p, q, r, s); }
|
||||
|
||||
protected :
|
||||
Point_2 _sphere;
|
||||
Point_2 _sphere;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template < typename K >
|
||||
Orientation_sphere_2<K>::
|
||||
Orientation_sphere_2(const Point_2& sphere)
|
||||
: _sphere(sphere)
|
||||
{}
|
||||
|
||||
|
||||
Orientation_sphere_2(const Point_2& sphere)
|
||||
: _sphere(sphere)
|
||||
{ }
|
||||
|
||||
template < typename K >
|
||||
class Coradial_sphere_2
|
||||
{
|
||||
public:
|
||||
typedef typename K::Point_2 Point_2;
|
||||
Coradial_sphere_2(const Point_2& sphere);
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef bool result_type;
|
||||
|
||||
Coradial_sphere_2(const Point_2& sphere);
|
||||
|
||||
bool operator()(const Point_2& p, const Point_2 q) const
|
||||
{
|
||||
return collinear(_sphere, p, q) &&
|
||||
(are_ordered_along_line(_sphere, p, q) ||
|
||||
are_ordered_along_line(_sphere, q, p));
|
||||
}
|
||||
|
||||
bool operator()(const Point_2& p, const Point_2 q) const
|
||||
{
|
||||
return collinear(_sphere,p,q) &&
|
||||
( are_ordered_along_line(_sphere,p,q) || are_ordered_along_line(_sphere,q,p) );
|
||||
}
|
||||
|
||||
protected :
|
||||
Point_2 _sphere;
|
||||
|
||||
|
||||
public:
|
||||
typedef bool result_type;
|
||||
Point_2 _sphere;
|
||||
};
|
||||
|
||||
|
||||
template < typename K >
|
||||
Coradial_sphere_2<K>::
|
||||
Coradial_sphere_2(const Point_2& sphere)
|
||||
: _sphere(sphere)
|
||||
{}
|
||||
|
||||
|
||||
: _sphere(sphere)
|
||||
{ }
|
||||
|
||||
template < typename K >
|
||||
class Inside_cone_2
|
||||
{
|
||||
public:
|
||||
typedef typename K::Point_2 Point_2;
|
||||
|
||||
Inside_cone_2(const Point_2& sphere);
|
||||
|
||||
bool operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
|
||||
{
|
||||
if( collinear(_sphere,p,r)||collinear(_sphere,q,r)||orientation(_sphere,p,q,r)!=COLLINEAR)
|
||||
return false;
|
||||
if( collinear(_sphere,p,q) )
|
||||
return true;
|
||||
return coplanar_orientation(_sphere,p,q,r) == ( POSITIVE==coplanar_orientation(_sphere,q,p,r) );
|
||||
}
|
||||
|
||||
typedef typename K::Point_2 Point_2;
|
||||
typedef bool result_type;
|
||||
|
||||
Inside_cone_2(const Point_2& sphere);
|
||||
|
||||
bool operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
|
||||
{
|
||||
if(collinear(_sphere, p, r) ||
|
||||
collinear(_sphere, q, r) ||
|
||||
orientation(_sphere, p, q, r) != COLLINEAR)
|
||||
return false;
|
||||
|
||||
if(collinear(_sphere, p, q))
|
||||
return true;
|
||||
|
||||
return coplanar_orientation(_sphere, p, q, r) ==
|
||||
(POSITIVE == coplanar_orientation(_sphere, q, p, r));
|
||||
}
|
||||
|
||||
protected :
|
||||
Point_2 _sphere;
|
||||
|
||||
public:
|
||||
typedef bool result_type;
|
||||
Point_2 _sphere;
|
||||
};
|
||||
|
||||
template < typename K >
|
||||
Inside_cone_2<K>::
|
||||
Inside_cone_2(const Point_2& sphere)
|
||||
: _sphere(sphere)
|
||||
{}
|
||||
|
||||
: _sphere(sphere)
|
||||
{ }
|
||||
|
||||
template < class R >
|
||||
class Delaunay_triangulation_sphere_traits_2
|
||||
: public R
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename R::Point_3 Point_2;
|
||||
typedef typename R::Point_3 Point_2;
|
||||
typedef typename R::Point_3 Weighted_point_2;
|
||||
typedef typename R::Ray_3 Ray_2;
|
||||
typedef typename R::Ray_3 Ray_2;
|
||||
typedef typename R::Line_3 Line_2;
|
||||
typedef typename R::Construct_ray_3 Construct_ray_3;
|
||||
typedef typename R::Construct_circumcenter_3 Construct_circumcenter_3;
|
||||
typedef typename R::Construct_bisector_3 Construct_bisector_3;
|
||||
typedef typename R::Construct_segment_3 Construct_segment_3;
|
||||
|
||||
typedef Delaunay_triangulation_sphere_traits_2<R> Self;
|
||||
typedef CGAL::Power_test_2<Self> Power_test_2;
|
||||
typedef CGAL::Orientation_sphere_2<Self> Orientation_2;
|
||||
typedef CGAL::Coradial_sphere_2<Self> Coradial_sphere_2;
|
||||
typedef CGAL::Inside_cone_2<Self> Inside_cone_2;
|
||||
//typedef CGAL::Orientation_sphere_1<Self> Orientation_1;
|
||||
typedef typename R::Coplanar_orientation_3 Orientation_1;
|
||||
typedef typename R::Compute_squared_distance_3 Compute_squared_distance_2;
|
||||
typedef typename R::Compare_xyz_3 Compare_xyz_3;
|
||||
|
||||
double _radius;
|
||||
|
||||
|
||||
typedef boost::true_type requires_test;
|
||||
void set_radius(double a){_radius = a;}
|
||||
|
||||
|
||||
Delaunay_triangulation_sphere_traits_2(const Point_2& sphere=Point_2(0,0,0));
|
||||
typedef Delaunay_triangulation_sphere_traits_2<R> Self;
|
||||
typedef CGAL::Power_test_2<Self> Power_test_2;
|
||||
typedef CGAL::Orientation_sphere_2<Self> Orientation_2;
|
||||
typedef CGAL::Coradial_sphere_2<Self> Coradial_sphere_2;
|
||||
typedef CGAL::Inside_cone_2<Self> Inside_cone_2;
|
||||
//typedef CGAL::Orientation_sphere_1<Self> Orientation_1;
|
||||
typedef typename R::Coplanar_orientation_3 Orientation_1;
|
||||
typedef typename R::Compute_squared_distance_3 Compute_squared_distance_2;
|
||||
typedef typename R::Compare_xyz_3 Compare_xyz_3;
|
||||
|
||||
typedef boost::true_type requires_test;
|
||||
|
||||
double _radius;
|
||||
|
||||
void set_radius(double a) { _radius = a; }
|
||||
|
||||
Delaunay_triangulation_sphere_traits_2(const Point_2& sphere = Point_2(0,0,0));
|
||||
Compare_xyz_3
|
||||
compare_xyz_3_object() const
|
||||
{return Compare_xyz_3();}
|
||||
|
||||
{ return Compare_xyz_3(); }
|
||||
|
||||
Compute_squared_distance_2
|
||||
compute_squared_distance_2_object() const
|
||||
{return Compute_squared_distance_2();}
|
||||
|
||||
{ return Compute_squared_distance_2(); }
|
||||
|
||||
Orientation_2
|
||||
orientation_2_object()const
|
||||
{return Orientation_2(_sphere);}
|
||||
orientation_2_object() const
|
||||
{ return Orientation_2(_sphere); }
|
||||
|
||||
Orientation_1
|
||||
orientation_1_object() const
|
||||
{return Orientation_1();}
|
||||
{ return Orientation_1(); }
|
||||
|
||||
Power_test_2
|
||||
Power_test_2
|
||||
power_test_2_object() const
|
||||
{return Power_test_2(_sphere);}
|
||||
{ return Power_test_2(_sphere); }
|
||||
|
||||
Coradial_sphere_2
|
||||
coradial_sphere_2_object() const
|
||||
{return Coradial_sphere_2(_sphere);}
|
||||
{ return Coradial_sphere_2(_sphere); }
|
||||
|
||||
Inside_cone_2
|
||||
inside_cone_2_object() const
|
||||
{return Inside_cone_2(_sphere);}
|
||||
|
||||
Construct_ray_3 construct_ray_2_object() const
|
||||
{return Construct_ray_3();}
|
||||
{ return Inside_cone_2(_sphere); }
|
||||
|
||||
Construct_circumcenter_3
|
||||
construct_circumcenter_2_object() const
|
||||
{ return Construct_circumcenter_3();}
|
||||
Construct_ray_3
|
||||
construct_ray_2_object() const
|
||||
{ return Construct_ray_3(); }
|
||||
|
||||
|
||||
Construct_segment_3
|
||||
construct_segment_2_object()const
|
||||
{return Construct_segment_3();}
|
||||
Construct_circumcenter_3
|
||||
construct_circumcenter_2_object() const
|
||||
{ return Construct_circumcenter_3(); }
|
||||
|
||||
Construct_segment_3
|
||||
construct_segment_2_object() const
|
||||
{ return Construct_segment_3(); }
|
||||
|
||||
Compute_squared_distance_2
|
||||
compute_squared_distance_3_object() const
|
||||
{ return Compute_squared_distance_2(); }
|
||||
|
||||
|
||||
Compute_squared_distance_2 compute_squared_distance_3_object() const
|
||||
{ return Compute_squared_distance_2(); }
|
||||
|
||||
protected :
|
||||
Point_2 _sphere;
|
||||
|
||||
};
|
||||
|
||||
template < class R >
|
||||
Delaunay_triangulation_sphere_traits_2<R> ::
|
||||
Delaunay_triangulation_sphere_traits_2(const Point_2& sphere)
|
||||
: _sphere(sphere)
|
||||
{}
|
||||
: _sphere(sphere)
|
||||
{ }
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_Reg_TRIANGULATION_SPHERE_TRAITS_2_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,231 +1,231 @@
|
|||
// Copyright (c) 1997, 2012, 2019 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the Licenxse, or (at your option) any later version.
|
||||
//
|
||||
// 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$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Mariette Yvinec, Claudia Werner
|
||||
|
||||
#ifndef CGAL_PROJECTION_SPHERE_TRAITS_3_H
|
||||
#define CGAL_PROJECTION_SPHERE_TRAITS_3_H
|
||||
|
||||
#include <CGAL/number_utils_classes.h>
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/Kernel_traits.h>
|
||||
#include <CGAL/Delaunay_triangulation_sphere_traits_2.h>
|
||||
namespace CGAL{template<typename K>
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
|
||||
#include <CGAL/number_utils_classes.h>
|
||||
#include <CGAL/Kernel_traits.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template<typename K>
|
||||
class Projection_sphere_traits_3;
|
||||
|
||||
template < typename K>
|
||||
class Projected_point
|
||||
: public K::Point_3{
|
||||
|
||||
|
||||
template < typename K>
|
||||
class Projected_point
|
||||
: public K::Point_3
|
||||
{
|
||||
public:
|
||||
typedef typename K::Point_3 Base_point;
|
||||
Projected_point()
|
||||
:Base_point(){}
|
||||
|
||||
typedef typename K::Point_3 Base_point;
|
||||
|
||||
Projected_point(const Base_point &p, const typename K::Point_3& sphere_center)
|
||||
:Base_point(p){compute_scale( p-(sphere_center-ORIGIN) );}
|
||||
|
||||
|
||||
public:
|
||||
double _scale;
|
||||
|
||||
void scale(){return _scale;}
|
||||
|
||||
private:
|
||||
void compute_scale(double x, double y, double z){
|
||||
double tmp = x*x+y*y+z*z;
|
||||
if (tmp == 0 )
|
||||
_scale = 0;
|
||||
|
||||
else
|
||||
_scale = 1/sqrt(tmp);
|
||||
}
|
||||
|
||||
void compute_scale(const Base_point &p){
|
||||
return compute_scale(p.x(), p.y(), p.z());
|
||||
Projected_point() : Base_point() { }
|
||||
Projected_point(const Base_point& p,
|
||||
const typename K::Point_3& sphere_center)
|
||||
: Base_point(p)
|
||||
{
|
||||
compute_scale(p-(sphere_center-ORIGIN));
|
||||
}
|
||||
|
||||
};
|
||||
//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:
|
||||
typedef Predicate_ Predicate;
|
||||
|
||||
typedef typename P::Point_2 Point;
|
||||
typedef typename K::Point_2 Base_point;
|
||||
Traits_with_projection_adaptor(Base_point sphere, double radius):_radius(radius), _sphere(sphere){}
|
||||
double _radius;
|
||||
Base_point _sphere ;
|
||||
|
||||
typedef typename Predicate::result_type result_type;
|
||||
|
||||
|
||||
result_type operator()(const Point& p0, const Point& p1)
|
||||
{return Predicate(_sphere)(project(p0), project(p1));}
|
||||
|
||||
|
||||
result_type operator()(const Point& p0, const Point& p1, const Point& p2)
|
||||
{return Predicate(_sphere)(project(p0), project(p1), project(p2));}
|
||||
|
||||
|
||||
result_type operator ()(const Point& p0, const Point& p1, const Point& p2, const Point& p3)
|
||||
{return Predicate(_sphere)(project(p0), project(p1), project(p2), project(p3));}
|
||||
|
||||
|
||||
result_type operator()(const Point& p0, const Point& p1, const Point& p2, const Point& p3, const Point& p4)
|
||||
{return Predicate(_sphere)(project(p0), project(p1), project(p2), project(p3), project(p4));}
|
||||
|
||||
|
||||
double _scale;
|
||||
|
||||
void scale() { return _scale; }
|
||||
|
||||
private:
|
||||
Base_point project (const Point& p){
|
||||
double scale = _radius*p._scale;
|
||||
return Base_point(scale*p.x(), scale*p.y(), scale*p.z());
|
||||
}
|
||||
void compute_scale(double x, double y, double z)
|
||||
{
|
||||
double tmp = x*x+y*y+z*z;
|
||||
if(tmp == 0)
|
||||
_scale = 0;
|
||||
else
|
||||
_scale = 1 / sqrt(tmp);
|
||||
}
|
||||
|
||||
void compute_scale(const Base_point& p)
|
||||
{
|
||||
return compute_scale(p.x(), p.y(), p.z());
|
||||
}
|
||||
};
|
||||
|
||||
//adaptor for calling the Predicate_ with the points projected on the sphere for predicates from the Kernel
|
||||
// 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_adaptorKernel {
|
||||
class Traits_with_projection_adaptor
|
||||
{
|
||||
public:
|
||||
typedef Predicate_ Predicate;
|
||||
typedef Predicate_ Predicate;
|
||||
|
||||
typedef typename P::Point_2 Point;
|
||||
typedef typename K::Point_3 Base_point;
|
||||
Traits_with_projection_adaptorKernel( double radius):_radius(radius){}
|
||||
double _radius;
|
||||
Base_point _sphere ;
|
||||
|
||||
typedef typename Predicate::result_type result_type;
|
||||
|
||||
|
||||
|
||||
result_type operator()(const Point& p0, const Point& p1)
|
||||
{return Predicate()(project(p0), project(p1));}
|
||||
typedef typename P::Point_2 Point;
|
||||
typedef typename K::Point_2 Base_point;
|
||||
|
||||
|
||||
result_type operator()(const Point& p0, const Point& p1, const Point& p2)
|
||||
{return Predicate()(project(p0), project(p1), project(p2));}
|
||||
Traits_with_projection_adaptor(Base_point sphere, double radius) : _radius(radius), _sphere(sphere) { }
|
||||
|
||||
|
||||
result_type operator ()(const Point& p0, const Point& p1, const Point& p2, const Point& p3)
|
||||
{return Predicate()(project(p0), project(p1), project(p2), project(p3));}
|
||||
double _radius;
|
||||
Base_point _sphere ;
|
||||
|
||||
|
||||
result_type operator()(const Point& p0, const Point& p1, const Point& p2, const Point& p3, const Point& p4)
|
||||
{return Predicate()(project(p0), project(p1), project(p2), project(p3), project(p4));}
|
||||
typedef typename Predicate::result_type result_type;
|
||||
|
||||
result_type operator()(const Point& p0, const Point& p1)
|
||||
{ return Predicate(_sphere)(project(p0), project(p1)); }
|
||||
|
||||
result_type operator()(const Point& p0, const Point& p1, const Point& p2)
|
||||
{ return Predicate(_sphere)(project(p0), project(p1), project(p2)); }
|
||||
|
||||
result_type operator ()(const Point& p0, const Point& p1, const Point& p2, const Point& p3)
|
||||
{ return Predicate(_sphere)(project(p0), project(p1), project(p2), project(p3)); }
|
||||
|
||||
result_type operator()(const Point& p0, const Point& p1, const Point& p2, const Point& p3, const Point& p4)
|
||||
{ return Predicate(_sphere)(project(p0), project(p1), project(p2), project(p3), project(p4)); }
|
||||
|
||||
|
||||
private:
|
||||
Base_point project (const Point& p){
|
||||
double scale = _radius*p._scale;
|
||||
return Base_point(scale*p.x(), scale*p.y(), scale*p.z());
|
||||
}
|
||||
Base_point project (const Point& p)
|
||||
{
|
||||
double scale = _radius * p._scale;
|
||||
return Base_point(scale*p.x(), scale*p.y(), scale*p.z());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
//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:
|
||||
typedef Predicate_ Predicate;
|
||||
|
||||
typedef typename P::Point_2 Point;
|
||||
typedef typename K::Point_3 Base_point;
|
||||
|
||||
Traits_with_projection_adaptorKernel(double radius) : _radius(radius) { }
|
||||
|
||||
double _radius;
|
||||
Base_point _sphere;
|
||||
|
||||
typedef typename Predicate::result_type result_type;
|
||||
|
||||
result_type operator()(const Point& p0, const Point& p1)
|
||||
{ return Predicate()(project(p0), project(p1)); }
|
||||
|
||||
result_type operator()(const Point& p0, const Point& p1, const Point& p2)
|
||||
{ return Predicate()(project(p0), project(p1), project(p2)); }
|
||||
|
||||
result_type operator ()(const Point& p0, const Point& p1, const Point& p2, const Point& p3)
|
||||
{ return Predicate()(project(p0), project(p1), project(p2), project(p3)); }
|
||||
|
||||
result_type operator()(const Point& p0, const Point& p1, const Point& p2, const Point& p3, const Point& p4)
|
||||
{ return Predicate()(project(p0), project(p1), project(p2), project(p3), project(p4)); }
|
||||
|
||||
private:
|
||||
Base_point project (const Point& p)
|
||||
{
|
||||
double scale = _radius * p._scale;
|
||||
return Base_point(scale*p.x(), scale*p.y(), scale*p.z());
|
||||
}
|
||||
};
|
||||
|
||||
template < class R >
|
||||
class Projection_sphere_traits_3
|
||||
: public R
|
||||
: public R
|
||||
{
|
||||
protected:
|
||||
|
||||
|
||||
public:
|
||||
double _radius;
|
||||
typedef Projection_sphere_traits_3<R> Self;
|
||||
typedef Delaunay_triangulation_sphere_traits_2<R> Base;
|
||||
typedef typename Projected_point<R>::Projected_point Point_2;
|
||||
typedef typename R::Point_3 Base_point;
|
||||
typedef Projection_sphere_traits_3<R> Self;
|
||||
typedef Delaunay_triangulation_sphere_traits_2<R> Base;
|
||||
typedef typename Projected_point<R>::Projected_point Point_2;
|
||||
typedef typename R::Point_3 Base_point;
|
||||
|
||||
typedef Point_2 result_type;
|
||||
|
||||
typedef Traits_with_projection_adaptor<Base,Self,typename Base::Power_test_2>
|
||||
Power_test_2;
|
||||
typedef Traits_with_projection_adaptor<Base, Self,typename Base::Orientation_2>
|
||||
Orientation_2;
|
||||
typedef Traits_with_projection_adaptor<Base,Self, typename Base::Coradial_sphere_2 >
|
||||
Coradial_sphere_2;
|
||||
typedef Traits_with_projection_adaptor<Base,Self,typename Base::Inside_cone_2 >
|
||||
Inside_cone_2;
|
||||
typedef Traits_with_projection_adaptorKernel<R,Self,typename Base::Orientation_1 >
|
||||
Orientation_1;
|
||||
typedef Traits_with_projection_adaptorKernel<R, Self , typename Base ::Compute_squared_distance_2>
|
||||
Compute_squared_distance_2;
|
||||
typedef Traits_with_projection_adaptorKernel<R , Self, typename Base::Compare_xyz_3>
|
||||
Compare_xyz_3;
|
||||
typedef Point_2 result_type;
|
||||
|
||||
|
||||
typedef boost::false_type requires_test;
|
||||
|
||||
void set_radius(double radius){ _radius = radius;}
|
||||
|
||||
Projection_sphere_traits_3(const Base_point& sphere=Base_point(0,0,0), double radius = 1);
|
||||
typedef Traits_with_projection_adaptor<Base, Self, typename Base::Power_test_2> Power_test_2;
|
||||
typedef Traits_with_projection_adaptor<Base, Self, typename Base::Orientation_2> Orientation_2;
|
||||
typedef Traits_with_projection_adaptor<Base, Self, typename Base::Coradial_sphere_2 > Coradial_sphere_2;
|
||||
typedef Traits_with_projection_adaptor<Base, Self, typename Base::Inside_cone_2 > Inside_cone_2;
|
||||
typedef Traits_with_projection_adaptorKernel<R, Self, typename Base::Orientation_1 > Orientation_1;
|
||||
typedef Traits_with_projection_adaptorKernel<R, Self, typename Base ::Compute_squared_distance_2> Compute_squared_distance_2;
|
||||
typedef Traits_with_projection_adaptorKernel<R, Self, typename Base::Compare_xyz_3> Compare_xyz_3;
|
||||
|
||||
|
||||
|
||||
Orientation_2
|
||||
orientation_2_object()const
|
||||
{return Orientation_2(_sphere, _radius);}
|
||||
|
||||
Orientation_1
|
||||
orientation_1_object() const
|
||||
{return Orientation_1( _radius);}
|
||||
|
||||
Power_test_2
|
||||
power_test_2_object() const
|
||||
{ return Power_test_2(_sphere, _radius);}
|
||||
|
||||
Coradial_sphere_2
|
||||
coradial_sphere_2_object() const
|
||||
{return Coradial_sphere_2(_sphere, _radius);}
|
||||
|
||||
Inside_cone_2
|
||||
inside_cone_2_object() const
|
||||
{return Inside_cone_2(_sphere, _radius);}
|
||||
|
||||
Compute_squared_distance_2
|
||||
compute_squared_distance_3_object() const
|
||||
{ return Compute_squared_distance_2( _radius);}
|
||||
|
||||
Compare_xyz_3
|
||||
compare_xyz_3_object()const
|
||||
{return Compare_xyz_3(_radius);}
|
||||
typedef boost::false_type requires_test;
|
||||
|
||||
struct Construct_projected_point_3
|
||||
: public std::unary_function<Base_point,Point_2>
|
||||
{
|
||||
const Base_point& sphere_center;
|
||||
void set_radius(double radius) { _radius = radius; }
|
||||
|
||||
Point_2 operator()(const Base_point& pt) const
|
||||
{ return Point_2(pt, sphere_center); }
|
||||
Projection_sphere_traits_3(const Base_point& sphere=Base_point(0,0,0), double radius = 1);
|
||||
|
||||
Construct_projected_point_3(const Base_point& sc)
|
||||
:sphere_center(sc) {}
|
||||
};
|
||||
Orientation_2
|
||||
orientation_2_object() const
|
||||
{ return Orientation_2(_sphere, _radius); }
|
||||
|
||||
Construct_projected_point_3
|
||||
construct_projected_point_3_object() const {
|
||||
return Construct_projected_point_3(_sphere);
|
||||
};
|
||||
Orientation_1
|
||||
orientation_1_object() const
|
||||
{ return Orientation_1(_radius); }
|
||||
|
||||
Power_test_2
|
||||
power_test_2_object() const
|
||||
{ return Power_test_2(_sphere, _radius); }
|
||||
|
||||
Coradial_sphere_2
|
||||
coradial_sphere_2_object() const
|
||||
{ return Coradial_sphere_2(_sphere, _radius); }
|
||||
|
||||
Inside_cone_2
|
||||
inside_cone_2_object() const
|
||||
{ return Inside_cone_2(_sphere, _radius); }
|
||||
|
||||
Compute_squared_distance_2
|
||||
compute_squared_distance_3_object() const
|
||||
{ return Compute_squared_distance_2(_radius); }
|
||||
|
||||
Compare_xyz_3
|
||||
compare_xyz_3_object() const
|
||||
{ return Compare_xyz_3(_radius); }
|
||||
|
||||
struct Construct_projected_point_3
|
||||
: public std::unary_function<Base_point,Point_2>
|
||||
{
|
||||
const Base_point& sphere_center;
|
||||
|
||||
Point_2 operator()(const Base_point& pt) const { return Point_2(pt, sphere_center); }
|
||||
|
||||
Construct_projected_point_3(const Base_point& sc) : sphere_center(sc) { }
|
||||
};
|
||||
|
||||
Construct_projected_point_3
|
||||
construct_projected_point_3_object() const
|
||||
{ return Construct_projected_point_3(_sphere); }
|
||||
|
||||
protected :
|
||||
Base_point _sphere;
|
||||
|
||||
|
||||
Base_point _sphere;
|
||||
};
|
||||
|
||||
template < class R >
|
||||
Projection_sphere_traits_3<R> ::
|
||||
Projection_sphere_traits_3(const Base_point& sphere, double radius)
|
||||
: _radius(radius), _sphere(sphere)
|
||||
{}
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
: _radius(radius), _sphere(sphere)
|
||||
{ }
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_PROJECTION_SPHERE_TRAITS_3_H
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
// Copyright (c) 1997 INRIA Sophia-Antipolis (France).
|
||||
// Copyright (c) 1997, 2012, 2019 INRIA Sophia-Antipolis (France).
|
||||
// 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.
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the Licenxse, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
|
|
@ -11,28 +12,23 @@
|
|||
// 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://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.4-branch/Triangulation_2/include/CGAL/Triangulation_face_base_sphere_2.h $
|
||||
// $Id: Triangulation_face_base_sphere_2.h 28567 2006-02-16 14:30:13Z lsaboret $
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Mariette Yvinec, Claudia Werner
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_FACE_BASE_SPHERE_2_H
|
||||
#define CGAL_TRIANGULATION_FACE_BASE_SPHERE_2_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/Triangulation_ds_face_base_2.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGAL {
|
||||
|
||||
template < typename Gt, typename Fb = Triangulation_ds_face_base_2<> >
|
||||
class Triangulation_face_base_sphere_2
|
||||
class Triangulation_face_base_sphere_2
|
||||
: public Fb
|
||||
{
|
||||
protected:
|
||||
bool _ghost;
|
||||
|
||||
public:
|
||||
typedef Gt Geom_traits;
|
||||
typedef typename Fb::Vertex_handle Vertex_handle;
|
||||
|
|
@ -41,76 +37,48 @@ public:
|
|||
template < typename TDS2 >
|
||||
struct Rebind_TDS {
|
||||
typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2;
|
||||
typedef Triangulation_face_base_sphere_2<Gt, Fb2> Other;
|
||||
typedef Triangulation_face_base_sphere_2<Gt, Fb2> Other;
|
||||
};
|
||||
unsigned char _in_conflict_flag;
|
||||
|
||||
unsigned char _in_conflict_flag;
|
||||
|
||||
public:
|
||||
void set_in_conflict_flag(unsigned char f) { _in_conflict_flag = f; }
|
||||
unsigned char get_in_conflict_flag() const { return _in_conflict_flag; }
|
||||
|
||||
public:
|
||||
Triangulation_face_base_sphere_2()
|
||||
: Fb(),_ghost(false) {
|
||||
set_in_conflict_flag(0);
|
||||
}
|
||||
|
||||
Triangulation_face_base_sphere_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2)
|
||||
: Fb(v0,v1,v2),_ghost(false) {
|
||||
set_in_conflict_flag(0);
|
||||
}
|
||||
|
||||
Triangulation_face_base_sphere_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2)
|
||||
: Fb(v0,v1,v2,n0,n1,n2),_ghost(false) {
|
||||
: Fb(), _ghost(false)
|
||||
{
|
||||
set_in_conflict_flag(0);
|
||||
}
|
||||
}
|
||||
|
||||
Triangulation_face_base_sphere_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2)
|
||||
: Fb(v0, v1, v2), _ghost(false)
|
||||
{
|
||||
set_in_conflict_flag(0);
|
||||
}
|
||||
|
||||
Triangulation_face_base_sphere_2(Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2)
|
||||
: Fb(v0, v1, v2, n0, n1, n2), _ghost(false)
|
||||
{
|
||||
set_in_conflict_flag(0);
|
||||
}
|
||||
|
||||
static int ccw(int i) {return Triangulation_cw_ccw_2::ccw(i);}
|
||||
static int cw(int i) {return Triangulation_cw_ccw_2::cw(i);}
|
||||
const bool& is_ghost() const { return _ghost; }
|
||||
bool& ghost() { return _ghost; }
|
||||
|
||||
#ifndef CGAL_NO_DEPRECATED_CODE
|
||||
Vertex_handle mirror_vertex(int i) const;
|
||||
int mirror_index(int i) const;
|
||||
#endif
|
||||
bool& ghost() { return _ghost; }
|
||||
|
||||
protected:
|
||||
bool _ghost;
|
||||
};
|
||||
|
||||
#ifndef CGAL_NO_DEPRECATED_CODE
|
||||
template < class Gt, class Fb >
|
||||
inline
|
||||
typename Triangulation_face_base_sphere_2<Gt,Fb>::Vertex_handle
|
||||
Triangulation_face_base_sphere_2<Gt,Fb>::
|
||||
mirror_vertex(int i) const
|
||||
{
|
||||
CGAL_triangulation_precondition ( this->neighbor(i) != Face_handle()
|
||||
&& this->dimension() >= 1);
|
||||
//return neighbor(i)->vertex(neighbor(i)->index(this->handle()));
|
||||
return this->neighbor(i)->vertex(mirror_index(i));
|
||||
}
|
||||
|
||||
template < class Gt, class Fb >
|
||||
inline int
|
||||
Triangulation_face_base_sphere_2<Gt,Fb>::
|
||||
mirror_index(int i) const
|
||||
{
|
||||
// return the index of opposite vertex in neighbor(i);
|
||||
CGAL_triangulation_precondition (this->neighbor(i) != Face_handle() &&
|
||||
this->dimension() >= 1);
|
||||
if (this->dimension() == 1) {
|
||||
return 1 - (this->neighbor(i)->index(this->vertex(1-i)));
|
||||
}
|
||||
return this->ccw( this->neighbor(i)->index(this->vertex(this->ccw(i))));
|
||||
}
|
||||
#endif
|
||||
|
||||
} //namespace CGAL
|
||||
} // namespace CGAL
|
||||
|
||||
#endif //CGAL_Triangulation_face_base_sphere_2_H
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 1997 INRIA Sophia-Antipolis (France).
|
||||
// Copyright (c) 1997, 2O12, 2019 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Claudia Werner, Mariette Yvinec
|
||||
|
||||
|
|
@ -23,344 +23,346 @@
|
|||
namespace CGAL{
|
||||
template <class Triangulation_>
|
||||
class Triangulation_sphere_line_face_circulator_2
|
||||
:public Bidirectional_circulator_base<typename Triangulation_::Triangulation_data_structure::Face,
|
||||
std::size_t>,
|
||||
public Triangulation_cw_ccw_2
|
||||
: public Bidirectional_circulator_base<
|
||||
typename Triangulation_::Triangulation_data_structure::Face,
|
||||
std::size_t>,
|
||||
public Triangulation_cw_ccw_2
|
||||
{
|
||||
public:
|
||||
typedef Triangulation_sphere_line_face_circulator_2<Triangulation_> Line_face_circulator;
|
||||
typedef Triangulation_ Triangulation;
|
||||
typedef typename Triangulation::Geom_traits Gt;
|
||||
typedef typename Triangulation_::Triangulation_data_structure Tds;
|
||||
typedef typename Tds::Vertex Vertex;
|
||||
typedef typename Tds::Face Face;
|
||||
typedef typename Tds::Edge Edge;
|
||||
typedef typename Tds::Vertex_handle Vertex_handle;
|
||||
typedef typename Tds::Face_handle Face_handle;
|
||||
typedef typename Tds::Face_circulator Face_circulator;
|
||||
|
||||
typedef typename Gt::Point_2 Point;
|
||||
typedef typename Triangulation::Locate_type Locate_type;
|
||||
|
||||
|
||||
enum State {undefined = -1,
|
||||
vertex_vertex,
|
||||
vertex_edge,
|
||||
edge_vertex,
|
||||
edge_edge};
|
||||
|
||||
typedef Triangulation_sphere_line_face_circulator_2<Triangulation_> Line_face_circulator;
|
||||
typedef Triangulation_ Triangulation;
|
||||
typedef typename Triangulation::Geom_traits Gt;
|
||||
typedef typename Triangulation_::Triangulation_data_structure Tds;
|
||||
|
||||
typedef typename Tds::Vertex Vertex;
|
||||
typedef typename Tds::Face Face;
|
||||
typedef typename Tds::Edge Edge;
|
||||
typedef typename Tds::Vertex_handle Vertex_handle;
|
||||
typedef typename Tds::Face_handle Face_handle;
|
||||
typedef typename Tds::Face_circulator Face_circulator;
|
||||
|
||||
typedef typename Gt::Point_2 Point;
|
||||
typedef typename Triangulation::Locate_type Locate_type;
|
||||
|
||||
enum State {undefined = -1,
|
||||
vertex_vertex,
|
||||
vertex_edge,
|
||||
edge_vertex,
|
||||
edge_edge};
|
||||
|
||||
private:
|
||||
Face_handle pos;
|
||||
const Triangulation* _tr;
|
||||
State s;
|
||||
int i;
|
||||
Point p, q;
|
||||
|
||||
Face_handle pos;
|
||||
const Triangulation* _tr;
|
||||
State s;
|
||||
int i;
|
||||
Point p, q;
|
||||
|
||||
public:
|
||||
Triangulation_sphere_line_face_circulator_2()
|
||||
Triangulation_sphere_line_face_circulator_2()
|
||||
: pos(), _tr(NULL), s(undefined), i(-1)
|
||||
{}
|
||||
|
||||
Triangulation_sphere_line_face_circulator_2(Vertex_handle v,
|
||||
const Triangulation* tr,
|
||||
const Point& dir);
|
||||
|
||||
|
||||
Line_face_circulator& operator++() ;
|
||||
Line_face_circulator& operator--() ;
|
||||
Line_face_circulator operator++(int);
|
||||
Line_face_circulator operator--(int);
|
||||
Face* operator->() {return &*pos;}
|
||||
Face& operator*() { return *pos;}
|
||||
Face_handle handle() {return pos;}
|
||||
operator const Face_handle() const {return pos;}
|
||||
bool operator==(const Line_face_circulator& lfc) const;
|
||||
bool operator!=(const Line_face_circulator& lfc) const;
|
||||
|
||||
bool operator==(const Face_handle& fh) const { return fh == pos; }
|
||||
bool operator!=(const Face_handle& fh) const { return fh != pos; }
|
||||
|
||||
bool operator==(Nullptr_t CGAL_triangulation_assertion_code(n)) const;
|
||||
bool operator!=(Nullptr_t n) const;
|
||||
bool is_empty() const;
|
||||
bool locate(const Point& t, Locate_type <, int &li);
|
||||
|
||||
//private:
|
||||
Triangulation_sphere_line_face_circulator_2(const Face_handle& face,
|
||||
int index,
|
||||
State state,
|
||||
const Triangulation * t,
|
||||
const Point& pp,
|
||||
const Point& qq);
|
||||
{ }
|
||||
|
||||
Triangulation_sphere_line_face_circulator_2(Vertex_handle v,
|
||||
const Triangulation* tr,
|
||||
const Point& dir);
|
||||
|
||||
Line_face_circulator& operator++() ;
|
||||
Line_face_circulator& operator--() ;
|
||||
Line_face_circulator operator++(int);
|
||||
Line_face_circulator operator--(int);
|
||||
Face* operator->() { return &*pos; }
|
||||
Face& operator*() { return *pos; }
|
||||
Face_handle handle() { return pos; }
|
||||
|
||||
operator const Face_handle() const { return pos; }
|
||||
bool operator==(const Line_face_circulator& lfc) const;
|
||||
bool operator!=(const Line_face_circulator& lfc) const;
|
||||
|
||||
bool operator==(const Face_handle& fh) const { return fh == pos; }
|
||||
bool operator!=(const Face_handle& fh) const { return fh != pos; }
|
||||
|
||||
bool operator==(Nullptr_t CGAL_triangulation_assertion_code(n)) const;
|
||||
bool operator!=(Nullptr_t n) const;
|
||||
bool is_empty() const;
|
||||
bool locate(const Point& t, Locate_type <, int &li);
|
||||
|
||||
//private:
|
||||
Triangulation_sphere_line_face_circulator_2(const Face_handle& face,
|
||||
int index,
|
||||
State state,
|
||||
const Triangulation * t,
|
||||
const Point& pp,
|
||||
const Point& qq);
|
||||
private:
|
||||
void increment();
|
||||
void decrement();
|
||||
void increment();
|
||||
void decrement();
|
||||
};
|
||||
|
||||
template < class Triangulation >
|
||||
inline
|
||||
bool
|
||||
operator==(typename Triangulation::Triangulation_data_structure::Face_handle fh,
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation> fc)
|
||||
{
|
||||
return (fc==fh);
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline
|
||||
bool
|
||||
operator!=(typename Triangulation::Triangulation_data_structure::Face_handle fh,
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation> fc)
|
||||
{
|
||||
return (fc!=fh);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template < class Triangulation >
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
Triangulation_sphere_line_face_circulator_2(Vertex_handle v,
|
||||
const Triangulation* tr,
|
||||
const Point& dir)
|
||||
:pos(), _tr(tr), s(undefined)
|
||||
// begin at the face incident to v, traversed by the ray from v to dir
|
||||
// or null iterator
|
||||
{
|
||||
CGAL_triangulation_precondition((_tr->dimension() == 2) &&
|
||||
(! _tr->xy_equal(v->point(),dir)));
|
||||
p=v->point();
|
||||
q=dir;
|
||||
|
||||
// find a vertex to the left of pq
|
||||
// if there is no, the line_face_circulator is null
|
||||
Face_circulator fc = _tr->incident_faces(v);
|
||||
Face_circulator done(fc);
|
||||
int ic = fc->index(v);
|
||||
Vertex_handle vt= fc->vertex(cw(ic));
|
||||
//Orientation o = _tr->orientation(p, q, vt->point());
|
||||
while( _tr->orientation(p, q, vt->point()) != LEFT_TURN) {
|
||||
++fc;
|
||||
ic = fc->index(v);
|
||||
vt= fc->vertex(cw(ic));
|
||||
if (fc == done) { *this = Line_face_circulator(); return;}
|
||||
}
|
||||
|
||||
Vertex_handle vr = fc-> vertex(ccw(ic));
|
||||
Orientation pqr = RIGHT_TURN; // warning "pqr might be used uninitialized"
|
||||
while ( (pqr = _tr->orientation(p, q, vr->point()))== LEFT_TURN ) {
|
||||
--fc;
|
||||
ic = fc->index(v);
|
||||
vr = fc-> vertex(ccw(ic));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// first intersected face found
|
||||
// [pqr] is COLLINEAR or RIGHT_TURN
|
||||
ic = fc->index(v);
|
||||
vt= fc->vertex(cw(ic));
|
||||
CGAL_triangulation_assertion (_tr->orientation(p,q, vt->point())==
|
||||
LEFT_TURN );
|
||||
|
||||
if (pqr == COLLINEAR) {
|
||||
pos = fc;
|
||||
s = vertex_vertex;
|
||||
i = ccw(ic);
|
||||
}
|
||||
else { // pqr==RIGHT_TURN
|
||||
pos = fc;
|
||||
s = vertex_edge;
|
||||
i = ic ;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template < class Triangulation >
|
||||
inline
|
||||
void
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
increment()
|
||||
{
|
||||
CGAL_triangulation_precondition(pos != Face_handle());
|
||||
if(s == vertex_vertex || s == edge_vertex) {
|
||||
Orientation o;
|
||||
do{
|
||||
Face_handle n = pos->neighbor(cw(i));
|
||||
i = n->index(pos);
|
||||
pos = n;
|
||||
|
||||
o = _tr->orientation(p, q, pos->vertex(i)->point());
|
||||
i = cw(i);
|
||||
}while(o == LEFT_TURN);
|
||||
|
||||
if(o == COLLINEAR) {
|
||||
s = vertex_vertex;
|
||||
i = ccw(i);
|
||||
}
|
||||
else {
|
||||
s = vertex_edge;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Face_handle n = pos->neighbor(i);
|
||||
int ni = n->index(pos);
|
||||
pos = n ;
|
||||
Orientation o = _tr->orientation(p,q,pos->vertex(ni)->point());
|
||||
|
||||
switch(o){
|
||||
case LEFT_TURN:
|
||||
s = edge_edge;
|
||||
i = ccw(ni);
|
||||
break;
|
||||
case RIGHT_TURN:
|
||||
s = edge_edge;
|
||||
i = cw(ni);
|
||||
break;
|
||||
default:
|
||||
s = edge_vertex;
|
||||
i = ni;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
void
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
decrement()
|
||||
{
|
||||
CGAL_triangulation_precondition(pos != Face_handle());
|
||||
if(s == vertex_vertex || s == vertex_edge) {
|
||||
if(s == vertex_vertex){
|
||||
i = cw(i);
|
||||
}
|
||||
Orientation o;
|
||||
do{
|
||||
Face_handle n = pos->neighbor(ccw(i));
|
||||
i = n->index(pos);
|
||||
pos = n;
|
||||
|
||||
o = _tr->orientation(p, q, pos->vertex(i)->point());
|
||||
i = ccw(i);
|
||||
}while(o == LEFT_TURN);
|
||||
|
||||
s = (o == COLLINEAR) ? vertex_vertex : edge_vertex;
|
||||
|
||||
}
|
||||
else { // s == edge_edge || s == edge_vertex
|
||||
// the following is not nice. A better solution is to say
|
||||
// that index i is at the vertex that is alone on one side of l(p,q)
|
||||
if(s == edge_edge){
|
||||
i = (_tr->orientation
|
||||
(p, q,
|
||||
pos->vertex(i)->point()) ==
|
||||
LEFT_TURN)
|
||||
? cw(i) : ccw(i);
|
||||
}
|
||||
Face_handle n = pos->neighbor(i);
|
||||
i = n->index(pos);
|
||||
pos = n;
|
||||
Orientation o = _tr->orientation(p, q, pos->vertex(i)->point());
|
||||
|
||||
s = (o == COLLINEAR) ? vertex_edge : edge_edge;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template < class Triangulation >
|
||||
inline
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>&
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator++()
|
||||
{
|
||||
CGAL_triangulation_precondition( pos != Face_handle()) ;
|
||||
increment();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>&
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator--()
|
||||
{
|
||||
CGAL_triangulation_precondition(pos != Face_handle()) ;
|
||||
decrement();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator++(int)
|
||||
{
|
||||
Line_face_circulator tmp(*this);
|
||||
++(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator--(int)
|
||||
{
|
||||
Line_face_circulator tmp(*this);
|
||||
--(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline bool
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator==(const Line_face_circulator& lfc) const
|
||||
{
|
||||
CGAL_triangulation_precondition( pos != Face_handle() &&
|
||||
lfc.pos != Face_handle());
|
||||
return ( pos == lfc.pos && _tr == lfc._tr &&
|
||||
s== lfc.s && p==lfc.p && q==lfc.q);
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline bool
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator!=(const Line_face_circulator& lfc) const
|
||||
{
|
||||
return !(*this == lfc);
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline bool
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
is_empty() const
|
||||
{
|
||||
return pos == Face_handle();
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline bool
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator==(Nullptr_t CGAL_triangulation_assertion_code(n)) const
|
||||
{
|
||||
CGAL_triangulation_assertion( n == NULL);
|
||||
return pos == Face_handle();
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline bool
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator!=(Nullptr_t n) const
|
||||
{
|
||||
CGAL_triangulation_assertion( n == NULL);
|
||||
return !(*this == n);
|
||||
}
|
||||
|
||||
|
||||
}//namespace
|
||||
template < class Triangulation >
|
||||
inline
|
||||
bool
|
||||
operator==(typename Triangulation::Triangulation_data_structure::Face_handle fh,
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation> fc)
|
||||
{
|
||||
return (fc == fh);
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline
|
||||
bool
|
||||
operator!=(typename Triangulation::Triangulation_data_structure::Face_handle fh,
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation> fc)
|
||||
{
|
||||
return (fc != fh);
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
Triangulation_sphere_line_face_circulator_2(Vertex_handle v,
|
||||
const Triangulation* tr,
|
||||
const Point& dir)
|
||||
:pos(), _tr(tr), s(undefined)
|
||||
// begin at the face incident to v, traversed by the ray from v to dir
|
||||
// or null iterator
|
||||
{
|
||||
CGAL_triangulation_precondition((_tr->dimension() == 2) &&
|
||||
(! _tr->xy_equal(v->point(), dir)));
|
||||
p = v->point();
|
||||
q = dir;
|
||||
|
||||
// find a vertex to the left of pq
|
||||
// if there is no, the line_face_circulator is null
|
||||
Face_circulator fc = _tr->incident_faces(v);
|
||||
Face_circulator done(fc);
|
||||
int ic = fc->index(v);
|
||||
Vertex_handle vt = fc->vertex(cw(ic));
|
||||
//Orientation o = _tr->orientation(p, q, vt->point());
|
||||
while( _tr->orientation(p, q, vt->point()) != LEFT_TURN)
|
||||
{
|
||||
++fc;
|
||||
ic = fc->index(v);
|
||||
vt= fc->vertex(cw(ic));
|
||||
|
||||
if(fc == done)
|
||||
{
|
||||
*this = Line_face_circulator();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Vertex_handle vr = fc-> vertex(ccw(ic));
|
||||
Orientation pqr = RIGHT_TURN; // warning "pqr might be used uninitialized"
|
||||
while((pqr = _tr->orientation(p, q, vr->point())) == LEFT_TURN)
|
||||
{
|
||||
--fc;
|
||||
ic = fc->index(v);
|
||||
vr = fc-> vertex(ccw(ic));
|
||||
}
|
||||
|
||||
// first intersected face found
|
||||
// [pqr] is COLLINEAR or RIGHT_TURN
|
||||
ic = fc->index(v);
|
||||
vt= fc->vertex(cw(ic));
|
||||
CGAL_triangulation_assertion (_tr->orientation(p, q, vt->point()) == LEFT_TURN);
|
||||
|
||||
if(pqr == COLLINEAR)
|
||||
{
|
||||
pos = fc;
|
||||
s = vertex_vertex;
|
||||
i = ccw(ic);
|
||||
}
|
||||
else // pqr == RIGHT_TURN
|
||||
{
|
||||
pos = fc;
|
||||
s = vertex_edge;
|
||||
i = ic ;
|
||||
}
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline
|
||||
void
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
increment()
|
||||
{
|
||||
CGAL_triangulation_precondition(pos != Face_handle());
|
||||
if(s == vertex_vertex || s == edge_vertex)
|
||||
{
|
||||
Orientation o;
|
||||
do
|
||||
{
|
||||
Face_handle n = pos->neighbor(cw(i));
|
||||
i = n->index(pos);
|
||||
pos = n;
|
||||
|
||||
o = _tr->orientation(p, q, pos->vertex(i)->point());
|
||||
i = cw(i);
|
||||
} while(o == LEFT_TURN);
|
||||
|
||||
if(o == COLLINEAR)
|
||||
{
|
||||
s = vertex_vertex;
|
||||
i = ccw(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
s = vertex_edge;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Face_handle n = pos->neighbor(i);
|
||||
int ni = n->index(pos);
|
||||
pos = n ;
|
||||
Orientation o = _tr->orientation(p, q, pos->vertex(ni)->point());
|
||||
|
||||
switch(o)
|
||||
{
|
||||
case LEFT_TURN:
|
||||
s = edge_edge;
|
||||
i = ccw(ni);
|
||||
break;
|
||||
case RIGHT_TURN:
|
||||
s = edge_edge;
|
||||
i = cw(ni);
|
||||
break;
|
||||
default:
|
||||
s = edge_vertex;
|
||||
i = ni;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
void
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
decrement()
|
||||
{
|
||||
CGAL_triangulation_precondition(pos != Face_handle());
|
||||
if(s == vertex_vertex || s == vertex_edge)
|
||||
{
|
||||
if(s == vertex_vertex)
|
||||
i = cw(i);
|
||||
|
||||
Orientation o;
|
||||
do
|
||||
{
|
||||
Face_handle n = pos->neighbor(ccw(i));
|
||||
i = n->index(pos);
|
||||
pos = n;
|
||||
|
||||
o = _tr->orientation(p, q, pos->vertex(i)->point());
|
||||
i = ccw(i);
|
||||
}
|
||||
while(o == LEFT_TURN);
|
||||
|
||||
s = (o == COLLINEAR) ? vertex_vertex : edge_vertex;
|
||||
|
||||
}
|
||||
else // s == edge_edge || s == edge_vertex
|
||||
{
|
||||
// the following is not nice. A better solution is to say
|
||||
// that index i is at the vertex that is alone on one side of l(p, q)
|
||||
if(s == edge_edge)
|
||||
i = (_tr->orientation(p, q, pos->vertex(i)->point()) == LEFT_TURN) ? cw(i) : ccw(i);
|
||||
|
||||
Face_handle n = pos->neighbor(i);
|
||||
i = n->index(pos);
|
||||
pos = n;
|
||||
Orientation o = _tr->orientation(p, q, pos->vertex(i)->point());
|
||||
|
||||
s = (o == COLLINEAR) ? vertex_edge : edge_edge;
|
||||
}
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>&
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator++()
|
||||
{
|
||||
CGAL_triangulation_precondition(pos != Face_handle()) ;
|
||||
increment();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>&
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator--()
|
||||
{
|
||||
CGAL_triangulation_precondition(pos != Face_handle()) ;
|
||||
decrement();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator++(int)
|
||||
{
|
||||
Line_face_circulator tmp(*this);
|
||||
++(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator--(int)
|
||||
{
|
||||
Line_face_circulator tmp(*this);
|
||||
--(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline bool
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator==(const Line_face_circulator& lfc) const
|
||||
{
|
||||
CGAL_triangulation_precondition(pos != Face_handle() && lfc.pos != Face_handle());
|
||||
return (pos == lfc.pos && _tr == lfc._tr &&
|
||||
s == lfc.s && p==lfc.p && q==lfc.q);
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline bool
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator!=(const Line_face_circulator& lfc) const
|
||||
{
|
||||
return !(*this == lfc);
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline bool
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
is_empty() const
|
||||
{
|
||||
return pos == Face_handle();
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline bool
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator==(Nullptr_t CGAL_triangulation_assertion_code(n)) const
|
||||
{
|
||||
CGAL_triangulation_assertion(n == NULL);
|
||||
return pos == Face_handle();
|
||||
}
|
||||
|
||||
template < class Triangulation >
|
||||
inline bool
|
||||
Triangulation_sphere_line_face_circulator_2<Triangulation>::
|
||||
operator!=(Nullptr_t n) const
|
||||
{
|
||||
CGAL_triangulation_assertion(n == NULL);
|
||||
return !(*this == n);
|
||||
}
|
||||
|
||||
} // end namespace CGAL
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue