Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] using C3T3::Facet_iterator with AABB_Tree

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] using C3T3::Facet_iterator with AABB_Tree


Chronological Thread 
  • From: Frankie Li <>
  • To:
  • Subject: Re: [cgal-discuss] using C3T3::Facet_iterator with AABB_Tree
  • Date: Tue, 27 Sep 2011 11:28:23 -0400

Hi Sebastien,

Thanks for the reply. In fact, that's what I've done. The problem I run into seems to be specifically that Iterator_no_in_complex from Mesh_complex_3_in_triangulation_3.h contains a const &, specifically:

class Iterator_not_in_complex
{
const Self& r_self_;
public:
Iterator_not_in_complex(const Self& self) : r_self_(self) { }

template <typename Iterator>
bool operator()(Iterator it) const
{
return !r_self_.is_in_complex(*it);
}
}; // end class Iterator_not_in_complex

(I'm again looking at CGAL-3.6...)

I might be making some other mistakes, but it seems like this disallows the use of operator=, which results in errors from lines like this:

typename Primitive::Id m_closest_primitive = primitive.id();

Below is the my copy-paste-adapt.

Thanks,


Frankie

//----------------------------------------------------
template< class C3T3, class AABB_Kernel >
class AABB_mesh_3_triangle_primitive
{
public:
typedef typename C3T3::Triangulation Triangulation;
/// AABBPrimitive types
typedef AABB_Kernel GeomTraits;
typedef typename GeomTraits::Point_3 Point;
typedef typename GeomTraits::Triangle_3 Datum;
typedef typename C3T3::Facet_iterator Id;
typedef typename Triangulation::Geom_traits Tr_Kernel;
typedef typename Tr_Kernel::Triangle_3 Tr_Triangle_3;

typedef CGAL::Cartesian_converter< Tr_Kernel, GeomTraits> TrKernel_To_AABB;
/// Constructors
AABB_mesh_3_triangle_primitive() {}
AABB_mesh_3_triangle_primitive(const AABB_mesh_3_triangle_primitive& primitive)
: m_facet_handle( primitive.id() ), m_Datum( primitive.datum() )
{}

AABB_mesh_3_triangle_primitive(Id handle)
: m_facet_handle( handle )
{
TrKernel_To_AABB To_AABB;
m_Datum = To_AABB( Tr_Triangle_3 ( handle->first->vertex( (handle->second+1) & 3)->point(),
handle->first->vertex( (handle->second+2) & 3)->point(),
handle->first->vertex( (handle->second+3) & 3)->point() ) );
}

Datum datum() const
{ return m_Datum; }

Point reference_point() const
{ return m_Datum.vertex(0); }
const Id& id() const { return m_facet_handle; }
Id& id() { return m_facet_handle; }
private:
Id m_facet_handle;
Datum m_Datum;
};



On 09/27/2011 04:07 AM, Sebastien Loriot (GeometryFactory) wrote:
You need to write you own model of AABBPrimitive

see here:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/AABB_tree_ref/Concept_AABBPrimitive.html


The easy way to do it is to copy-paste-adapt the code of
AABB_polyhedron_triangle_primitive.

Sebastien.

Frankie Li wrote:
Hi all,

Is there a way to use the Facet_iterator (or
Facets_in_complex_iterator) with AABB. My end goal is to put all of
the boundary facets from a Complex 3 in triangulation 3 into an
AABB_Tree, but Facet_iterator is non-mutable.

The only alternative I've come up with is to use a filtered_iterator
with finite_facet_iterator from
c3t3.triangulation().finite_facet_begin().


Thanks!


Frankie






Archive powered by MHonArc 2.6.16.

Top of Page