Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Subdivide path by fixed displacements from one end?
- Date: Wed, 05 Sep 2012 07:17:52 +0200
- Organization: GeometryFactory
On 09/04/2012 05:32 PM, mathog wrote:
Given a 2D path P consisting of a series of linear and bezierI probably did not get what you want because to me it looks like you
segments, and a path distance pair {start,end} measured from a point
in P, can CGAL return the subpath corresponding to the section of P
inclusive of the distances from start to end?
If so how?
This is for an application that needs to convert a path with an
arbitrary dot/dash pattern into a set of discrete paths, because a 2nd
application which needs to read this data has no other support for
reading dotted/dashed pairs. In the first application the pattern is
actually written as a series of emit/omit lengths, for example
{3,1,2,1}, which would emit 0->3, omit 3->4, emit 4->6, omit 6->7,
then repeat lengths again. Implementing this loop would be fastest if
CGAL had something like (pseudocode)
new subpath = get_subpath(P, &point_on_P, start, end, &wrap);
where point_on_P would initially be the first point in P and the
method/function returned the point corresponding to "end". Wrap would
return a value >0 whenever the subpath start->end fell on or beyond
P.end() (not the start point), and would be the length beyond which
the specified interval extended. So for the 3,1,2,1 example the calls
would be (not including tests on wrap)
point_on_P = P.begin();
path1 = get_subpath(P, &point_on_p, 0, 3, &wrap); // 3 dash
path2 = get_subpath(P, &point_on_p, 1, 3, &wrap); // 2 dash
path3 = get_subpath(P, &point_on_p, 1, 4, &wrap); // 3 dash
path4 = get_subpath(P, &point_on_p, 1, 3, &wrap); // etc.
path5 = get_subpath(P, &point_on_p, 1, 4, &wrap);
Thank you.
David Mathog
Manager, Sequence Analysis Facility, Biology Division, Caltech
need to extract subsets of points from a container and put that into
another container. In that case, using STL algorithms is sufficient.
Sebastien.
- [cgal-discuss] Subdivide path by fixed displacements from one end?, mathog, 09/04/2012
- Re: [cgal-discuss] Subdivide path by fixed displacements from one end?, Sebastien Loriot (GeometryFactory), 09/05/2012
Archive powered by MHonArc 2.6.18.