Fix polyhedral oracle. Add class AABB_const_polyhedron_triangle_primitive.

This commit is contained in:
Stéphane Tayeb 2009-04-27 13:25:46 +00:00
parent 51c1715065
commit 50a9d76db0
2 changed files with 59 additions and 27 deletions

View File

@ -49,9 +49,10 @@ namespace CGAL {
typedef Self Surface_3;
// AABB tree
typedef typename AABB_polyhedron_triangle_primitive<Kernel, Polyhedron> AABB_primitive;
typedef typename AABB_traits<Kernel,AABB_primitive> AABB_traits;
typedef typename AABB_tree<AABB_traits> Tree;
typedef AABB_const_polyhedron_triangle_primitive<Kernel, Polyhedron>
AABB_primitive;
typedef class AABB_traits<Kernel,AABB_primitive> AABB_traits;
typedef AABB_tree<AABB_traits> Tree;
typedef typename AABB_traits::Bounding_box Bounding_box;
typedef boost::shared_ptr<Tree> Tree_shared_ptr;

View File

@ -36,7 +36,7 @@ namespace CGAL {
class AABB_polyhedron_triangle_primitive
{
public:
/// AABBTrianglePrimitive types
/// AABBPrimitive types
typedef typename GeomTraits::Point_3 Point;
typedef typename GeomTraits::Triangle_3 Datum;
typedef typename Polyhedron::Facet_handle Id;
@ -48,19 +48,25 @@ namespace CGAL {
AABB_polyhedron_triangle_primitive(const Id& handle)
: m_facet_handle(handle) { };
// Default copy constructor and assignment operator are ok
/// Destructor
~AABB_polyhedron_triangle_primitive() {};
// Default destructor, copy constructor and assignment operator are ok
/// Returns by constructing on the fly the geometric datum wrapped by the primitive
Datum datum() const;
Datum datum() const
{
const Point& a = m_facet_handle->halfedge()->vertex()->point();
const Point& b = m_facet_handle->halfedge()->next()->vertex()->point();
const Point& c = m_facet_handle->halfedge()->next()->next()->vertex()->point();
return Datum(a,b,c);
}
/// Returns a point on the primitive
Point reference_point() const;
Point reference_point() const
{
return m_facet_handle->halfedge()->vertex()->point();
}
/// Returns the identifier
const Id id() const { return m_facet_handle; }
Id id() const { return m_facet_handle; }
private:
/// The id, here a polyhedron facet handle
@ -68,24 +74,49 @@ namespace CGAL {
}; // end class AABB_polyhedron_triangle_primitive
template<typename GT, typename P_>
typename AABB_polyhedron_triangle_primitive<GT,P_>::Datum
AABB_polyhedron_triangle_primitive<GT,P_>::datum() const
/**
* @class AABB_const_polyhedron_triangle_primitive
*
*
*/
template<typename GeomTraits, typename Polyhedron>
class AABB_const_polyhedron_triangle_primitive
{
public:
/// AABBPrimitive types
typedef typename GeomTraits::Point_3 Point;
typedef typename GeomTraits::Triangle_3 Datum;
typedef typename Polyhedron::Facet_const_handle Id;
/// Constructors
AABB_const_polyhedron_triangle_primitive(const Id& handle)
: m_facet_handle(handle) { };
// Default destructor, copy constructor and assignment operator are ok
/// Returns by constructing on the fly the geometric datum wrapped by the primitive
Datum datum() const
{
typedef typename GT::Point_3 Point;
const Point& a = m_facet_handle->halfedge()->vertex()->point();
const Point& b = m_facet_handle->halfedge()->next()->vertex()->point();
const Point& c = m_facet_handle->halfedge()->next()->next()->vertex()->point();
return Datum(a,b,c);
}
template<typename GT, typename P_>
typename AABB_polyhedron_triangle_primitive<GT,P_>::Point
AABB_polyhedron_triangle_primitive<GT,P_>::reference_point() const
/// Returns a point on the primitive
Point reference_point() const
{
return m_facet_handle->halfedge()->vertex()->point();
}
/// Returns the identifier
Id id() const { return m_facet_handle; }
private:
/// The id, here a polyhedron facet handle
Id m_facet_handle;
}; // end class AABB_polyhedron_triangle_primitive
} // end namespace CGAL