POV-Ray : Newsgroups : povray.general : Transform to a spline without loop-de-loops : Re: Transform to a spline without loop-de-loops Server Time
29 Jul 2024 14:23:11 EDT (-0400)
  Re: Transform to a spline without loop-de-loops  
From: Trevor G Quayle
Date: 8 Mar 2011 22:50:00
Message: <web.4d76f8ad48e6ef7eb05ef170@news.povray.org>
"gregjohn" <pte### [at] yahoocom> wrote:
> I'm not posting (soley) to brag about an animation.  I've got my character
> walking system set up to walk along any spline, so I figured I'd try it in 3D. I
> found code for the curve of a baseball seam and set it to go:
>
> http://www.youtube.com/watch?v=Fh2pIMN3ZlQ
>
> Does anyone have any ideas on how I can prevent the loop-de-loops? I'd like to
> have it always pointing outwards from the circle.
>
> Given a bodypath spline, I go:
>
> #declare bodypos0=<0,0,0>+bodypath(clock) ;  // the bo
> #declare bodypos1=<0,0,0>+bodypath(clock+1e-4);
> #declare bodylocalz=bodypos1-bodypos0;
> #declare bodylocalx=vcross(-y,bodylocalz);
>
> object{body  Reorient(z+0.0001,bodylocalz)  translate bodypos0 }
>
>
> I guess my problem is in my vcross statement.

Looks pretty good.

I'm not certain, but one thing that you are doing that may make a minor
difference, is that you are basing the orientation on a vector from the current
position to one slightly ahead (bodylocalz).  I would (as I do with procedural
meshes) use one point behind and one ahead as my forward vector, which should be
approximately close to the tangent of the current point.

-tgq


Post a reply to this message

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