|
![](/i/fill.gif) |
In article <3c7a8bec@news.povray.org>,
"Rune" <run### [at] mobilixnet dk> wrote:
> Thanks! This might be helpful to me if you provided information about which
> macros are used for what, what data types each macro takes as input and what
> they output, which macros are meant to be called by the user and which are
> called by other macros, and at least one working example for each macro
> designed to be called by the user.
I should have commented the thing before...
The macros starting with SPLINE_* are internal macros, not meant to be
seen by the user.
SPLINE_TYPE(Type)
Takes an integer value 0, 1, or 2, and parses linear_spline,
quadratic_spline, or cubic_spline depending on the value. It is used
together with the LINEAR_SPLINE, QUADRATIC_SPLINE, and CUBIC_SPLINE
#defines to tell the include what type of spline it is dealing with. The
spline macros use this to generate splines of a specified type.
Spline_Length(Spline, Intervals)
Computes the length of a spline by dividing it into a number of
intervals and computing the length of each interval. Assumes the spline
starts at 0 and ends at 1.
Spline_Interval_Length(Spline, StartT, EndT, Intervals)
Does the same as Spline_Length(), but finds the length of a specific
segment of the spline, defined by beginning and ending T values.
Spline_Length() isn't that necessary, you could use
"Spline_Interval_Length(Spline, 0, 1, Intervals)".
Constant_Speed_Spline(Spline, Type, Intervals, Samples)
Makes a new spline that follows the path of a given spline, but has the
T values tweaked to give constant speed. It doesn't use the actual
control points of the original, but generates several points along the
original spline. The number of spline segments for the new spline is
given with Intervals, Samples controls the number of intervals used to
determine the length of each segment.
SPLINE_FindNextT(StIdx, Array)
Used by Spline_From_Array() to find the next array entry with a defined
T value.
Spline_From_Array(Type, ConstantSpeedSamples, Array)
Creates a spline from an array of points and possibly time values. I
used a 2D array to specify time values "next to" the points, instead of
specifying them in pairs in a 1D array.
If a 1D array is given, it is interpreted as an array of points, the T
values of the resulting spline are evenly spaced.
If a 2D array is given, the first "row" (Array[N][0]) is taken as the T
values and the second (Array[N][1]) as the points, but some of the
points may be specified without T values. (If the given T for a point is
< 1, 0, 0>, the previous and next specified T values are interpolated.)
If ConstantSpeedSamples > 0, any given T values are ignored, the macro
computes them itself to get constant speed. ConstantSpeedSamples
specifies the number of samples used per segment to get the length of
that segment. Specify 0 samples to turn constant speed off and use one
of the first two methods...you can use the built-in constants "false",
"no", or "off" as well as just plain "0".
These macros never got finished...as I mentioned, I couldn't test them
properly because of bugs in the spline feature, so I never finished or
documented them. I think the constant spline method works though...
--
Christopher James Huff <chr### [at] mac com>
POV-Ray TAG e-mail: chr### [at] tag povray org
TAG web site: http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |