Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Input a 3-D polyline from a list of points.
- Date: Thu, 09 Jun 2011 08:53:30 +0200
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.
- [cgal-discuss] Input a 3-D polyline from a list of points., toddoe, 06/08/2011
- Re: [cgal-discuss] Input a 3-D polyline from a list of points., Sebastien Loriot (GeometryFactory), 06/09/2011
- Re: [cgal-discuss] Input a 3-D polyline from a list of points., t.doehring, 06/09/2011
- [cgal-discuss] Re: Input a 3-D polyline from a list of points., toddoe, 06/09/2011
- Re: [cgal-discuss] Input a 3-D polyline from a list of points., Sebastien Loriot (GeometryFactory), 06/09/2011
Archive powered by MHonArc 2.6.16.