Scale object along vector

   6784   4   0
User Avatar
Member
46 posts
Joined: Jan. 2007
Offline
Hi guys,

Does anybody know the vopsop formula for scaling an object along a vector? I want to scale an object along a single axis just as I would with a transform sop, but not explicitly down x,y, or z. My object is at a weird angle and I'd like to scale it along that axis.

Ideas?

Thanks in advance!
User Avatar
Member
7715 posts
Joined: July 2005
Offline
Create a matrix that aligns your direction vector with a regular axis that is *not* the opposite of your direction vector. So say that was the +Z axis value of (0, 0, 1). Then use the Align VOP [sidefx.com] to create this matrix that rotates your geometry from the direction vector onto the +Z axis. Now you can scale it along the Z axis. After doing this, you do the opposite by multiplying it again with the inverse of the matrix generated by the Align VOP, putting your geometry back into place. If the origin of your direction vector is not at the origin of (0, 0, 0), then you'll also need to translate it to 0,0,0 first before scaling, and then moving it back.
User Avatar
Member
46 posts
Joined: Jan. 2007
Offline
Hi Edward! I think I follow, but what do I do with the output matrix of the align vop?

I've attached a simple file demonstrating my issue.

Attachments:
rotate_geo_v001.hipnc (74.7 KB)

User Avatar
Member
46 posts
Joined: Jan. 2007
Offline
I've been pointed in the right direction by Gene. I'm multiplying P by the rotation matrix generated by the align vop. Learned something new today!

Thanks Edward.
User Avatar
Member
8547 posts
Joined: July 2007
Offline
there is as well Transform Axis SOP which does exactly that (in case you don't particularly need a VOPs solution)
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links