mirror of https://github.com/CGAL/cgal
Do not provide Bare_point overloads in Regular_triangulation_2
Additional: -- Simplify the hierarchy_2: there is no need to distinguish between Bare_point and Weighted_point, that is the point (!) of the type "Point" in Triangulation_2. -- Use Weighted_point in tests
This commit is contained in:
parent
89d095d683
commit
ccf1385adf
|
|
@ -367,48 +367,6 @@ public:
|
|||
return _hidden_vertices;
|
||||
}
|
||||
|
||||
// Overloads for Bare_point
|
||||
|
||||
Face_handle
|
||||
inexact_locate(const Bare_point& bp,
|
||||
Face_handle start = Face_handle()) const
|
||||
{
|
||||
return Base::inexact_locate(geom_traits().construct_weighted_point_2_object()(bp), start);
|
||||
}
|
||||
|
||||
Face_handle
|
||||
locate(const Bare_point& bp,
|
||||
Locate_type& lt,
|
||||
int& li,
|
||||
Face_handle start = Face_handle()) const
|
||||
{
|
||||
return Base::locate(geom_traits().construct_weighted_point_2_object()(bp), lt, li, start);
|
||||
}
|
||||
|
||||
Face_handle
|
||||
locate(const Bare_point& bp,
|
||||
Face_handle start = Face_handle())
|
||||
{
|
||||
return Base::locate(geom_traits().construct_weighted_point_2_object()(bp), start);
|
||||
}
|
||||
|
||||
typename Base::Line_face_circulator
|
||||
line_walk(const Bare_point& p,
|
||||
const Bare_point& q,
|
||||
Face_handle f = Face_handle()) const
|
||||
{
|
||||
return Base::line_walk(this->geom_traits().construct_weighted_point_2_object()(p),
|
||||
this->geom_traits().construct_weighted_point_2_object()(q),
|
||||
f);
|
||||
}
|
||||
|
||||
Oriented_side
|
||||
oriented_side(Face_handle f, const Bare_point &p) const
|
||||
{
|
||||
return Base::oriented_side(f, geom_traits().construct_weighted_point_2_object()(p));
|
||||
}
|
||||
|
||||
|
||||
// CHECK - QUERY
|
||||
|
||||
Oriented_side power_test(const Weighted_point &p,
|
||||
|
|
|
|||
|
|
@ -189,26 +189,13 @@ public:
|
|||
|
||||
//LOCATE
|
||||
Face_handle
|
||||
locate(const Bare_point& p,
|
||||
locate(const Point& p,
|
||||
Locate_type& lt,
|
||||
int& li,
|
||||
Face_handle start = Face_handle()) const;
|
||||
|
||||
Face_handle
|
||||
locate(const Weighted_point& p,
|
||||
Locate_type& lt,
|
||||
int& li,
|
||||
Face_handle start = Face_handle()) const;
|
||||
|
||||
|
||||
Face_handle
|
||||
locate(const Bare_point &p,
|
||||
Face_handle start = Face_handle()) const;
|
||||
|
||||
Face_handle
|
||||
locate(const Weighted_point &p,
|
||||
Face_handle start = Face_handle()) const;
|
||||
|
||||
locate(const Point&p, Face_handle start = Face_handle()) const;
|
||||
|
||||
Vertex_handle
|
||||
nearest_vertex(const Point& p, Face_handle start = Face_handle()) const
|
||||
|
|
@ -234,23 +221,13 @@ private:
|
|||
return Vertex_handle();
|
||||
}
|
||||
|
||||
void locate_in_all(const Bare_point& p,
|
||||
void locate_in_all(const Point& p,
|
||||
Locate_type& lt,
|
||||
int& li,
|
||||
Face_handle loc,
|
||||
Face_handle
|
||||
pos[Triangulation_hierarchy_2__maxlevel]) const;
|
||||
|
||||
void locate_in_all(const Weighted_point& p,
|
||||
Locate_type& lt,
|
||||
int& li,
|
||||
Face_handle loc,
|
||||
Face_handle
|
||||
pos[Triangulation_hierarchy_2__maxlevel]) const
|
||||
{
|
||||
locate_in_all(this->geom_traits().construct_point_2_object()(p), lt, li, loc,pos);
|
||||
}
|
||||
|
||||
int random_level();
|
||||
|
||||
// helping function to copy_triangulation
|
||||
|
|
@ -690,7 +667,7 @@ insert_and_give_new_faces(const Point &p,
|
|||
template <class Tr>
|
||||
typename Triangulation_hierarchy_2<Tr>::Face_handle
|
||||
Triangulation_hierarchy_2<Tr>::
|
||||
locate(const Bare_point& p, Locate_type& lt, int& li, Face_handle loc) const
|
||||
locate(const Point& p, Locate_type& lt, int& li, Face_handle loc) const
|
||||
{
|
||||
Face_handle positions[Triangulation_hierarchy_2__maxlevel];
|
||||
locate_in_all(p,lt,li,loc,positions);
|
||||
|
|
@ -700,33 +677,17 @@ locate(const Bare_point& p, Locate_type& lt, int& li, Face_handle loc) const
|
|||
template <class Tr>
|
||||
typename Triangulation_hierarchy_2<Tr>::Face_handle
|
||||
Triangulation_hierarchy_2<Tr>::
|
||||
locate(const Weighted_point& p, Locate_type& lt, int& li, Face_handle loc) const
|
||||
{
|
||||
return locate(geom_traits().construct_point_2_object()(p), lt, li, loc);
|
||||
}
|
||||
|
||||
template <class Tr>
|
||||
typename Triangulation_hierarchy_2<Tr>::Face_handle
|
||||
Triangulation_hierarchy_2<Tr>::
|
||||
locate(const Bare_point& p, Face_handle loc ) const
|
||||
locate(const Point& p, Face_handle loc ) const
|
||||
{
|
||||
Locate_type lt;
|
||||
int li;
|
||||
return locate(p, lt, li, loc);
|
||||
}
|
||||
|
||||
template <class Tr>
|
||||
typename Triangulation_hierarchy_2<Tr>::Face_handle
|
||||
Triangulation_hierarchy_2<Tr>::
|
||||
locate(const Weighted_point& p, Face_handle loc ) const
|
||||
{
|
||||
return locate(geom_traits().construct_point_2_object()(p), loc);
|
||||
}
|
||||
|
||||
template <class Tr>
|
||||
void
|
||||
Triangulation_hierarchy_2<Tr>::
|
||||
locate_in_all(const Bare_point& p,
|
||||
locate_in_all(const Point& p,
|
||||
Locate_type& lt,
|
||||
int& li,
|
||||
Face_handle loc,
|
||||
|
|
@ -753,7 +714,7 @@ locate_in_all(const Bare_point& p,
|
|||
|
||||
for (int i=level+1; i<Triangulation_hierarchy_2__maxlevel;++i) pos[i]=0;
|
||||
while(level > 0) {
|
||||
pos[level]=position=hierarchy[level]->locate(p,position);
|
||||
pos[level]=position=hierarchy[level]->locate(p, position);
|
||||
// locate at that level from "position"
|
||||
// result is stored in "position" for the next level
|
||||
// find the nearest between vertices 0 and 1
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ _test_cls_regular_hierarchy_2( const Rh & )
|
|||
//rh.is_valid(true);
|
||||
|
||||
std::cout << " location" << std::endl;
|
||||
rh.locate(Bare_point(0.,0.));
|
||||
rh.locate(Weighted_point(0.,0.));
|
||||
|
||||
std::cout << " removal of all points" << std::endl;
|
||||
while( rh.number_of_vertices() > 0) {
|
||||
rh.remove(rh.finite_vertices_begin());
|
||||
|
|
|
|||
|
|
@ -143,11 +143,11 @@ _test_cls_regular_triangulation_2( const Triangulation & )
|
|||
Weighted_point wp8(p8,20);
|
||||
Weighted_point wp9(p9,1); // intersection of p2,p8 and p6,p7
|
||||
Weighted_point wp10(p10,2);
|
||||
//Weighted_point wp11(p11,2); // midpoint p1,p0
|
||||
Weighted_point wp11(p11,2); // midpoint p1,p0
|
||||
Weighted_point wp12(p12,2); // slightly above, in face
|
||||
//Weighted_point wp13(p13,1);
|
||||
//Weighted_point wp14(p14,1);
|
||||
//Weighted_point wp15(p15,1);
|
||||
Weighted_point wp13(p13,1);
|
||||
Weighted_point wp14(p14,1);
|
||||
Weighted_point wp15(p15,1);
|
||||
Weighted_point wp16(p2,1);
|
||||
Weighted_point wp17(p3,20);
|
||||
Weighted_point wp19(p9,0.5);
|
||||
|
|
@ -374,62 +374,62 @@ _test_cls_regular_triangulation_2( const Triangulation & )
|
|||
T1_3_2.insert(wp2);
|
||||
T1_3_2.insert(wp9);
|
||||
T1_3_2.is_valid(verbose);
|
||||
loc = T1_3_2.locate(p1,lt,li); assert( lt == Cls::VERTEX );
|
||||
loc = T1_3_2.locate(wp1,lt,li); assert( lt == Cls::VERTEX );
|
||||
assert( T1_3_2.xy_equal(loc->vertex(li)->point(), wp1) );
|
||||
loc = T1_3_2.locate(p2,lt,li); assert( lt == Cls::VERTEX );
|
||||
loc = T1_3_2.locate(wp2,lt,li); assert( lt == Cls::VERTEX );
|
||||
assert( T1_3_2.xy_equal(loc->vertex(li)->point(), wp2) );
|
||||
loc = T1_3_2.locate(p9,lt,li); assert( lt == Cls::VERTEX );
|
||||
loc = T1_3_2.locate(wp9,lt,li); assert( lt == Cls::VERTEX );
|
||||
assert( T1_3_2.xy_equal(loc->vertex(li)->point(), wp9) );
|
||||
loc = T1_3_2.locate(p3,lt,li); assert( lt == Cls::EDGE );
|
||||
loc = T1_3_2.locate(wp3,lt,li); assert( lt == Cls::EDGE );
|
||||
assert( (T1_3_2.xy_equal(loc->vertex(loc->ccw(li))->point(), wp1)
|
||||
&& T1_3_2.xy_equal(loc->vertex(loc->cw(li))->point(), wp2))
|
||||
|| (T1_3_2.xy_equal(loc->vertex(loc->ccw(li))->point(), wp2)
|
||||
&& T1_3_2.xy_equal(loc->vertex(loc->cw(li))->point(), wp1)));
|
||||
loc = T1_3_2.locate(p8,lt,li); assert( lt == Cls::OUTSIDE_CONVEX_HULL );
|
||||
loc = T1_3_2.locate(p7,lt,li); assert( lt == Cls::OUTSIDE_AFFINE_HULL );
|
||||
loc = T1_3_2.locate(p5,lt,li); assert( lt == Cls::OUTSIDE_AFFINE_HULL );
|
||||
loc = T1_3_2.locate(p4,lt,li); assert( lt == Cls::OUTSIDE_AFFINE_HULL );
|
||||
loc = T1_3_2.locate(p6,lt,li); assert( lt == Cls::OUTSIDE_AFFINE_HULL);
|
||||
loc = T1_3_2.locate(wp8,lt,li); assert( lt == Cls::OUTSIDE_CONVEX_HULL );
|
||||
loc = T1_3_2.locate(wp7,lt,li); assert( lt == Cls::OUTSIDE_AFFINE_HULL );
|
||||
loc = T1_3_2.locate(wp5,lt,li); assert( lt == Cls::OUTSIDE_AFFINE_HULL );
|
||||
loc = T1_3_2.locate(wp4,lt,li); assert( lt == Cls::OUTSIDE_AFFINE_HULL );
|
||||
loc = T1_3_2.locate(wp6,lt,li); assert( lt == Cls::OUTSIDE_AFFINE_HULL);
|
||||
|
||||
|
||||
// Check point location in 2-dimensional triangulations
|
||||
std::cout << " point locations 2-dim" << std::endl;
|
||||
loc = T2_3.locate(p0,lt,li); assert( lt == Cls::VERTEX );
|
||||
loc = T2_3.locate(wp0,lt,li); assert( lt == Cls::VERTEX );
|
||||
assert( T2_3.xy_equal(loc->vertex(li)->point(), wp0) );
|
||||
loc = T2_3.locate(p1,lt,li); assert( lt == Cls::VERTEX );
|
||||
loc = T2_3.locate(wp1,lt,li); assert( lt == Cls::VERTEX );
|
||||
assert( T2_3.xy_equal(loc->vertex(li)->point(), wp1) );
|
||||
loc = T2_3.locate(p2,lt,li); assert( lt == Cls::VERTEX );
|
||||
loc = T2_3.locate(wp2,lt,li); assert( lt == Cls::VERTEX );
|
||||
assert( T2_3.xy_equal(loc->vertex(li)->point(), wp2) );
|
||||
loc = T2_3.locate(p4,lt,li); assert( lt == Cls::VERTEX );
|
||||
loc = T2_3.locate(wp4,lt,li); assert( lt == Cls::VERTEX );
|
||||
assert( T2_3.xy_equal(loc->vertex(li)->point(), wp4) );
|
||||
loc = T2_3.locate(p5,lt,li); assert( lt == Cls::VERTEX );
|
||||
loc = T2_3.locate(wp5,lt,li); assert( lt == Cls::VERTEX );
|
||||
assert( T2_3.xy_equal(loc->vertex(li)->point(), wp5) );
|
||||
loc = T2_3.locate(p6,lt,li); assert( lt == Cls::VERTEX );
|
||||
loc = T2_3.locate(wp6,lt,li); assert( lt == Cls::VERTEX );
|
||||
assert( T2_3.xy_equal(loc->vertex(li)->point(), wp6) );
|
||||
loc = T2_3.locate(p7,lt,li); assert( lt == Cls::VERTEX );
|
||||
loc = T2_3.locate(wp7,lt,li); assert( lt == Cls::VERTEX );
|
||||
assert( T2_3.xy_equal(loc->vertex(li)->point(), wp7) );
|
||||
loc = T2_3.locate(p8,lt,li); assert( lt == Cls::VERTEX );
|
||||
loc = T2_3.locate(wp8,lt,li); assert( lt == Cls::VERTEX );
|
||||
assert( T2_3.xy_equal(loc->vertex(li)->point(), wp8) );
|
||||
loc = T2_3.locate(p10,lt,li); assert( lt == Cls::VERTEX );
|
||||
loc = T2_3.locate(wp10,lt,li); assert( lt == Cls::VERTEX );
|
||||
assert( T2_3.xy_equal(loc->vertex(li)->point(), wp10) );
|
||||
|
||||
|
||||
loc = T2_3.locate(p3,lt,li); assert( lt == Cls::EDGE );
|
||||
loc = T2_3.locate(p9,lt,li); assert( lt == Cls::EDGE );
|
||||
loc = T2_3.locate(p11,lt,li); assert( lt == Cls::EDGE);
|
||||
loc = T2_3.locate(wp3,lt,li); assert( lt == Cls::EDGE );
|
||||
loc = T2_3.locate(wp9,lt,li); assert( lt == Cls::EDGE );
|
||||
loc = T2_3.locate(wp11,lt,li); assert( lt == Cls::EDGE);
|
||||
assert( (T2_3.xy_equal(loc->vertex(loc->ccw(li))->point(), wp1)
|
||||
&& T2_3.xy_equal(loc->vertex(loc->cw(li))->point(), wp0))
|
||||
|| (T2_3.xy_equal(loc->vertex(loc->ccw(li))->point(), wp0)
|
||||
&& T2_3.xy_equal(loc->vertex(loc->cw(li))->point(), wp1)));
|
||||
loc = T2_3.locate(p12,lt,li); assert( lt == Cls::FACE );
|
||||
assert( T2_3.oriented_side(loc,p12) == CGAL::ON_POSITIVE_SIDE );
|
||||
loc = T2_3.locate(p13,lt,li,loc); assert( lt == Cls::OUTSIDE_CONVEX_HULL );
|
||||
loc = T2_3.locate(wp12,lt,li); assert( lt == Cls::FACE );
|
||||
assert( T2_3.oriented_side(loc,wp12) == CGAL::ON_POSITIVE_SIDE );
|
||||
loc = T2_3.locate(wp13,lt,li,loc); assert( lt == Cls::OUTSIDE_CONVEX_HULL );
|
||||
li = loc->index(T2_3.infinite_vertex());
|
||||
assert( _test_is_to_the_left(T2_3,p13,loc,li) );
|
||||
loc = T2_3.locate(p14,lt,li); assert( lt == Cls::OUTSIDE_CONVEX_HULL );
|
||||
loc = T2_3.locate(wp14,lt,li); assert( lt == Cls::OUTSIDE_CONVEX_HULL );
|
||||
li = loc->index(T2_3.infinite_vertex());
|
||||
assert( _test_is_to_the_left(T2_3,p14,loc,li) );
|
||||
loc = T2_3.locate(p15,lt,li); assert( lt == Cls::OUTSIDE_CONVEX_HULL );
|
||||
loc = T2_3.locate(wp15,lt,li); assert( lt == Cls::OUTSIDE_CONVEX_HULL );
|
||||
li = loc->index(T2_3.infinite_vertex());
|
||||
assert( _test_is_to_the_left(T2_3,p15,loc,li) );
|
||||
|
||||
|
|
@ -444,8 +444,8 @@ _test_cls_regular_triangulation_2( const Triangulation & )
|
|||
T2_3_1.insert(wp19); // hidden on edge
|
||||
T2_3_1.is_valid(verbose);
|
||||
|
||||
loc = T2_3_1.locate(p12,lt,li); assert( lt == Cls::FACE );
|
||||
assert( T2_3_1.oriented_side(loc,p12) == CGAL::ON_POSITIVE_SIDE );
|
||||
loc = T2_3_1.locate(wp12,lt,li); assert( lt == Cls::FACE );
|
||||
assert( T2_3_1.oriented_side(loc,wp12) == CGAL::ON_POSITIVE_SIDE );
|
||||
assert( T2_3_1.power_test(loc,wp12) == CGAL::ON_NEGATIVE_SIDE);
|
||||
T2_3_1.insert(wp12); //hidden in face
|
||||
T2_3_1.is_valid(verbose);
|
||||
|
|
@ -520,7 +520,7 @@ _test_cls_regular_triangulation_2( const Triangulation & )
|
|||
typedef typename Cls::Line_face_circulator LFC;
|
||||
// here == operator needed for Point!
|
||||
// testing with the grid triangulation
|
||||
LFC fc= T2_3.line_walk(p1,p10);
|
||||
LFC fc= T2_3.line_walk(wp1,wp10);
|
||||
assert(fc != NULL);
|
||||
assert(!fc.is_empty());
|
||||
LFC fc2=fc;
|
||||
|
|
@ -530,8 +530,9 @@ _test_cls_regular_triangulation_2( const Triangulation & )
|
|||
++fc;
|
||||
--fc;
|
||||
Bare_point pp(0,1,2);
|
||||
loc = T2_3.locate(pp,lt,li);
|
||||
fc= T2_3.line_walk(pp,p10,loc);
|
||||
Weighted_point wpp(pp);
|
||||
loc = T2_3.locate(wpp,lt,li);
|
||||
fc= T2_3.line_walk(wpp,wp10,loc);
|
||||
fc2=fc;
|
||||
assert(fc==fc2);
|
||||
fc++;
|
||||
|
|
@ -548,7 +549,7 @@ _test_cls_regular_triangulation_2( const Triangulation & )
|
|||
do {fc2++ ; n = n+1;} while (fc2 != fc);
|
||||
assert(T2_8.number_of_vertices()>=2);
|
||||
assert(T2_8.is_valid(verbose));
|
||||
fc= T2_8.line_walk(Bare_point(5,4,10),Bare_point(5,5));
|
||||
fc= T2_8.line_walk(Weighted_point(Bare_point(5,4,10)),Weighted_point(5,5));
|
||||
fc2=fc;
|
||||
n=0;
|
||||
assert(fc==fc2);
|
||||
|
|
@ -563,9 +564,9 @@ _test_cls_regular_triangulation_2( const Triangulation & )
|
|||
assert(TT.dimension()==2);
|
||||
assert(TT.is_valid(verbose));
|
||||
assert(TT.number_of_vertices()==4);
|
||||
loc = TT.locate(Bare_point(0,0));
|
||||
fc = TT.line_walk(Bare_point(0,0),Bare_point(1,1));
|
||||
fc2 = TT.line_walk(Bare_point(0,0),Bare_point(1,1),loc);
|
||||
loc = TT.locate(Weighted_point(0,0));
|
||||
fc = TT.line_walk(Weighted_point(0,0),Weighted_point(1,1));
|
||||
fc2 = TT.line_walk(Weighted_point(0,0),Weighted_point(1,1),loc);
|
||||
if (fc != fc2)
|
||||
{
|
||||
TT.show_all();
|
||||
|
|
@ -589,7 +590,7 @@ _test_cls_regular_triangulation_2( const Triangulation & )
|
|||
assert( T0_0.cw(2) == 1 );
|
||||
|
||||
// the assert() are to avoid compiler warnings about unused variables
|
||||
loc = T2_3.locate(p12,lt,li); // from section locate above
|
||||
loc = T2_3.locate(wp12,lt,li); // from section locate above
|
||||
Triangle t = T2_3.triangle(loc); assert( &t == &t );
|
||||
Segment s = T2_3.segment(loc,0); assert( &s == &s );
|
||||
s = T2_3.segment(Edge(loc,1)); assert( &s == &s );
|
||||
|
|
@ -690,7 +691,7 @@ _test_cls_regular_triangulation_2( const Triangulation & )
|
|||
std::back_inserter(conflicts),
|
||||
std::back_inserter(hole_bd),
|
||||
std::back_inserter(hidden_vertices));
|
||||
loc = T2_3.locate(p12,lt,li); assert( lt == Cls::FACE );
|
||||
loc = T2_3.locate(wp12,lt,li); assert( lt == Cls::FACE );
|
||||
tit = T2_3.get_conflicts_and_boundary_and_hidden_vertices
|
||||
(wp12,
|
||||
std::back_inserter(conflicts),
|
||||
|
|
|
|||
Loading…
Reference in New Issue