|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |