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