|
![](/i/fill.gif) |
Greg M. Johnson wrote:
>> To reorient something and really know what
>> it's going to look like, you need to align
>> to two axis.
>
> I failed miserably in my attempt at this.
> Is there a generic solution already out there?
Not sure if this is exactly what you're looking for, but:
Suppose that you want the z axis aligned to Z_vector and the y axis
aligned to Normal_vector. If the Z_vector and the Normal_vector are not
perpendicular, you want the Z_vector to be dominant.
Now you can align the object using some code like this (untested code):
#include "math.inc"
#include "transforms.inc"
#declare ObjectZ = vnormalize(Z_vector);
#declare ObjectY = VPerp_Adjust(Normal_vector,Z_vector);
#declare ObjectX = vcross(ObjectY,ObjectZ);
#declare Trans = Matrix_Trans(ObjectX,ObjectY,ObjectZ,<0,0,0>);
object {MyObject transform {Trans}}
Well, that's the method I use all the time anyway.
Rune
--
3D images and anims, include files, tutorials and more:
rune|vision: http://runevision.com (updated Sep 8)
POV-Ray Ring: http://webring.povray.co.uk
Post a reply to this message
|
![](/i/fill.gif) |