Usage: points2spline points.txt spline.txt
Description:
Let S be the sequence of control points in points.txt. This program computes a parametric curve P defined by two (in 2D) or three (in 3D) splines that interpolates the points of the sequence S.
If the last point equals the first point, then a closed spline is generated.
The result is given in the form of the list of control points, followed by the set of coefficients for each spline segment. The file format is the following for 2D:
s n+1 (where n+1 denotes the number of control points)
x1 y1
...
xn+1 yn+1
C0X1 C0Y1 C1X1 C1Y1 C2X1 C2Y1 C3X1 C3Y1
...
C0Xn C0Yn C1Xn C1Yn C2Xn C2Yn C3Xn C3Yn
and in the 3D case:
S n+1 (where n+1 denotes the number of control points)
x1 y1 z1
...
xn+1 yn+1 zn+1
C0X1 C0Y1 C0Z1 C1X1 C1Y1 C1Z1 C2X1 C2Y1 C2Z1 C3X1 C3Y1 C3Z1
...
C0Xn C0Yn C0Zn C1Xn C1Yn C1Zn C2Xn C2Yn C2Zn C3Xn C3Yn C3Zn
The ith segment of the parametric curve P is then defined by:
x(t) = C3Xi * t^3 + C2Xi * t^2 + C1Xi * t + C0Xi
y(t) = C3Yi * t^3 + C2Yi * t^2 + C1Yi * t + C0Yi
z(t) = C3Zi * t^3 + C2Zi * t^2 + C1Zi * t + C0Zi
with t in [0,1]
Types supported: list 2D, list 3D
Category: draw geo