New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Splines/splinegons through given points #140

Open
Mortal opened this Issue May 17, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@Mortal

Mortal commented May 17, 2017

A C implementation of an algorithm to draw a spline through given points exists in the tinyspline project:

ipeex2

Currently, Ipe only supports drawing splines with given control points:

ipeex1

Example source code

I drew the first image using the tinyspline Python bindings as follows:

import tinyspline
points = [5.26995, 9.95966, 20.8617, 10.6765, 51.6869, 65.5166, 29.4641, 66.2335, 42.3677, 9.60123, 58.3179, 17.3075, 66.3826, 32.5409, 69.2501, 18.9205, 68.1748, 1.71572, 65.6658, 18.0244, 69.9669, 30.5695, 82.8705, 29.8526, 79.6446, 18.9205, 86.8133, 13.1855, 97.9246, 18.562, 114.413, 23.0424, 112.262, 28.9566, 98.2831, 25.7307, 97.9246, 13.9024, 116.563, 9.06358, 143.087, 15.5154]
o = tinyspline.Utils.interpolateCubic(points, 2)
print('\n'.join('%g %g m %g %g %g %g %g %g c' % tuple(o.ctrlp[i:i+8]) for i in range(0, len(o.ctrlp), 8)))

There's a tinyspline issue about supporting splinegon interpolation in the project.

@otfried

This comment has been minimized.

Show comment
Hide comment
@otfried

otfried May 18, 2017

Owner

Adding interpolated splines has been on my todo list for many years.

The question is what model to choose. Xfig, for instance, has always had interpolated splines, both open and closed. Apparently they switched to a new spline model that can be both interpolating and approximating in Xfig 3.2.

At some point many Ipe users came from Xfig, and it would have been desirable to be able to support interpolating splines when converting xfig figures. I'm not sure how important this is today.

Does Inkscape have interpolating splines?

There are other nice splines - clothoid splines (http://libspiro.sourceforge.net/), for instance, allow you to have both continuous curvature and continuous slope, and look better than B-splines.

If you want to see interpolated splines in Ipe, please start a discussion on ipe-discuss to get some consensus of what these splines should look like.

Owner

otfried commented May 18, 2017

Adding interpolated splines has been on my todo list for many years.

The question is what model to choose. Xfig, for instance, has always had interpolated splines, both open and closed. Apparently they switched to a new spline model that can be both interpolating and approximating in Xfig 3.2.

At some point many Ipe users came from Xfig, and it would have been desirable to be able to support interpolating splines when converting xfig figures. I'm not sure how important this is today.

Does Inkscape have interpolating splines?

There are other nice splines - clothoid splines (http://libspiro.sourceforge.net/), for instance, allow you to have both continuous curvature and continuous slope, and look better than B-splines.

If you want to see interpolated splines in Ipe, please start a discussion on ipe-discuss to get some consensus of what these splines should look like.

@otfried otfried self-assigned this May 18, 2017

@otfried otfried added the enhancement label May 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment