POV-Ray : Newsgroups : povray.general : Math help request : Re: Math help request Server Time
3 Aug 2024 22:14:45 EDT (-0400)
  Re: Math help request  
From: Tim Nikias v2 0
Date: 6 Oct 2003 19:54:56
Message: <3f8200d0@news.povray.org>
It depends on what kind of spline you're using. If you're just doing
straight connections from point 1 to 2, 2 to 3, 3 to 4, etc, then it's
simply interpolating along the points. If, for example, you'd want a value
from 0 to 1 calculate a position between point 1 and point 50 on that
spline, you'd have to multiply the value by 49, use the fraction behind the
integer part as the index for the first point, and the fraction part as
interpolation value for the next point. Linear-Interpolation is rather
simple:
point1 - (point1-point2)*Float
where float ranges between 0 and 1 (that'll be the fraction part, the points
1 and 2 are defined by integer part and integer part + 1). Take care though
that at 49, there's no point + 1!

For other splines, the method is similiar, but different, based upon the
spline-type you're using. In case you're interested in a little code, I've
got some BSpline-Macros on my website for download. Though they only provide
the Bicubic Bezier Splines and the linear interpolation mentioned above,
they may provide some insight into usage and scripting for this.

Regards,
Tim

-- 
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: tim.nikias (@) gmx.de


> I think further explanation might be necessary. I will have several of
these
> splines, each used to define points along the surface of a sail. I will
> connect the points with triangles to form a mesh. I will also use the
> points to place objects on the surface of the sail. Hope this helps you
> understand what I am trying to do.
>
> Thanks,
>
> Tim
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 24.09.2003


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.