![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Ok, this is probably really simple and I'm just overlooking something
obvious....
I'm using a spline to create a path, and placing objects along the path with
a loop. How do I get the object to face the direction of the spline though?
If I use something like;
object { My_Object translate Path(cntr) }
the object ends up in the right place, but still facing it's original
direction, when I want it to face the direction of the path. I tried using
VAngleD( current_point, next_point ) to get a rotation angle and simply
rotating the object by that but it didn't seem to do anything.
Can somebody post a simple example of how to do this for a trigonometrically
impaired Pover?
RG
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
gonzo wrote:
> Ok, this is probably really simple and I'm just overlooking something
> obvious....
>
> I'm using a spline to create a path, and placing objects along the path with
> a loop. How do I get the object to face the direction of the spline though?
> If I use something like;
>
> object { My_Object translate Path(cntr) }
>
> the object ends up in the right place, but still facing it's original
> direction, when I want it to face the direction of the path. I tried using
> VAngleD( current_point, next_point ) to get a rotation angle and simply
> rotating the object by that but it didn't seem to do anything.
>
> Can somebody post a simple example of how to do this for a trigonometrically
> impaired Pover?
>
> RG
>
>
You use the Reorient_Trans macro from transforms.inc
Say the front of your object is facing -z
Off the top of my head :
your_object { ...
Reorient ( -z, your_spline ( count ) - your_spline ( count - 1 ) )
translate your_spline ( count )
}
You get the idea?
-Jim
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Jim Charter" <jrc### [at] aol com> wrote in message
news:3f122fe5$1@news.povray.org...
> You use the Reorient_Trans macro from transforms.inc
>
> Say the front of your object is facing -z
> Off the top of my head :
> your_object { ...
> Reorient ( -z, your_spline ( count ) - your_spline ( count - 1 ) )
> translate your_spline ( count )
> }
> You get the idea?
> -Jim
>
Or:
#declare Delta = something
...
Reorient( -z, your_spline ( count + Delta) - your_spline ( count - Delta ) )
...
and make Delta small compared to the domain of the spline.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Luke <Luk### [at] hotmail com> wrote in message
news:3f12cc2c@news.povray.org...
> "Jim Charter" <jrc### [at] aol com> 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
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"gonzo" <rgo### [at] lanset com> wrote in message
news:3f13154f$1@news.povray.org...
> Luke <Luk### [at] hotmail com> wrote in message
> news:3f12cc2c@news.povray.org...
> > "Jim Charter" <jrc### [at] aol com> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Luke <Luk### [at] hotmail com> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> 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.
>
Yes, that is what I had in mind. I guess what I usually do
is Loop to total
spline ( count / total ) - spline ( (count - 1)/total )
increment count
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |