mirror of https://github.com/CGAL/cgal
Fix polyhedral oracle. Add class AABB_const_polyhedron_triangle_primitive.
This commit is contained in:
parent
51c1715065
commit
50a9d76db0
|
|
@ -16,7 +16,7 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Author(s) : Pierre Alliez, Laurent Rineau, Stephane Tayeb
|
// Author(s) : Pierre Alliez, Laurent Rineau, Stephane Tayeb
|
||||||
|
|
||||||
#ifndef CGAL_AABB_POLYHEDRAL_ORACLE_H
|
#ifndef CGAL_AABB_POLYHEDRAL_ORACLE_H
|
||||||
#define CGAL_AABB_POLYHEDRAL_ORACLE_H
|
#define CGAL_AABB_POLYHEDRAL_ORACLE_H
|
||||||
|
|
@ -49,9 +49,10 @@ namespace CGAL {
|
||||||
typedef Self Surface_3;
|
typedef Self Surface_3;
|
||||||
|
|
||||||
// AABB tree
|
// AABB tree
|
||||||
typedef typename AABB_polyhedron_triangle_primitive<Kernel, Polyhedron> AABB_primitive;
|
typedef AABB_const_polyhedron_triangle_primitive<Kernel, Polyhedron>
|
||||||
typedef typename AABB_traits<Kernel,AABB_primitive> AABB_traits;
|
AABB_primitive;
|
||||||
typedef typename AABB_tree<AABB_traits> Tree;
|
typedef class AABB_traits<Kernel,AABB_primitive> AABB_traits;
|
||||||
|
typedef AABB_tree<AABB_traits> Tree;
|
||||||
typedef typename AABB_traits::Bounding_box Bounding_box;
|
typedef typename AABB_traits::Bounding_box Bounding_box;
|
||||||
|
|
||||||
typedef boost::shared_ptr<Tree> Tree_shared_ptr;
|
typedef boost::shared_ptr<Tree> Tree_shared_ptr;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ namespace CGAL {
|
||||||
class AABB_polyhedron_triangle_primitive
|
class AABB_polyhedron_triangle_primitive
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// AABBTrianglePrimitive types
|
/// AABBPrimitive types
|
||||||
typedef typename GeomTraits::Point_3 Point;
|
typedef typename GeomTraits::Point_3 Point;
|
||||||
typedef typename GeomTraits::Triangle_3 Datum;
|
typedef typename GeomTraits::Triangle_3 Datum;
|
||||||
typedef typename Polyhedron::Facet_handle Id;
|
typedef typename Polyhedron::Facet_handle Id;
|
||||||
|
|
@ -48,19 +48,25 @@ namespace CGAL {
|
||||||
AABB_polyhedron_triangle_primitive(const Id& handle)
|
AABB_polyhedron_triangle_primitive(const Id& handle)
|
||||||
: m_facet_handle(handle) { };
|
: m_facet_handle(handle) { };
|
||||||
|
|
||||||
// Default copy constructor and assignment operator are ok
|
// Default destructor, copy constructor and assignment operator are ok
|
||||||
|
|
||||||
/// Destructor
|
|
||||||
~AABB_polyhedron_triangle_primitive() {};
|
|
||||||
|
|
||||||
/// Returns by constructing on the fly the geometric datum wrapped by the primitive
|
/// 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
|
/// Returns a point on the primitive
|
||||||
Point reference_point() const;
|
Point reference_point() const
|
||||||
|
{
|
||||||
|
return m_facet_handle->halfedge()->vertex()->point();
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the identifier
|
/// Returns the identifier
|
||||||
const Id id() const { return m_facet_handle; }
|
Id id() const { return m_facet_handle; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The id, here a polyhedron facet handle
|
/// The id, here a polyhedron facet handle
|
||||||
|
|
@ -68,23 +74,48 @@ namespace CGAL {
|
||||||
}; // end class AABB_polyhedron_triangle_primitive
|
}; // end class AABB_polyhedron_triangle_primitive
|
||||||
|
|
||||||
|
|
||||||
template<typename GT, typename P_>
|
/**
|
||||||
typename AABB_polyhedron_triangle_primitive<GT,P_>::Datum
|
* @class AABB_const_polyhedron_triangle_primitive
|
||||||
AABB_polyhedron_triangle_primitive<GT,P_>::datum() const
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template<typename GeomTraits, typename Polyhedron>
|
||||||
|
class AABB_const_polyhedron_triangle_primitive
|
||||||
{
|
{
|
||||||
typedef typename GT::Point_3 Point;
|
public:
|
||||||
const Point& a = m_facet_handle->halfedge()->vertex()->point();
|
/// AABBPrimitive types
|
||||||
const Point& b = m_facet_handle->halfedge()->next()->vertex()->point();
|
typedef typename GeomTraits::Point_3 Point;
|
||||||
const Point& c = m_facet_handle->halfedge()->next()->next()->vertex()->point();
|
typedef typename GeomTraits::Triangle_3 Datum;
|
||||||
return Datum(a,b,c);
|
typedef typename Polyhedron::Facet_const_handle Id;
|
||||||
}
|
|
||||||
|
|
||||||
template<typename GT, typename P_>
|
/// Constructors
|
||||||
typename AABB_polyhedron_triangle_primitive<GT,P_>::Point
|
AABB_const_polyhedron_triangle_primitive(const Id& handle)
|
||||||
AABB_polyhedron_triangle_primitive<GT,P_>::reference_point() const
|
: m_facet_handle(handle) { };
|
||||||
{
|
|
||||||
return m_facet_handle->halfedge()->vertex()->point();
|
// 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
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
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
|
} // end namespace CGAL
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue