otfried / ipe

The Ipe extensible drawing editor
http://ipe.otfried.org
125 stars 9 forks source link

Non-uniform transformation of spiro splines #491

Closed Marian-Braendle closed 4 months ago

Marian-Braendle commented 6 months ago

Hi,

I am currently writing an Ipelet that uses ipe.splineToBeziers to convert/approximate all different types of splines available in Ipe into Beziers. However, I have noticed a special characteristic of Spiro Splines. With non-uniform scaling, these do not scale proportionally to their control points. In my case, I could easily work around this by first converting the spiro spline to Beziers and only then applying the transformation matrix of the object.

However, the incorrect handling of the special property of Spiro Splines is visible in the GUI:

Scaling of spiro splines

I'm not even sure if it's possible to fix this in a meaningful way. It could well be that a stretched spiro spline itself cannot simply be represented as a spiro spline. I'm not familiar enough with the subject.

Nevertheless, I wanted to point out the problem. If there is no practical solution, the issue can probably be closed again :smiley:

Context

otfried commented 6 months ago

Since spiro splines are defined as minimizing changes in curvature, they are not invariant under affine transformations - so there isn't really a fully satisfactory solution to this. One could argue that the right behaviour would be for the spline to remain a spiro spline as soon as you apply the transformation to it. On the other hand, the current behaviour allows you to play tricks that otherwise wouldn't be possible, and there isn't really any way for me to implement that behaviour once the spiro spline is inside a group (a group is transformed simply by updating its matrix, the transform is not forwarded to the members).