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:13:16 EDT (-0400)
  Re: Transform to a spline without loop-de-loops  
From: Le Forgeron
Date: 9 Mar 2011 03:38:17
Message: <4d773c79$1@news.povray.org>
Le 09/03/2011 04:04, gregjohn a écrit :
> 
> 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.
> 
> 

what is your vector base ? (right, up, depth ?)

it seems so far that z is the horizontal direction.
x might be the vertical one ? or is it y ?

you do not use bodylocalx, so vcross is not the issue.

If you want to avoid loop-de-loops, (if I got that correctly), it just
means that you want to fix one vector (y ? well the line of shoulders)
and have a planar rotation (along the depth vector) only. If you
normalise bodylocalz, you can ask atan2 the angle needed for that
rotation (comparing to an implicit z), and then perform the rotation.

That would be fine for 2D spline.

Also, beware of z+0.0001 ... it's <0.0001, 0.0001, 1.0001> !

-- 
Software is like dirt - it costs time and money to change it and move it
around.

Just because you can't see it, it doesn't weigh anything,
and you can't drill a hole in it and stick a rivet into it doesn't mean
it's free.


Post a reply to this message

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