Pink 0.9

drawspline.c File Reference

draw a spline which is specified by its control points More...


Detailed Description

draw a spline which is specified by its control points

Usage: drawspline in.pgm spline.txt [len] out.pgm

Description: Draws a spline which is specified by its control points. The control points are read in the text file spline.txt . The parameter in.pgm gives an image into which the spline is to be drawn. The file format for spline.txt is the following for 2D:

c 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:

C 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

If parameter len is given and non-zero, the spline is extended on both sides by straight line segments of length len.

Types supported: byte 2D, byte 3D

Category: draw geo

Author:
Michel Couprie