|
|
In article <3a06459f$1@news.povray.org>, "Mark Wagner"
<mar### [at] gtenet> wrote:
> >I don't have any experience with growing dynamically allocated
> >arrays...I tend to use linked lists for everything.
> I've already got the code for this written -- it's just a matter of
> copying it from my personal version to SkyPOV.
:-)
> I think that, usage-wise, it would be better to use the array syntax.
> This would allow points to be changed and read using a single
> syntax.
Arrays don't have any special syntax for insertion...and I don't think
reading the points with [] brackets will be very easy. As for changing
existing points...what would this do?
#declare Spl[2] = 0.4;
Would this set the t value of the third point to 0.4, or would it set
the x value? Also, this syntax would be a problem for using arrays of
splines.
I would suggest using functions for most of these:
Getting number of control points:
INT spline_points(SPLINE_IDENT)
Reading a point:
FLOAT get_spline_t(SPLINE_IDENT, INDEX)
Returns the "distance" of the point at INDEX.
EXPRESS get_spline_value(SPLINE_IDENT, INDEX)
Returns the value of the spline at INDEX. I'm not sure how to handle
floats, vectors, and colors...maybe this function will work for all of
them.
Modifying a point:
set_spline_t(SPLINE_IDENT, INT_INDEX, FLOAT_NEW_T)
Changes the "distance" of the point at INDEX.
set_spline_value(SPLINE_IDENT, INT_INDEX, EXPRESS_VALUE)
Changes the value of the spline at INDEX. You can specify a float,
vector, color...
Adding a point should be possible already, it should work fine with the
modifications I made(mainly the fix to Copy_Spline()). Just do something
like this:
#declare Spline = spline {Spline NEW_POINTS}
And one other thing that should probably be taken care of: multiple
points with the same t value should probably not be allowed. New points
with the same t value of an existing point should replace that point. I
don't remember seeing anything about this in the source code...
--
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
<><
Post a reply to this message
|
|