Calc two pairs vectors align matrix

   3445   5   0
User Avatar
Member
626 posts
Joined: 11月 2013
Offline
Hi,
I want align two direction vectors(blue) to another two(red). The source and target vectors has same angle. They are all in 3d space ,not 2d.
How to get the transfrom matrix?

Thanks!
Edited by - 2015年2月18日 09:46:50

Attachments:
matrix.png (9.6 KB)

User Avatar
Member
4528 posts
Joined: 2月 2012
Offline
matrix3 m = dihedral ( from1, to1 );
from1 *= m;
from2 *= m;
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
626 posts
Joined: 11月 2013
Offline
pusat
matrix3 m = dihedral ( from1, to1 );
from1 *= m;
from2 *= m;

Thanks, sorry I does not express clearly. The four vectors is not co-planar. Any three of them are not co-planar.
Once align just can align from1-to1, not from2-to2.
User Avatar
Member
480 posts
Joined: 7月 2005
Offline
Hi,

i've created a simple example. You can check the inline code inside the vop.
I hope this is working like you are expecting, but I think there should be an easier and faster way to do this.

Attachments:
example.hipnc (73.3 KB)

User Avatar
Member
626 posts
Joined: 11月 2013
Offline
thanks, I will have some time to study it.

Register 10 years, only 12 posts
User Avatar
Member
480 posts
Joined: 7月 2005
Offline
Hi,

here is another example, where I used the orthogonal systems from two vectors (V,W):
V, VxW, Vx(VxW) which are defined, if V and W are not collinear.
So you can make the matrix from the system. I made some quick and dirty functions in VEX, but I would always replace them by standard functions, if exists and yes I hadn't used this forum for a long while, but if i am posting more, I will lose my Lurker status ^^.

Attachments:
other_example.hipnc (84.9 KB)

  • Quick Links