mirror of https://github.com/CGAL/cgal
clean up
This commit is contained in:
parent
8665ef7026
commit
e2f7efa58a
|
|
@ -23,7 +23,7 @@
|
||||||
#define CGAL_AABB_FACE_GRAPH_TRIANGLE_PRIMITIVE_H
|
#define CGAL_AABB_FACE_GRAPH_TRIANGLE_PRIMITIVE_H
|
||||||
|
|
||||||
#include <CGAL/AABB_primitive.h>
|
#include <CGAL/AABB_primitive.h>
|
||||||
#include <CGAL/boost/graph/Halfedge_and_face_graph_property_maps.h>
|
#include <CGAL/boost/graph/property_maps.h>
|
||||||
#include <CGAL/Default.h>
|
#include <CGAL/Default.h>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
@ -61,12 +61,12 @@ template < class FaceGraph,
|
||||||
class AABB_face_graph_triangle_primitive
|
class AABB_face_graph_triangle_primitive
|
||||||
#ifndef DOXYGEN_RUNNING
|
#ifndef DOXYGEN_RUNNING
|
||||||
: public AABB_primitive<typename boost::graph_traits<FaceGraph>::face_descriptor,
|
: public AABB_primitive<typename boost::graph_traits<FaceGraph>::face_descriptor,
|
||||||
Triangle_from_face_descriptor_property_map<
|
Triangle_from_face_descriptor_map<
|
||||||
FaceGraph,
|
FaceGraph,
|
||||||
typename Default::Get<VertexPointPMap,
|
typename Default::Get<VertexPointPMap,
|
||||||
typename boost::property_map< FaceGraph,
|
typename boost::property_map< FaceGraph,
|
||||||
vertex_point_t>::type >::type>,
|
vertex_point_t>::type >::type>,
|
||||||
One_point_from_face_descriptor_property_map<
|
One_point_from_face_descriptor_map<
|
||||||
FaceGraph,
|
FaceGraph,
|
||||||
typename Default::Get<VertexPointPMap,
|
typename Default::Get<VertexPointPMap,
|
||||||
typename boost::property_map< FaceGraph,
|
typename boost::property_map< FaceGraph,
|
||||||
|
|
@ -78,8 +78,8 @@ class AABB_face_graph_triangle_primitive
|
||||||
typedef typename Default::Get<VertexPointPMap, typename boost::property_map< FaceGraph, vertex_point_t>::type >::type VertexPointPMap_;
|
typedef typename Default::Get<VertexPointPMap, typename boost::property_map< FaceGraph, vertex_point_t>::type >::type VertexPointPMap_;
|
||||||
|
|
||||||
typedef typename boost::graph_traits<FaceGraph>::face_descriptor Id_;
|
typedef typename boost::graph_traits<FaceGraph>::face_descriptor Id_;
|
||||||
typedef Triangle_from_face_descriptor_property_map<FaceGraph,VertexPointPMap_> Triangle_property_map;
|
typedef Triangle_from_face_descriptor_map<FaceGraph,VertexPointPMap_> Triangle_property_map;
|
||||||
typedef One_point_from_face_descriptor_property_map<FaceGraph,VertexPointPMap_> Point_property_map;
|
typedef One_point_from_face_descriptor_map<FaceGraph,VertexPointPMap_> Point_property_map;
|
||||||
|
|
||||||
typedef AABB_primitive< Id_,
|
typedef AABB_primitive< Id_,
|
||||||
Triangle_property_map,
|
Triangle_property_map,
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#define CGAL_AABB_HALFEDGE_GRAPH_SEGMENT_PRIMITIVE_H
|
#define CGAL_AABB_HALFEDGE_GRAPH_SEGMENT_PRIMITIVE_H
|
||||||
|
|
||||||
#include <CGAL/AABB_primitive.h>
|
#include <CGAL/AABB_primitive.h>
|
||||||
#include <CGAL/boost/graph/Halfedge_and_face_graph_property_maps.h>
|
#include <CGAL/boost/graph/property_maps.h>
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <boost/mpl/and.hpp>
|
#include <boost/mpl/and.hpp>
|
||||||
|
|
@ -73,12 +73,12 @@ template < class HalfedgeGraph,
|
||||||
class AABB_halfedge_graph_segment_primitive
|
class AABB_halfedge_graph_segment_primitive
|
||||||
#ifndef DOXYGEN_RUNNING
|
#ifndef DOXYGEN_RUNNING
|
||||||
: public AABB_primitive< typename boost::graph_traits<HalfedgeGraph>::edge_descriptor,
|
: public AABB_primitive< typename boost::graph_traits<HalfedgeGraph>::edge_descriptor,
|
||||||
Segment_from_edge_descriptor_property_map<
|
Segment_from_edge_descriptor_map<
|
||||||
HalfedgeGraph,
|
HalfedgeGraph,
|
||||||
typename Default::Get<VertexPointPMap,
|
typename Default::Get<VertexPointPMap,
|
||||||
typename boost::property_map< HalfedgeGraph,
|
typename boost::property_map< HalfedgeGraph,
|
||||||
vertex_point_t>::type >::type >,
|
vertex_point_t>::type >::type >,
|
||||||
Source_point_from_edge_descriptor<
|
Source_point_from_edge_descriptor_map<
|
||||||
HalfedgeGraph,
|
HalfedgeGraph,
|
||||||
typename Default::Get<VertexPointPMap,
|
typename Default::Get<VertexPointPMap,
|
||||||
typename boost::property_map< HalfedgeGraph,
|
typename boost::property_map< HalfedgeGraph,
|
||||||
|
|
@ -90,8 +90,8 @@ class AABB_halfedge_graph_segment_primitive
|
||||||
typedef typename Default::Get<VertexPointPMap,typename boost::property_map< HalfedgeGraph,vertex_point_t>::type >::type VertexPointPMap_;
|
typedef typename Default::Get<VertexPointPMap,typename boost::property_map< HalfedgeGraph,vertex_point_t>::type >::type VertexPointPMap_;
|
||||||
|
|
||||||
typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor Id_;
|
typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor Id_;
|
||||||
typedef Segment_from_edge_descriptor_property_map<HalfedgeGraph,VertexPointPMap_> Segment_property_map;
|
typedef Segment_from_edge_descriptor_map<HalfedgeGraph,VertexPointPMap_> Segment_property_map;
|
||||||
typedef Source_point_from_edge_descriptor<HalfedgeGraph,VertexPointPMap_> Point_property_map;
|
typedef Source_point_from_edge_descriptor_map<HalfedgeGraph,VertexPointPMap_> Point_property_map;
|
||||||
|
|
||||||
typedef AABB_primitive< Id_,
|
typedef AABB_primitive< Id_,
|
||||||
Segment_property_map,
|
Segment_property_map,
|
||||||
|
|
|
||||||
|
|
@ -1,196 +0,0 @@
|
||||||
// Copyright (c) 2012 GeometryFactory (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 Lesser General Public License as
|
|
||||||
// published by the Free Software Foundation; either version 3 of the License,
|
|
||||||
// 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.
|
|
||||||
// Author(s) : Sebastien Loriot
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef HALFEDGE_AND_FACE_GRAPH_PROPERTY_MAPS_H
|
|
||||||
#define HALFEDGE_AND_FACE_GRAPH_PROPERTY_MAPS_H
|
|
||||||
|
|
||||||
#include <CGAL/property_map.h>
|
|
||||||
#include <CGAL/boost/graph/properties.h>
|
|
||||||
#include <boost/type_traits/is_const.hpp>
|
|
||||||
#include <boost/mpl/if.hpp>
|
|
||||||
#include <boost/type_traits/remove_const.hpp>
|
|
||||||
|
|
||||||
namespace CGAL{
|
|
||||||
|
|
||||||
//property map
|
|
||||||
template <class FaceGraph,
|
|
||||||
class VertexPointPMap >
|
|
||||||
struct Triangle_from_face_descriptor_property_map{
|
|
||||||
typename boost::remove_const<FaceGraph>::type* m_graph;
|
|
||||||
VertexPointPMap m_vppm;
|
|
||||||
|
|
||||||
Triangle_from_face_descriptor_property_map() : m_graph(NULL)
|
|
||||||
{}
|
|
||||||
|
|
||||||
Triangle_from_face_descriptor_property_map(FaceGraph* g)
|
|
||||||
: m_graph( const_cast<typename boost::remove_const<FaceGraph>::type*>(g) ),
|
|
||||||
m_vppm( get(vertex_point, *m_graph) )
|
|
||||||
{}
|
|
||||||
|
|
||||||
Triangle_from_face_descriptor_property_map(FaceGraph* g,
|
|
||||||
VertexPointPMap vppm )
|
|
||||||
: m_graph(const_cast<typename boost::remove_const<FaceGraph>::type*>(g)),
|
|
||||||
m_vppm(vppm)
|
|
||||||
{}
|
|
||||||
|
|
||||||
typedef typename boost::property_traits< VertexPointPMap >::value_type Point_3;
|
|
||||||
typedef typename Kernel_traits<Point_3>::Kernel::Triangle_3 Triangle_3;
|
|
||||||
|
|
||||||
//classical typedefs
|
|
||||||
typedef typename boost::graph_traits<FaceGraph>::face_descriptor key_type;
|
|
||||||
typedef Triangle_3 value_type;
|
|
||||||
typedef value_type reference;
|
|
||||||
typedef boost::readable_property_map_tag category;
|
|
||||||
|
|
||||||
//get function for property map
|
|
||||||
inline friend
|
|
||||||
Triangle_3
|
|
||||||
get(const Triangle_from_face_descriptor_property_map<FaceGraph,VertexPointPMap>& pmap,
|
|
||||||
typename Triangle_from_face_descriptor_property_map<FaceGraph,VertexPointPMap>::key_type f)
|
|
||||||
{
|
|
||||||
typedef typename boost::property_traits< VertexPointPMap >::value_type Point_3;
|
|
||||||
typedef typename Kernel_traits<Point_3>::Kernel::Triangle_3 Triangle_3;
|
|
||||||
typename boost::remove_const<FaceGraph>::type & g = *(pmap.m_graph);
|
|
||||||
|
|
||||||
CGAL_precondition(halfedge(f,g) == next(next(next(halfedge(f,g),g),g),g));
|
|
||||||
const Point_3& a = get(pmap.m_vppm, target(halfedge(f,g),g));
|
|
||||||
const Point_3& b = get(pmap.m_vppm, target(next(halfedge(f,g),g),g));
|
|
||||||
const Point_3& c = get(pmap.m_vppm,target(next(next(halfedge(f,g),g),g),g));
|
|
||||||
|
|
||||||
return Triangle_3(a,b,c);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template < class HalfedgeGraph,
|
|
||||||
class VertexPointPMap >
|
|
||||||
struct Segment_from_edge_descriptor_property_map{
|
|
||||||
|
|
||||||
Segment_from_edge_descriptor_property_map() : m_graph(NULL)
|
|
||||||
{}
|
|
||||||
|
|
||||||
Segment_from_edge_descriptor_property_map(HalfedgeGraph* g)
|
|
||||||
: m_graph( const_cast<typename boost::remove_const<HalfedgeGraph>::type*>(g) ),
|
|
||||||
m_vppm( get(vertex_point, *m_graph) )
|
|
||||||
{}
|
|
||||||
|
|
||||||
Segment_from_edge_descriptor_property_map(HalfedgeGraph* g,
|
|
||||||
VertexPointPMap vppm )
|
|
||||||
: m_graph( const_cast<typename boost::remove_const<HalfedgeGraph>::type*>(g) ),
|
|
||||||
m_vppm(vppm)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//classical typedefs
|
|
||||||
typedef typename boost::property_traits< VertexPointPMap >::value_type Point;
|
|
||||||
typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor key_type;
|
|
||||||
typedef typename Kernel_traits<Point>::Kernel::Segment_3 value_type;
|
|
||||||
typedef value_type reference;
|
|
||||||
typedef boost::readable_property_map_tag category;
|
|
||||||
//data
|
|
||||||
typename boost::remove_const<HalfedgeGraph>::type* m_graph;
|
|
||||||
VertexPointPMap m_vppm;
|
|
||||||
|
|
||||||
//get function for property map
|
|
||||||
inline friend
|
|
||||||
value_type
|
|
||||||
get(Segment_from_edge_descriptor_property_map<HalfedgeGraph,VertexPointPMap> pmap,
|
|
||||||
key_type h)
|
|
||||||
{
|
|
||||||
typedef typename boost::property_traits< VertexPointPMap >::value_type Point;
|
|
||||||
typedef typename Kernel_traits<Point>::Kernel::Segment_3 Segment_3;
|
|
||||||
|
|
||||||
return Segment_3(get(pmap.m_vppm, source(h, *pmap.m_graph) ),
|
|
||||||
get(pmap.m_vppm, target(h, *pmap.m_graph) ) );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//property map to access a point from a facet handle
|
|
||||||
template <class FaceGraph,
|
|
||||||
class VertexPointPMap>
|
|
||||||
struct One_point_from_face_descriptor_property_map{
|
|
||||||
One_point_from_face_descriptor_property_map() : m_graph(NULL)
|
|
||||||
{}
|
|
||||||
|
|
||||||
One_point_from_face_descriptor_property_map(FaceGraph* g)
|
|
||||||
: m_graph( const_cast<typename boost::remove_const<FaceGraph>::type*>(g) )
|
|
||||||
, m_vppm( get(vertex_point, *m_graph) )
|
|
||||||
{}
|
|
||||||
|
|
||||||
One_point_from_face_descriptor_property_map(FaceGraph* g, VertexPointPMap vppm )
|
|
||||||
: m_graph( const_cast<typename boost::remove_const<FaceGraph>::type*>(g) ),
|
|
||||||
m_vppm(vppm)
|
|
||||||
{}
|
|
||||||
|
|
||||||
typename boost::remove_const<FaceGraph>::type* m_graph;
|
|
||||||
VertexPointPMap m_vppm;
|
|
||||||
|
|
||||||
//classical typedefs
|
|
||||||
typedef typename boost::graph_traits<FaceGraph>::face_descriptor key_type;
|
|
||||||
typedef typename boost::property_traits< VertexPointPMap >::value_type value_type;
|
|
||||||
typedef typename boost::property_traits< VertexPointPMap >::reference reference;
|
|
||||||
typedef boost::lvalue_property_map_tag category;
|
|
||||||
|
|
||||||
//get function for property map
|
|
||||||
inline friend
|
|
||||||
reference
|
|
||||||
get(const One_point_from_face_descriptor_property_map<FaceGraph,VertexPointPMap>& m,
|
|
||||||
key_type f)
|
|
||||||
{
|
|
||||||
return get(m.m_vppm, target(halfedge(f, *m.m_graph), *m.m_graph));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//property map to access a point from an edge
|
|
||||||
template < class HalfedgeGraph,
|
|
||||||
class VertexPointPMap >
|
|
||||||
struct Source_point_from_edge_descriptor{
|
|
||||||
Source_point_from_edge_descriptor() : m_graph(NULL)
|
|
||||||
{}
|
|
||||||
|
|
||||||
Source_point_from_edge_descriptor(HalfedgeGraph* g)
|
|
||||||
: m_graph( const_cast<typename boost::remove_const<HalfedgeGraph>::type*>(g) )
|
|
||||||
, m_vppm( get(vertex_point, *m_graph) )
|
|
||||||
{}
|
|
||||||
|
|
||||||
Source_point_from_edge_descriptor(
|
|
||||||
HalfedgeGraph* g,
|
|
||||||
VertexPointPMap vppm ) :
|
|
||||||
m_graph( const_cast<typename boost::remove_const<HalfedgeGraph>::type*>(g) ),
|
|
||||||
m_vppm(vppm)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//classical typedefs
|
|
||||||
typedef typename boost::property_traits< VertexPointPMap >::value_type value_type;
|
|
||||||
typedef typename boost::property_traits< VertexPointPMap >::reference reference;
|
|
||||||
typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor key_type;
|
|
||||||
typedef boost::readable_property_map_tag category;
|
|
||||||
//data
|
|
||||||
typename boost::remove_const<HalfedgeGraph>::type* m_graph;
|
|
||||||
VertexPointPMap m_vppm;
|
|
||||||
|
|
||||||
//get function for property map
|
|
||||||
inline friend
|
|
||||||
reference
|
|
||||||
get(Source_point_from_edge_descriptor<HalfedgeGraph,VertexPointPMap> pmap,
|
|
||||||
key_type h)
|
|
||||||
{
|
|
||||||
return get(pmap.m_vppm, source(h, *pmap.m_graph) );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} //namespace CGAL
|
|
||||||
|
|
||||||
#endif //HALFEDGE_AND_FACE_GRAPH_PROPERTY_MAPS_H
|
|
||||||
|
|
@ -0,0 +1,191 @@
|
||||||
|
// Copyright (c) 2012 GeometryFactory (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 Lesser General Public License as
|
||||||
|
// published by the Free Software Foundation; either version 3 of the License,
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
// Author(s) : Sebastien Loriot
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CGAL_BOOST_GRAPH_PROPERTY_MAPS_H
|
||||||
|
#define CGAL_BOOST_GRAPH_PROPERTY_MAPS_H
|
||||||
|
|
||||||
|
#include <CGAL/property_map.h>
|
||||||
|
#include <CGAL/boost/graph/properties.h>
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/type_traits/remove_const.hpp>
|
||||||
|
|
||||||
|
namespace CGAL{
|
||||||
|
|
||||||
|
//property map
|
||||||
|
template < class TriangleMesh,
|
||||||
|
class VertexPointMap >
|
||||||
|
struct Triangle_from_face_descriptor_map{
|
||||||
|
typename boost::remove_const<TriangleMesh>::type* m_tm;
|
||||||
|
VertexPointMap m_vpm;
|
||||||
|
|
||||||
|
Triangle_from_face_descriptor_map()
|
||||||
|
: m_tm(NULL)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Triangle_from_face_descriptor_map(TriangleMesh* tm)
|
||||||
|
: m_tm( const_cast<typename boost::remove_const<TriangleMesh>::type*>(tm) )
|
||||||
|
, m_vpm( get(vertex_point, *m_tm) )
|
||||||
|
{}
|
||||||
|
|
||||||
|
Triangle_from_face_descriptor_map(TriangleMesh* tm,
|
||||||
|
VertexPointMap vpm )
|
||||||
|
: m_tm(const_cast<typename boost::remove_const<TriangleMesh>::type*>(tm))
|
||||||
|
, m_vpm(vpm)
|
||||||
|
{}
|
||||||
|
|
||||||
|
typedef typename boost::property_traits< VertexPointMap >::value_type Point_3;
|
||||||
|
|
||||||
|
//classical typedefs
|
||||||
|
typedef typename boost::graph_traits<TriangleMesh>::face_descriptor key_type;
|
||||||
|
typedef typename Kernel_traits<Point_3>::Kernel::Triangle_3 value_type;
|
||||||
|
typedef value_type reference;
|
||||||
|
typedef boost::readable_property_map_tag category;
|
||||||
|
|
||||||
|
//get function for property map
|
||||||
|
inline friend
|
||||||
|
reference
|
||||||
|
get(const Triangle_from_face_descriptor_map<TriangleMesh,VertexPointMap>& pmap,
|
||||||
|
key_type f)
|
||||||
|
{
|
||||||
|
typename boost::remove_const<TriangleMesh>::type & tm = *(pmap.m_tm);
|
||||||
|
|
||||||
|
CGAL_precondition(halfedge(f,tm) == next(next(next(halfedge(f,tm),tm),tm),tm));
|
||||||
|
|
||||||
|
return value_type( get(pmap.m_vpm, target(halfedge(f,tm),tm)),
|
||||||
|
get(pmap.m_vpm, target(next(halfedge(f,tm),tm),tm)),
|
||||||
|
get(pmap.m_vpm, source(halfedge(f,tm),tm)) );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template < class PolygonMesh,
|
||||||
|
class VertexPointMap >
|
||||||
|
struct Segment_from_edge_descriptor_map{
|
||||||
|
|
||||||
|
Segment_from_edge_descriptor_map()
|
||||||
|
: m_pm(NULL)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Segment_from_edge_descriptor_map(PolygonMesh* pm)
|
||||||
|
: m_pm( const_cast<typename boost::remove_const<PolygonMesh>::type*>(pm) )
|
||||||
|
, m_vpm( get(vertex_point, *m_pm) )
|
||||||
|
{}
|
||||||
|
|
||||||
|
Segment_from_edge_descriptor_map(PolygonMesh* pm,
|
||||||
|
VertexPointMap vpm )
|
||||||
|
: m_pm( const_cast<typename boost::remove_const<PolygonMesh>::type*>(pm) )
|
||||||
|
, m_vpm(vpm)
|
||||||
|
{}
|
||||||
|
|
||||||
|
typedef typename boost::property_traits< VertexPointMap >::value_type Point_3;
|
||||||
|
|
||||||
|
//classical typedefs
|
||||||
|
typedef typename boost::graph_traits<PolygonMesh>::edge_descriptor key_type;
|
||||||
|
typedef typename Kernel_traits<Point_3>::Kernel::Segment_3 value_type;
|
||||||
|
typedef value_type reference;
|
||||||
|
typedef boost::readable_property_map_tag category;
|
||||||
|
//data
|
||||||
|
typename boost::remove_const<PolygonMesh>::type* m_pm;
|
||||||
|
VertexPointMap m_vpm;
|
||||||
|
|
||||||
|
//get function for property map
|
||||||
|
inline friend
|
||||||
|
reference
|
||||||
|
get(const Segment_from_edge_descriptor_map<PolygonMesh,VertexPointMap>& pmap,
|
||||||
|
key_type h)
|
||||||
|
{
|
||||||
|
return value_type(get(pmap.m_vpm, source(h, *pmap.m_pm) ),
|
||||||
|
get(pmap.m_vpm, target(h, *pmap.m_pm) ) );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//property map to access a point from a face_descriptor
|
||||||
|
template <class PolygonMesh,
|
||||||
|
class VertexPointMap>
|
||||||
|
struct One_point_from_face_descriptor_map{
|
||||||
|
One_point_from_face_descriptor_map()
|
||||||
|
: m_pm(NULL)
|
||||||
|
{}
|
||||||
|
|
||||||
|
One_point_from_face_descriptor_map(PolygonMesh* g)
|
||||||
|
: m_pm( const_cast<typename boost::remove_const<PolygonMesh>::type*>(g) )
|
||||||
|
, m_vpm( get(vertex_point, *m_pm) )
|
||||||
|
{}
|
||||||
|
|
||||||
|
One_point_from_face_descriptor_map(PolygonMesh* g, VertexPointMap vpm )
|
||||||
|
: m_pm( const_cast<typename boost::remove_const<PolygonMesh>::type*>(g) )
|
||||||
|
, m_vpm(vpm)
|
||||||
|
{}
|
||||||
|
|
||||||
|
typename boost::remove_const<PolygonMesh>::type* m_pm;
|
||||||
|
VertexPointMap m_vpm;
|
||||||
|
|
||||||
|
//classical typedefs
|
||||||
|
typedef typename boost::graph_traits<PolygonMesh>::face_descriptor key_type;
|
||||||
|
typedef typename boost::property_traits< VertexPointMap >::value_type value_type;
|
||||||
|
typedef typename boost::property_traits< VertexPointMap >::reference reference;
|
||||||
|
typedef boost::lvalue_property_map_tag category;
|
||||||
|
|
||||||
|
//get function for property map
|
||||||
|
inline friend
|
||||||
|
reference
|
||||||
|
get(const One_point_from_face_descriptor_map<PolygonMesh,VertexPointMap>& m,
|
||||||
|
key_type f)
|
||||||
|
{
|
||||||
|
return get(m.m_vpm, target(halfedge(f, *m.m_pm), *m.m_pm));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//property map to access a point from an edge
|
||||||
|
template < class PolygonMesh,
|
||||||
|
class VertexPointMap >
|
||||||
|
struct Source_point_from_edge_descriptor_map{
|
||||||
|
Source_point_from_edge_descriptor_map() : m_pm(NULL)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Source_point_from_edge_descriptor_map(PolygonMesh* g)
|
||||||
|
: m_pm( const_cast<typename boost::remove_const<PolygonMesh>::type*>(g) )
|
||||||
|
, m_vpm( get(vertex_point, *m_pm) )
|
||||||
|
{}
|
||||||
|
|
||||||
|
Source_point_from_edge_descriptor_map(PolygonMesh* g, VertexPointMap vpm )
|
||||||
|
: m_pm( const_cast<typename boost::remove_const<PolygonMesh>::type*>(g) )
|
||||||
|
, m_vpm(vpm)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//classical typedefs
|
||||||
|
typedef typename boost::property_traits< VertexPointMap >::value_type value_type;
|
||||||
|
typedef typename boost::property_traits< VertexPointMap >::reference reference;
|
||||||
|
typedef typename boost::graph_traits<PolygonMesh>::edge_descriptor key_type;
|
||||||
|
typedef boost::readable_property_map_tag category;
|
||||||
|
//data
|
||||||
|
typename boost::remove_const<PolygonMesh>::type* m_pm;
|
||||||
|
VertexPointMap m_vpm;
|
||||||
|
|
||||||
|
//get function for property map
|
||||||
|
inline friend
|
||||||
|
reference
|
||||||
|
get(const Source_point_from_edge_descriptor_map<PolygonMesh,VertexPointMap>& pmap,
|
||||||
|
key_type h)
|
||||||
|
{
|
||||||
|
return get(pmap.m_vpm, source(h, *pmap.m_pm) );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} //namespace CGAL
|
||||||
|
|
||||||
|
#endif // CGAL_BOOST_GRAPH_PROPERTY_MAPS_H
|
||||||
|
|
@ -21,9 +21,9 @@ main( )
|
||||||
vertex_point_t>::type Vertex_point_pmap;
|
vertex_point_t>::type Vertex_point_pmap;
|
||||||
typedef boost::property_map<Surface_mesh,
|
typedef boost::property_map<Surface_mesh,
|
||||||
vertex_point_t>::type Vertex_point_pmap_sm;
|
vertex_point_t>::type Vertex_point_pmap_sm;
|
||||||
typedef Triangle_from_face_descriptor_property_map<
|
typedef Triangle_from_face_descriptor_map<
|
||||||
Polyhedron,Vertex_point_pmap> Generator;
|
Polyhedron,Vertex_point_pmap> Generator;
|
||||||
typedef Triangle_from_face_descriptor_property_map<
|
typedef Triangle_from_face_descriptor_map<
|
||||||
Surface_mesh,Vertex_point_pmap_sm> Generator_SM;
|
Surface_mesh,Vertex_point_pmap_sm> Generator_SM;
|
||||||
typedef Random_points_in_triangle_3<Point> Creator;
|
typedef Random_points_in_triangle_3<Point> Creator;
|
||||||
typedef boost::graph_traits<Polyhedron>::face_descriptor face_iterator;
|
typedef boost::graph_traits<Polyhedron>::face_descriptor face_iterator;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue