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:45 EDT (-0400)
  Re: Transform to a spline without loop-de-loops  
From: clipka
Date: 9 Mar 2011 07:46:25
Message: <4d7776a1$1@news.povray.org>
Am 09.03.2011 04:04, schrieb gregjohn:
>
> 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.

No, the problem is that you don't /use/ that vcross statement ;-)

Presuming that "Reorient" is a copy of "Reorient_Trans" from 
transforms.inc, the macro doesn't give you enough control over the 
transformation: It makes sure that what originally points to z+0.0001 
(BTW, why not just z?) is now pointing to bodylocalz, but takes the 
freedom to mess with all the other axes involved in order to achieve this.

For more control, compute all the new axis directions (X, Y and Z) 
yourself, and use the Shear_Trans macro, i.e.:

   #include "transforms.inc" // or copy the macro to your code
   #declare bodylocalz = vnormalize(bodypos1-bodypos0);
   #declare bodylocaly = vnormalize(bodypos0-Center);
   #declare bodylocalx = vcross(bodylocaly,bodylocalz);
                  // or -vcross(bodylocaly,bodylocalz);
   object {
     body
     Shear_Trans(bodylocalx,bodylocaly,bodylocalz)
     translate bodypos0
   }


Post a reply to this message

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