POV-Ray : Newsgroups : povray.general : Ribbon following spline : Re: Ribbon following spline Server Time
5 May 2024 14:00:33 EDT (-0400)
  Re: Ribbon following spline  
From: Tor Olav Kristensen
Date: 1 Jan 2016 15:50:14
Message: <web.5686e6146378af804c3587780@news.povray.org>
kurtz le pirate <kur### [at] gmailcom> wrote:
....
> In fact, i already made some tests with simple polygons (squares et
> triangles). My problem is that in some places, the objects are not
> positioned correctly. You can see the issue here :
> <http://louisbel.free.fr/en_cours/wip16.shtml>

The curve_Trans macro does not seem to be robust, as it is dependent on a sky
vector.

I would guess that there will be problems with any curve that has regions that
are nearly parallel to this sky vector.


> ...and as Alain said, ribbon need two spline.

In general, information about the spline itself should be sufficient. The
remaining needed information can sometimes be calculated. And if not, it can
often be estimated.

This is usually done by constructing a Frenet frame from the first and the
second derivatives of the vector function and their cross product. (All the
vectors should be normalized.)

The first derivative of the vector function is the tangent vector function, the
second derivative of the vector function is the binormal vector function and
their cross product is the normal vector function.

The curve_Trans macro estimates the tangent vector of the curve by numerical
differentiation. But, as you have the mathematical expressions for each of the
x, y and z components of the vector function, you don't have to do this
numerically. You can use these expressions to find all the 3 vector functions
analytically.

When you have found the expressions for these 3 vector functions, you can use
them to calculate 3 orthogonal and normalized vectors for each point along the
curve.

You can then create a matrix from these 3 vectors and the vector/point given by
the original vector function for the curve. And this matrix can be used in a
transformation that both orients and translates objects along the curve. (The
Matrix_Trans macro is useful for this.)

If you need make more complex constructs at points along the curve, these 3
vectors can be used as orthonormal basis vectors for local coordinate systems at
these points.

You have to be careful though, because there may be regions of some splines
where the values of the derivative vector functions is equal to the zero vector.
There will also be problems if the vectors from the second derivative vector
function suddenly changes direction at one or more points.


Can you please post the complete problematic scene file ?

--
Tor Olav
http://subcube.com


Post a reply to this message

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