mirror of https://github.com/CGAL/cgal
it now works with Surface_mesh
This commit is contained in:
parent
0321056aff
commit
2d7f51f441
|
|
@ -41,6 +41,7 @@ if ( CGAL_FOUND )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
create_single_source_cgal_program( Compute_Ridges_Umbilics.cpp)
|
create_single_source_cgal_program( Compute_Ridges_Umbilics.cpp)
|
||||||
|
create_single_source_cgal_program( Ridges_Umbilics_SM.cpp)
|
||||||
|
|
||||||
else(EIGEN3_FOUND OR LAPACK_FOUND)
|
else(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,17 @@ void compute_facets_normals(const TriangleMesh& tm,
|
||||||
FaceVectorMap fvm,
|
FaceVectorMap fvm,
|
||||||
const Kernel& k)
|
const Kernel& k)
|
||||||
{
|
{
|
||||||
|
typedef boost::property_traits<FaceVectorMap>::value_type Vector_3;
|
||||||
|
|
||||||
|
typedef boost::property_map<TriangleMesh,CGAL::vertex_point_t>::type VPM;
|
||||||
|
VPM vpm = get(CGAL::vertex_point,tm);
|
||||||
BOOST_FOREACH(typename boost::graph_traits<TriangleMesh>::face_descriptor f, faces(tm)){
|
BOOST_FOREACH(typename boost::graph_traits<TriangleMesh>::face_descriptor f, faces(tm)){
|
||||||
typename boost::graph_traits<TriangleMesh>::halfedge_descriptor h = halfedge(f,tm);
|
typename boost::graph_traits<TriangleMesh>::halfedge_descriptor h = halfedge(f,tm);
|
||||||
typename Kernel::Vector_3 normal =
|
Vector_3 normal =
|
||||||
CGAL::cross_product(target(h,tm)->point() -
|
CGAL::cross_product(get(vpm, target(h,tm)) -
|
||||||
target(opposite(h,tm),tm)->point(),
|
get(vpm, target(opposite(h,tm),tm)),
|
||||||
target(next(h,tm),tm)->point() -
|
get(vpm, target(CGAL::next(h,tm),tm)) - // AF: arghh CGAL::
|
||||||
target(opposite(h,tm),tm)->point());
|
get(vpm, target(opposite(h,tm),tm)));
|
||||||
put(fvm, f, normal / CGAL::sqrt(normal * normal));
|
put(fvm, f, normal / CGAL::sqrt(normal * normal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,15 @@ namespace CGAL {
|
||||||
//triangle incident to the halfedge.
|
//triangle incident to the halfedge.
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
template < class TriangularPolyhedralSurface > class T_Gate
|
template < class TriangularPolyhedralSurface > class T_Gate
|
||||||
{
|
{
|
||||||
|
typedef typename boost::property_map<TriangularPolyhedralSurface,CGAL::vertex_point_t>::type VPM;
|
||||||
|
typedef typename boost::property_traits<VPM>::value_type Point_3;
|
||||||
|
typedef typename Kernel_traits<Point_3>::Kernel Kernel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename TriangularPolyhedralSurface::Traits::FT FT;
|
typedef typename Kernel::FT FT;
|
||||||
typedef typename TriangularPolyhedralSurface::Traits::Vector_3 Vector_3;
|
typedef typename Kernel::Vector_3 Vector_3;
|
||||||
typedef typename TriangularPolyhedralSurface::Traits::Point_3 Point_3;
|
|
||||||
typedef typename boost::graph_traits<TriangularPolyhedralSurface>::vertex_descriptor Vertex_const_handle;
|
typedef typename boost::graph_traits<TriangularPolyhedralSurface>::vertex_descriptor Vertex_const_handle;
|
||||||
typedef typename boost::graph_traits<TriangularPolyhedralSurface>::halfedge_descriptor Halfedge_const_handle;
|
typedef typename boost::graph_traits<TriangularPolyhedralSurface>::halfedge_descriptor Halfedge_const_handle;
|
||||||
|
|
||||||
|
|
@ -79,11 +83,15 @@ struct compare_gates
|
||||||
template < class TriangularPolyhedralSurface >
|
template < class TriangularPolyhedralSurface >
|
||||||
class T_PolyhedralSurf_neighbors
|
class T_PolyhedralSurf_neighbors
|
||||||
{
|
{
|
||||||
const TriangularPolyhedralSurface& P;
|
|
||||||
|
typedef typename boost::property_map<TriangularPolyhedralSurface,CGAL::vertex_point_t>::type VPM;
|
||||||
|
typedef typename boost::property_traits<VPM>::value_type Point_3;
|
||||||
|
typedef typename Kernel_traits<Point_3>::Kernel Kernel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename TriangularPolyhedralSurface::Traits::FT FT;
|
typedef typename Kernel::FT FT;
|
||||||
typedef typename TriangularPolyhedralSurface::Traits::Vector_3 Vector_3;
|
typedef typename Kernel::Vector_3 Vector_3;
|
||||||
typedef typename TriangularPolyhedralSurface::Traits::Point_3 Point_3;
|
|
||||||
typedef typename boost::graph_traits<TriangularPolyhedralSurface>::vertex_descriptor Vertex_const_handle;
|
typedef typename boost::graph_traits<TriangularPolyhedralSurface>::vertex_descriptor Vertex_const_handle;
|
||||||
typedef typename boost::graph_traits<TriangularPolyhedralSurface>::halfedge_descriptor Halfedge_const_handle;
|
typedef typename boost::graph_traits<TriangularPolyhedralSurface>::halfedge_descriptor Halfedge_const_handle;
|
||||||
typedef CGAL::Halfedge_around_target_circulator<TriangularPolyhedralSurface>
|
typedef CGAL::Halfedge_around_target_circulator<TriangularPolyhedralSurface>
|
||||||
|
|
@ -116,10 +124,10 @@ public:
|
||||||
Gate make_gate(const Vertex_const_handle v,
|
Gate make_gate(const Vertex_const_handle v,
|
||||||
const Halfedge_const_handle he)
|
const Halfedge_const_handle he)
|
||||||
{
|
{
|
||||||
Point_3 p0 = v->point(),
|
Point_3 p0 = get(vpm, v),
|
||||||
p1 = target(he,P)->point(),
|
p1 = get(vpm, target(he,P)),
|
||||||
p2 = target(next(he,P),P)->point(),
|
p2 = get(vpm, target(next(he,P),P)),
|
||||||
p3 = target(prev(he,P),P)->point();
|
p3 = get(vpm, target(prev(he,P),P));
|
||||||
Vector_3 p0p1 = p0 - p1,
|
Vector_3 p0p1 = p0 - p1,
|
||||||
p0p2 = p0 - p2,
|
p0p2 = p0 - p2,
|
||||||
p0p3 = p0 - p3;
|
p0p3 = p0 - p3;
|
||||||
|
|
@ -131,13 +139,17 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/*
|
||||||
//tag to visit vertices
|
//tag to visit vertices
|
||||||
struct Vertex_cmp{//comparison is wrt vertex addresses
|
struct Vertex_cmp{//comparison is wrt vertex addresses
|
||||||
bool operator()(const Vertex_const_handle a, const Vertex_const_handle b) const{
|
bool operator()(const Vertex_const_handle a, const Vertex_const_handle b) const{
|
||||||
return &*a < &*b;
|
return &*a < &*b;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
typedef std::map<Vertex_const_handle, bool, Vertex_cmp> Vertex2bool_map;
|
*/
|
||||||
|
const TriangularPolyhedralSurface& P;
|
||||||
|
VPM vpm;
|
||||||
|
typedef std::map<Vertex_const_handle, bool/*, Vertex_cmp*/> Vertex2bool_map;
|
||||||
Vertex2bool_map is_visited_map;
|
Vertex2bool_map is_visited_map;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -145,7 +157,7 @@ public:
|
||||||
template < class TriangularPolyhedralSurface >
|
template < class TriangularPolyhedralSurface >
|
||||||
T_PolyhedralSurf_neighbors < TriangularPolyhedralSurface >::
|
T_PolyhedralSurf_neighbors < TriangularPolyhedralSurface >::
|
||||||
T_PolyhedralSurf_neighbors(const TriangularPolyhedralSurface& P)
|
T_PolyhedralSurf_neighbors(const TriangularPolyhedralSurface& P)
|
||||||
:P(P)
|
:P(P), vpm(get(vertex_point,P))
|
||||||
{
|
{
|
||||||
//init the is_visited_map
|
//init the is_visited_map
|
||||||
Vertex_const_iterator itb, ite;
|
Vertex_const_iterator itb, ite;
|
||||||
|
|
@ -178,12 +190,12 @@ compute_one_ring(const Vertex_const_handle v,
|
||||||
ite = vertex_neigh.end();
|
ite = vertex_neigh.end();
|
||||||
itb++;//the first vertex v is the center to which distances are
|
itb++;//the first vertex v is the center to which distances are
|
||||||
//computed from, for other 1ring neighbors
|
//computed from, for other 1ring neighbors
|
||||||
Point_3 p0 = v->point(), p;
|
Point_3 p0 = get(vpm, v), p;
|
||||||
Vector_3 p0p;
|
Vector_3 p0p;
|
||||||
FT d = OneRingSize;
|
FT d = OneRingSize;
|
||||||
for (; itb != ite; itb++){
|
for (; itb != ite; itb++){
|
||||||
|
|
||||||
p = (*itb)->point();
|
p = get(vpm, *itb);
|
||||||
p0p = p0 - p;
|
p0p = p0 - p;
|
||||||
d = CGAL::sqrt(p0p*p0p);
|
d = CGAL::sqrt(p0p*p0p);
|
||||||
if (d > OneRingSize) OneRingSize = d;
|
if (d > OneRingSize) OneRingSize = d;
|
||||||
|
|
@ -249,7 +261,7 @@ compute_neighbors(const Vertex_const_handle v,
|
||||||
if ( iter != contour.begin() ) pos_prev = --iter;
|
if ( iter != contour.begin() ) pos_prev = --iter;
|
||||||
else pos_prev = --contour.end();
|
else pos_prev = --contour.end();
|
||||||
|
|
||||||
if ( he->next() == *pos_next )
|
if ( next(he,P) == *pos_next )
|
||||||
{ // case 2a
|
{ // case 2a
|
||||||
//contour
|
//contour
|
||||||
he1 = opposite(prev(he,P),P);
|
he1 = opposite(prev(he,P),P);
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,12 @@ enum Ridge_order {Ridge_order_3 = 3, Ridge_order_4 = 4};
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
template < class TriangulatedSurfaceMesh > class Ridge_line
|
template < class TriangulatedSurfaceMesh > class Ridge_line
|
||||||
{
|
{
|
||||||
|
typedef typename boost::property_map<TriangulatedSurfaceMesh,CGAL::vertex_point_t>::type VPM;
|
||||||
|
typedef typename boost::property_traits<VPM>::value_type Point_3;
|
||||||
|
typedef typename Kernel_traits<Point_3>::Kernel Kernel;
|
||||||
public:
|
public:
|
||||||
typedef typename TriangulatedSurfaceMesh::Traits::FT FT;
|
|
||||||
|
typedef typename Kernel::FT FT;
|
||||||
typedef typename boost::graph_traits<TriangulatedSurfaceMesh>::halfedge_descriptor halfedge_descriptor;
|
typedef typename boost::graph_traits<TriangulatedSurfaceMesh>::halfedge_descriptor halfedge_descriptor;
|
||||||
typedef std::pair< halfedge_descriptor, FT> ridge_halfhedge;
|
typedef std::pair< halfedge_descriptor, FT> ridge_halfhedge;
|
||||||
|
|
||||||
|
|
@ -377,8 +381,8 @@ template < class TriangulatedSurfaceMesh,
|
||||||
BOOST_FOREACH(vertex_descriptor v, vertices(p)){
|
BOOST_FOREACH(vertex_descriptor v, vertices(p)){
|
||||||
points.push_back(get(vpm,v));
|
points.push_back(get(vpm,v));
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL::Min_sphere_d<CGAL::Optimisation_d_traits_3<typename TriangulatedSurfaceMesh::Traits> >
|
CGAL::Min_sphere_d<CGAL::Optimisation_d_traits_3<Kernel> >
|
||||||
min_sphere(points.begin(), points.end());
|
min_sphere(points.begin(), points.end());
|
||||||
squared_model_size = min_sphere.squared_radius();
|
squared_model_size = min_sphere.squared_radius();
|
||||||
//maybe better to use CGAL::Min_sphere_of_spheres_d ?? but need to create spheres?
|
//maybe better to use CGAL::Min_sphere_of_spheres_d ?? but need to create spheres?
|
||||||
|
|
@ -461,7 +465,7 @@ template < class TriangulatedSurfaceMesh,
|
||||||
//follow the ridge from curhe
|
//follow the ridge from curhe
|
||||||
if (is_visited_map.find(f)->second) break;
|
if (is_visited_map.find(f)->second) break;
|
||||||
is_visited_map.find(f)->second = true;
|
is_visited_map.find(f)->second = true;
|
||||||
if (curhe->opposite() == curhe1) curhe = curhe2;
|
if (opposite(curhe,P) == curhe1) curhe = curhe2;
|
||||||
else curhe = curhe1;//curhe stays at the ridge extremity
|
else curhe = curhe1;//curhe stays at the ridge extremity
|
||||||
addfront(cur_ridge_line, curhe, cur_ridge_type);
|
addfront(cur_ridge_line, curhe, cur_ridge_type);
|
||||||
if ( ! is_border_edge(curhe,P) ) f = face(opposite(curhe,P),P);
|
if ( ! is_border_edge(curhe,P) ) f = face(opposite(curhe,P),P);
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class Umbilic
|
||||||
public:
|
public:
|
||||||
typedef typename boost::graph_traits<TriangulatedSurfaceMesh>::vertex_descriptor Vertex_const_handle;
|
typedef typename boost::graph_traits<TriangulatedSurfaceMesh>::vertex_descriptor Vertex_const_handle;
|
||||||
typedef typename boost::graph_traits<TriangulatedSurfaceMesh>::halfedge_descriptor Halfedge_const_handle;
|
typedef typename boost::graph_traits<TriangulatedSurfaceMesh>::halfedge_descriptor Halfedge_const_handle;
|
||||||
typedef typename TriangulatedSurfaceMesh::Traits::Vector_3 Vector_3;
|
// typedef typename TriangulatedSurfaceMesh::Traits::Vector_3 Vector_3;
|
||||||
|
|
||||||
//contructor
|
//contructor
|
||||||
Umbilic(const Vertex_const_handle v_init,
|
Umbilic(const Vertex_const_handle v_init,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue