Jump to content

Vectors As Two Angles


symek

Recommended Posts

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.

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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;

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...