Quaternion Vex/Python equivalents

   2179   2   1
User Avatar
Member
66 posts
Joined: March 2017
Offline
Hi guys,

I'm struggling to find the equivalent functions in python and vex when it comes to quaternions.

This seems to be working in Python :
o1 = hou.Quaternion()
o1.setToVectors(hou.Vector3(0, 1, 0), self.normal)
o2 = hou.Quaternion()
q = o2.slerp(o1, ratio)
How would I get the same result in Vex?
Or if even my Python code is wrong, how can I get the same result in Vex/Python for what I'm trying to achieve ?

Thanks a lot,

Julien
Edited by julien-b - May 18, 2020 18:13:50
VFX Supervisor @ MPC London
User Avatar
Member
66 posts
Joined: March 2017
Offline
Ok, I think I found the answer : dihedral seems to be the vex equivalent of Quaternion.setToVectors() !

Cheers,

Julien
VFX Supervisor @ MPC London
User Avatar
Member
5100 posts
Joined: Feb. 2012
Offline
Hey Julien

It's even more confusing in VOPs if you try to search dihedral, it's called Align VOP

At least in the HDK, it's also called dihedral:
https://www.sidefx.com/docs/hdk/class_u_t___matrix3_t.html#a4326291ec8a372e8315fdba3eef42588 [www.sidefx.com]

I think numpy doesn't have a function for this but in scipy it's available:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.align_vectors.html [docs.scipy.org]
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
  • Quick Links