Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Re: Input a 3-D polyline from a list of points.

Subject: CGAL users discussion list

List archive

[cgal-discuss] Re: Input a 3-D polyline from a list of points.


Chronological Thread 
  • From: toddoe <>
  • To:
  • Subject: [cgal-discuss] Re: Input a 3-D polyline from a list of points.
  • Date: Thu, 9 Jun 2011 08:23:36 -0700 (PDT)

Thank you very much, this is a big help!
now all I have to do is add 'polylines' as a feature for the mesh generator.
thx,
todd

On Thu, Jun 9, 2011 at 2:56 AM, Sebastien Loriot (GeometryFactory) [via cgal-discuss] <[hidden email]> wrote:
I am not sure to get you problem. Are you talking about importing
polylines from a file?

The following code reads polylines given as:
n x1 y1 z1 x2 y2 z2 ...... xn yn zn
n x1 y1 z1 x2 y2 z2 ...... xn yn zn
n x1 y1 z1 x2 y2 z2 ...... xn yn zn



   std::list<std::vector<Point_3> > polylines;
   std::ifstream ifs(filename);
   std::size_t n;
   while(ifs >> n) {
     polylines.resize(polylines.size()+1);
     std::vector<Point_3>& polyline = polylines.back();
     while(n--){
       Point_3 p;
       ifs >> p;
       polyline.push_back(p);
     }
   }

Sebastien.

toddoe wrote:

> Hi All,
>
> sorry if this is a 'noob' question, but i'm relatively new to C++ and I'm
> having trouble figuring out how to import a 3-D points list and generate a
> 'curve'. Basically, what I want to do is import/add a polyline as a
> 'feature' for the 3-D mesh generator. I can see from the examples that i
> need to use:
>
> // Polyline
> typedef std::vector<Point>        Polyline;
> typedef std::list<Polyline>       Polylines;
>
> Polylines polylines (1);
> Polyline& polyline = polylines.front();
>
> and then add the points in order as in the example (the two spheres example
> in the manual), but i can't quite figure out how to import the points and
> create the polyline, especially since ulitmately i will have multiple
> polylines (features) that I will need to preserve in the 3D mesh...
>
> I hope this is enough info for someone to help, or hopefully provide a piece
> of example code. I'm sure this is a really simple thing for some of you
> expert out there. I did search the forums and manual carefully on this topic
> but didn't find anything related.
>
> Thanks in advance,
> todd
>
> --
> View this message in context: http://cgal-discuss.949826.n4.nabble.com/Input-a-3-D-polyline-from-a-list-of-points-tp3583317p3583317.html
> Sent from the cgal-discuss mailing list archive at Nabble.com.
>


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




If you reply to this email, your message will be added to the discussion below:
http://cgal-discuss.949826.n4.nabble.com/Input-a-3-D-polyline-from-a-list-of-points-tp3583317p3584697.html
To unsubscribe from Input a 3-D polyline from a list of points., click here.



View this message in context: Re: Input a 3-D polyline from a list of points.
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.16.

Top of Page