POV-Ray : Newsgroups : povray.general : Direction on a spline : Re: Direction on a spline Server Time
5 Nov 2024 03:15:21 EST (-0500)
  Re: Direction on a spline  
From: gonzo
Date: 15 Jul 2003 16:49:50
Message: <3f1468ee@news.povray.org>
Luke <Luk### [at] hotmailcom> wrote in message
news:3f13ca12@news.povray.org...
>
> Here's my thoughts:
> 1) Maybe sometimes you are getting Reorient(-z,<0,0,0>). It makes no sense
> to point something in 0 direction, so you should expect an error in this
> case. The fix would be something like:
> #declare Direction = your_spline ( count ) -  your_spline ( count - 1 );
> #if (!VectorIsZero(Direction)) Reorient(-z,Direction) #end

My spline does pass through <0,0,0> so maybe that's it, but it doesn't have
a warning in the docs for that one as several of the rotation functions and
macros do...  that, and I'm pretty sure that in some of my failed attempts
before I even posted my question here I would have had the same error,
because I tried several variations of my spline positions, but it never
erred...


> 2) I think Reorient(axis1,axis2) can behave a little odd if the two
vectors
> are parallel. In my tests it parsed no problem, but the objects got
twisted
> oddly in places.

Could be that too, since my steps are in between points some of them could
be parallel.


> 3) I also had problems with the cubic spline. I didn't really figure this
> one out, I just switched to natural splines. They worked.

Well, I'm using a cubic spline, but since it's working fine now, I doubt if
that's the reason... When you have trouble with them remember that the first
and last points are directional reference only, & not really part of the
spline.

>
> I should also note that, if your objects are at somewhere like:
> Spline(0),Spline(1),Spline(2),...etc Jim's code will work a treat as each
> object should point exactly at the next. If they are less evenly
> distributed, then you'll have to use something like mine which just points
> along the curve, rather than at the next object.
>

Hmmm, maybe a little of all of the above. I'll play with something like your
#if statement using different conditions & see if I can isolate it...

But thanks all the same!

RG  -  I'm just one of those types who has to know why something didn't
work...


Post a reply to this message

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