mirror of https://github.com/CGAL/cgal
fix the 2D triangulations
This commit is contained in:
parent
dcf5f32dc0
commit
44d0fa4d6f
|
|
@ -65,8 +65,11 @@ create_single_source_cgal_program( "range.cpp" )
|
||||||
|
|
||||||
create_single_source_cgal_program( "transform_iterator.cpp" )
|
create_single_source_cgal_program( "transform_iterator.cpp" )
|
||||||
|
|
||||||
|
create_single_source_cgal_program( "change.cpp" )
|
||||||
|
|
||||||
create_single_source_cgal_program( "copy_polyhedron.cpp" )
|
create_single_source_cgal_program( "copy_polyhedron.cpp" )
|
||||||
|
|
||||||
|
|
||||||
if(OpenMesh_FOUND)
|
if(OpenMesh_FOUND)
|
||||||
target_link_libraries( copy_polyhedron ${OPENMESH_LIBRARIES} )
|
target_link_libraries( copy_polyhedron ${OPENMESH_LIBRARIES} )
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -2932,6 +2932,11 @@ namespace CartesianKernelFunctors {
|
||||||
typedef const Point_2& type;
|
typedef const Point_2& type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename F>
|
||||||
|
struct result<F(Point_2)> {
|
||||||
|
typedef const Point_2& type;
|
||||||
|
};
|
||||||
|
|
||||||
Rep // Point_2
|
Rep // Point_2
|
||||||
operator()(Return_base_tag, Origin o) const
|
operator()(Return_base_tag, Origin o) const
|
||||||
{ return Rep(o); }
|
{ return Rep(o); }
|
||||||
|
|
@ -2962,6 +2967,10 @@ namespace CartesianKernelFunctors {
|
||||||
return construct_point_2(x,y);
|
return construct_point_2(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Point_2&
|
||||||
|
operator()(const Point_2 & p) const
|
||||||
|
{ return p; }
|
||||||
|
|
||||||
const Point_2&
|
const Point_2&
|
||||||
operator()(const Weighted_point_2 & p) const
|
operator()(const Weighted_point_2 & p) const
|
||||||
{ return p.rep().point(); }
|
{ return p.rep().point(); }
|
||||||
|
|
|
||||||
|
|
@ -3065,6 +3065,11 @@ namespace HomogeneousKernelFunctors {
|
||||||
typedef const Point_2& type;
|
typedef const Point_2& type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename F>
|
||||||
|
struct result<F(Point_2)> {
|
||||||
|
typedef const Point_2& type;
|
||||||
|
};
|
||||||
|
|
||||||
Rep // Point_2
|
Rep // Point_2
|
||||||
operator()(Return_base_tag, Origin o) const
|
operator()(Return_base_tag, Origin o) const
|
||||||
{ return Rep(o); }
|
{ return Rep(o); }
|
||||||
|
|
@ -3100,6 +3105,10 @@ namespace HomogeneousKernelFunctors {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Point_2&
|
||||||
|
operator()(const Point_2 & p) const
|
||||||
|
{ return p; }
|
||||||
|
|
||||||
const Point_2&
|
const Point_2&
|
||||||
operator()(const Weighted_point_2 & p) const
|
operator()(const Weighted_point_2 & p) const
|
||||||
{ return p.rep().point(); }
|
{ return p.rep().point(); }
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ public:
|
||||||
CGAL_kernel_precondition( (i >= 0) || (i <= 2) );
|
CGAL_kernel_precondition( (i >= 0) || (i <= 2) );
|
||||||
if (i==0) return hx();
|
if (i==0) return hx();
|
||||||
if (i==1) return hy();
|
if (i==1) return hy();
|
||||||
return hz();
|
return hw();
|
||||||
}
|
}
|
||||||
|
|
||||||
typename cpp11::result_of<typename R::Compute_x_2(Point_2)>::type
|
typename cpp11::result_of<typename R::Compute_x_2(Point_2)>::type
|
||||||
|
|
|
||||||
|
|
@ -684,6 +684,9 @@ locate_in_all(const Point& p,
|
||||||
typename Geom_traits::Compare_distance_2
|
typename Geom_traits::Compare_distance_2
|
||||||
closer = this->geom_traits().compare_distance_2_object();
|
closer = this->geom_traits().compare_distance_2_object();
|
||||||
|
|
||||||
|
typename Geom_traits::Construct_point_2
|
||||||
|
construct_point = this->geom_traits().construct_point_2_object();
|
||||||
|
|
||||||
// find the highest level with enough vertices that is at the same time 2D
|
// find the highest level with enough vertices that is at the same time 2D
|
||||||
while ( (hierarchy[--level]->number_of_vertices()
|
while ( (hierarchy[--level]->number_of_vertices()
|
||||||
< static_cast<size_type> (Triangulation_hierarchy_2__minsize ))
|
< static_cast<size_type> (Triangulation_hierarchy_2__minsize ))
|
||||||
|
|
@ -706,9 +709,9 @@ locate_in_all(const Point& p,
|
||||||
}
|
}
|
||||||
else if (hierarchy[level]->is_infinite(position->vertex(1))){
|
else if (hierarchy[level]->is_infinite(position->vertex(1))){
|
||||||
nearest = position->vertex(0);
|
nearest = position->vertex(0);
|
||||||
} else if ( closer(p,
|
} else if ( closer(construct_point(p),
|
||||||
position->vertex(0)->point(),
|
construct_point(position->vertex(0)->point()),
|
||||||
position->vertex(1)->point()) == SMALLER){
|
construct_point(position->vertex(1)->point())) == SMALLER){
|
||||||
nearest = position->vertex(0);
|
nearest = position->vertex(0);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
@ -716,9 +719,9 @@ locate_in_all(const Point& p,
|
||||||
}
|
}
|
||||||
// compare to vertex 2, but only if the triangulation is 2D, because otherwise vertex(2) is NULL
|
// compare to vertex 2, but only if the triangulation is 2D, because otherwise vertex(2) is NULL
|
||||||
if ( (hierarchy[level]->dimension()==2) && (! hierarchy[level]->is_infinite(position->vertex(2)))){
|
if ( (hierarchy[level]->dimension()==2) && (! hierarchy[level]->is_infinite(position->vertex(2)))){
|
||||||
if ( closer( p,
|
if ( closer( construct_point(p),
|
||||||
position->vertex(2)->point(),
|
construct_point(position->vertex(2)->point()),
|
||||||
nearest->point()) == SMALLER ){
|
construct_point(nearest->point())) == SMALLER ){
|
||||||
nearest = position->vertex(2);
|
nearest = position->vertex(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue