Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

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


Chronological Thread 
  • From: "t.doehring" <>
  • To:
  • Subject: Re: [cgal-discuss] Input a 3-D polyline from a list of points.
  • Date: Thu, 9 Jun 2011 11:19:36 -0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; b=pE+q/mRY/JptC7oCUW4eimszzbQ7AkfZVDFciQe9LpqJ2xKZjXKsobKzuPLQshmCJX /0V2sadtXDAYYtTP2xf1X8Fvl8gyl2p7yy/MxXu2pp2u/Qne+55HeMo9l+KPin1iH0HR nR/MUFLv0kmlbCxA805XPEmk41bwvdlkfd8Gs=

Thank you Sebastien!
This is a big help, and yes i did mean loading from a file.
I'll give this a try, it looks pretty simple.
Now all I have to do then (as far as I know) is add these polylines as a feature for the mesh generator.
thanks again,
Todd

On Thu, Jun 9, 2011 at 2:53 AM, Sebastien Loriot (GeometryFactory) <sloriot.ml@gmail.com> 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





Archive powered by MHonArc 2.6.16.

Top of Page