POV-Ray : Newsgroups : povray.general : Direction on a spline : Re: Direction on a spline Server Time
4 Aug 2024 06:13:48 EDT (-0400)
  Re: Direction on a spline  
From: Luke
Date: 15 Jul 2003 05:32:02
Message: <3f13ca12@news.povray.org>
"gonzo" <rgo### [at] lansetcom> wrote in message
news:3f13154f$1@news.povray.org...
> Luke <Luk### [at] hotmailcom> wrote in message
> news:3f12cc2c@news.povray.org...
> > "Jim Charter" <jrc### [at] aolcom> wrote in message
> > news:3f122fe5$1@news.povray.org...
> >
> > > You use the Reorient_Trans macro from transforms.inc
>
> Thanks Jim & Luke, for pointing me to that include! Never used it before,
> there's some good stuff in there!
> Got it working perfectly now!
>
> But not on the first try...  so now have a question...
> Your way Jim,
>     > > Reorient (  -z, your_spline ( count ) -  your_spline ( count -
1 ) )
> puts me into transforms.inc with this error; "Parse Error: Singular matrix
> in MInvers."
>
> Luke's way works fine...
>     > #declare Delta = something
>     > Reorient( -z, your_spline ( count + Delta) - your_spline ( count -
> Delta ) )
>
> Reading the docs, both ways appear to be valid, I'm passing 2 vectors
either
> way.  Why does the first way give an error?
>
> RG
>
>
>
I'm always happy to help.
(but I can't help thinking I've not been on these groups long enough, and
might be breaking protocol - perhaps I should post some newbie questions to
redress the balance)

I was doing something like this not long ago and had a few problems myself.
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
  -(some names have been changed to protect the innocent)
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.
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.

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.

Hope this helps.
Luke.


Post a reply to this message

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