|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I have this box:
box { <-.025,0,-.025>, <.025,1,.025> pigment { rgb .2} }
And this 3D vector:
#declare vect = <1,1,-1>;
Question:
How do I rotate my box so that the top faces the vector "vect"?
I've been trying with some trigonometrical functions... atan2() helps but my
skills are failing me here :( this is as far as I could get
#declare rad = VDist(<0,0,0>,vect);
#declare cat1 = <0,rad,0>;
#declare cat2 = VDist(cat1,vect);
box { <-.025,0,-.025>, <.025,VDist(<0,0,0>, vect),.025> pigment { rgb <.2,0,0>}
rotate <0,0,degrees( atan2( rad, cat2 ) )-90>
}
but the arctan angle seems to be wrong and that's only a rotation around Z,
still need to rotate it again around either X or Y y guess...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
A bit better...
box { <-.025,0,-.025>, <.025,VDist(<0,0,0>, vect),.025> pigment { rgb <.2,0,0>}
rotate <0,0,degrees( atan2( vect.y, vect.x )) - 90>
rotate <0,degrees(atan2(VDist(<vect.x,vect.y,0> , vect),vect.z)),0>
}
First it rotates the box around Z axiz. That works right. But the second
rotation around Y axiz is wrong. Anybody knows how to fix that? thanks
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
well... can't do the math for myself so I found an easy way out :P
#include "transforms.inc"
box { <-.025,0,-.025>, <.025,VDist(<0,0,0>, vect),.025> pigment { rgb <0,.2,0>}
Point_At_Trans(vect)
}
just in case somebody else needs it.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|