symek Posted February 28, 2007 Share Posted February 28, 2007 sorry for this question, this is as I suppose absolute basics but I'm far away from any related books and struggling with this now I'd like to express vector as two angles between its self and the area perpendicular to it. So I need two translators from vector to these angels and opposite one. Can anyone help? thanks, sy. Quote Link to comment Share on other sites More sharing options...
TheUsualAlex Posted February 28, 2007 Share Posted February 28, 2007 hi sy, if you need to express 2 vectors as angles, you can try acos(dot(normalize(vector3($NX, $NY, $NZ), normalize(vector3($NX2, $NY2, $NZ2))). Please note that there's now vangle() expression in Houdini that does the above for you -- only quicker and cleaner. If you're doing this in VEX, you might need to convert from radian to degree to get the angle. If you want to create a normal that's perpendicular to a vector, do something like: plane = cross(vector3($NX, $NY, $NZ), vector3(0,1,0)). This will give you a vector that's planar to $NX, $NY, $NZ and Y axis. If you take that result and cross against your original vector, i.e.: cross(vector3($NX, $NY, $NZ), plane) this will give you a vector that's always perpendicular to $NX, $NY, $NZ. Be careful tho, the order of operation here matters. anyways, hope that helped.. Quote Link to comment Share on other sites More sharing options...
symek Posted February 28, 2007 Author Share Posted February 28, 2007 thanks a lot! although I must think about all of this again. Not strong in Vex I'm afraid... I'd like to alter point normal in Vex with two angles which express new vector: vector result = {0,1,0} <something> (angle, angle) this is not very clear for me. And I can't even look into some book about it Quote Link to comment Share on other sites More sharing options...
Jason Posted March 1, 2007 Share Posted March 1, 2007 By two angles, do you mean two euler angles? If so, then all you have to do is create a matrix with the Transform function and then multiply your vector by that. In VOPs, use the Make Transformer VOP and multiply you vector by that. The output VEX code is something like: vector rotate = set( angle1, angle2, 0); // to rotate around rx and ry matrix xform = maketransform(0, 0, { 0, 0, 0 }, rotate , { 1, 1, 1 }, { 0, 0, 0 }); newvector = myvector * xform; Quote Link to comment Share on other sites More sharing options...
TheUsualAlex Posted March 1, 2007 Share Posted March 1, 2007 heh. you beat me to it, Jason. : ) There is a book called "About Vectors" that I think is really good. Properties of vectors are actually very interesting. That book is a fairly easy read too, I think. ...if I can find the time to finish mine... As for rotation with matrices, you can try to read up on the basics of transformation matrix and then try to work out a simple 2d matrix problem -- this will help you understands what's going on with rotations etc. hope that helped.. Quote Link to comment Share on other sites More sharing options...
symek Posted March 1, 2007 Author Share Posted March 1, 2007 matrix you say? ok, I'll give it a try! Thanks guys for your help! cheers, sy. Quote Link to comment Share on other sites More sharing options...
MIguel P Posted March 1, 2007 Share Posted March 1, 2007 If you want to create a normal that's perpendicular to a vector, do something like:plane = cross(vector3($NX, $NY, $NZ), vector3(0,1,0)). This will give you a vector that's planar to $NX, $NY, $NZ and Y axis. If you take that result and cross against your original vector, i.e.: cross(vector3($NX, $NY, $NZ), plane) this will give you a vector that's always perpendicular to $NX, $NY, $NZ. Be careful tho, the order of operation here matters. Effective way to create a particle vortex Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.