[NTG-context] Iterating over MP paths (was: Fuzzy lines)
Henning Hraban Ramm
texml at fiee.net
Fri Jan 21 19:00:45 CET 2022
Am 03.09.21 um 18:04 schrieb Henning Hraban Ramm via ntg-context:
> Would it make sense to check if a point is an edge point (without curve controls)?
In a private reply to my old message, Hans explained to me why this was
not possible like I thought (check if the point has control points),
since every point has control points.
But I didn’t keep at it last fall, and the MP foo is still weak in this
one, so, let’s try again:
If I iterate over the points of a path like in
p = (0,0) .. (2cm,4cm) -- (4cm,5cm) .. (5cm,6cm) .. (8cm,7cm);
draw p withpen pencircle scaled 2pt withcolor .7 white;
for t=0 upto length p:
drawdot point t of p withpen pencircle scaled 4pt withcolor red;
How can I check if the point is an edge?
(I want to randomize only the non-edge points.)
1. First or last point: if t=0 or t=length p.
... if the path is not closed: if not cycle p.
2. Would it make sense to check curl or tension?
Can I check if the connection is specified as -- ?
Other question on the examples from
in the answer by Thruston:
I want to split the path between (edge) points in segments of the same
length. So disregarding the "edge" issue for now, how do I get at the
path segment between points (in the for loop above) so that I can use it
as a new path q in:
for t=0 step s until arclength q:
drawdot point arctime t of q of q withpen pencircle scaled 4pt
More information about the ntg-context