Subject: CGAL users discussion list
List archive
- From: babaOroms <>
- To:
- Subject: [cgal-discuss] Re: Is it the right way to do that
- Date: Wed, 5 Sep 2012 01:05:44 -0700 (PDT)
Thanks for your reply.
So with your advice, I think I am on the good way.
The intersection gives me a set of points but not segment.
So : Does my Build_polygon<HDS>::operator()( HDS& hds ) function (in the
first post) is the good way to populate my polyhedron, i.e only one facets
of several points (about one hundred)
Here is my code to have the intersections :
typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::AABB_polyhedron_segment_primitive<Kernel,Polyhedron>
Primitive;
typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef Tree::Object_and_primitive_id Object_and_primitive_id;
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
typedef Kernel::Plane_3 Plane;
typedef Kernel::Segment_3 Segment;
typedef Polyhedron::Halfedge Halfedge;
foreach(RPolygon3d* poly3d, RCavity3d::cavity->polygons()) { //iterates
all my polygons
poly3d->createCGALPolyhedron(); //create the polyhedron with
Build_polygon method
Polyhedron* m_pPolyhedron = poly3d->polyhedron(); //get the
polyhedron pointer
Tree
tree(m_pPolyhedron->halfedges_begin(),m_pPolyhedron->halfedges_end());
Vector normal((FT)0.0,(FT)0.0,(FT)1.0);
FT z = firstDepth;
Point p((FT)0.0, (FT)0.0, z);
Plane plane(p,normal);
std::list<Object_and_primitive_id> intersections;
tree.all_intersections(plane,std::back_inserter(intersections));
std::list<Object_and_primitive_id>::iterator it;
std::list<Segment> m_segments;
for(it = intersections.begin();
it != intersections.end();
it++)
{
Object_and_primitive_id op = *it;
CGAL::Object object = op.first;
Segment segment;
if(CGAL::assign(segment,object)) {
m_segments.push_back(segment); //never succeed because
result is points
}
}
}
I think I'm not so far.
Thanks in advance
And other question : Is it possible on this forum to write c++ code with
formatting (automatic color syntax and indentation)
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Is-it-the-right-way-to-do-that-tp4655791p4655799.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Is it the right way to do that, babaOroms, 09/04/2012
- Re: [cgal-discuss] Is it the right way to do that, Sebastien Loriot (GeometryFactory), 09/05/2012
- [cgal-discuss] Re: Is it the right way to do that, babaOroms, 09/05/2012
- Re: [cgal-discuss] Is it the right way to do that, Sebastien Loriot (GeometryFactory), 09/05/2012
Archive powered by MHonArc 2.6.18.