Ofnuts (ofn...@laposte.net) wrote:
> Why is gimp_vectors_bezier_stroke_lineto(vectors, stroke_id, x0, y0) 
> (and Stroke.lineto(x,y)) working backwards? If I add a lineto() to the 
> stroke, the point of origin
> (the one returned by gimp_vectors_stroke_get_point_at_dist(0,..)) 
> changes... I'm sure there is a good reason, but I can't find it. Can 
> someone enlighten me?

The reason is simply the internal data structure as well as a
(possibly over-)optimzation in the code. A lineto basically needs to add
three anchors to the list of anchors. If the "current point" is the
beginning of the list, you can add these three anchors in an O(1)
operation. If you'd append them to the end you'd have to first search
for the end, making this an O(n) operation (unless you of course keep
track of the other end).

The API does not guarantee consistency for the distance->point mapping
when the length of the total path changes. When I designed the API I
tried to avoid the idea of a specific "start" and "end" for each stroke,
since this would introduce a directionality which would not be visible
in the User Interface.

Do you need to have get_point_at_dist(0...) staying constant while
constructing the stroke with the _lineto-family of commands?


              si...@budig.de              http://simon.budig.de/
Gimp-developer mailing list

Reply via email to