Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] How to get Contour of the intersection plane and polyhedron

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] How to get Contour of the intersection plane and polyhedron


Chronological Thread 
  • From: 马良 <>
  • To:
  • Subject: Re: [cgal-discuss] How to get Contour of the intersection plane and polyhedron
  • Date: Tue, 17 Jul 2012 08:50:36 +0800

Hello Sebastien Loriot,
      Thank you replay.
      Yes, I test the example of AABB tree demo. There is no problem to caculate intersections between a plane and polyhedron.
      But, the results of intersections are many Segment object. I debug those segments, and find that those intersetion segments is no end to end Sequentially. 
      I want to find loops (segment attach together sequentially).
      
      My question:How to constitute "Loops" using those segments??


2012/7/13 Sebastien Loriot (GeometryFactory) <>
If you run the AABB_tree demo, you can open an off file (simple to
create from stl), then
run  Algorithms ->cut plane -> intersection.

You can extract the code from the demo (file Scene.cpp function
cut_segment_plane).

The principal is simple: you create an aabb_tree using the facets of the
mesh, and you
create all intersections with you plane.

See:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/AABB_tree_ref/Class_AABB_tree.html

Sebastien.

On 07/13/2012 03:29 AM, 马良 wrote:
> Hi
> I read a STL-file (a kind of file using in RapidPrototyping, a triangle
> in STL is composed of 3-Point and normal). And I create a Polyhedron
> like a following.
> Polyhedron P;
> P.make_triangle(V1,V2,V3);
> P.make_triangle(V4,V5,V6);
> ....
> //Then, I create AABB tree, as follows:
> Facet_tree tree(P.facets_begin(),P.facets_end());
> //Next, I create a plane and caculate intersections between plane and
> polyhedron
> Vector nor(0,0,1);
> Point pnt(0,0,0.5);
> Plane plane(pnt,nor);
> tree.all_intersections(plane,std::back_inserter(Intersetions));
> //Here, I get intersetions (Points: (X,Y,Z))
> for( it = Intersetions.begin();it !=Intersections.end();it++)
> {
> if(CGAL::assign(segment,object) m_segment.push_back(segment);
> }
> // But, I get a lot of segments. And Here I want get contours (a contour
> is composed of segments in order).
> My question is How to constitute contours using segments. Whether or not
> I must sort those segments by myself? Here is a algorithm in CGAL?
> Thanks!
>
> --
> 马良 Mr.MaLiang
> State Key Laboratory of Solidification Processing
> Northwestern Polytechnical University
> Xi'an 710072, Shanxi
> P. R. China
> Tel/Fax:+86(29)88460520
> Mobile:+86(0)15829297776
> Email: <mailto:>
> QQ number:394646034
>


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss





--
马良  Mr.MaLiang
State Key Laboratory of Solidification Processing
Northwestern Polytechnical University
Xi'an 710072, Shanxi
P. R. China
Tel/Fax:+86(29)88460520
Mobile:+86(0)15829297776
Email:
QQ number:394646034




Archive powered by MHonArc 2.6.18.

Top of Page