Sorry for the basic math question, but I'm trying to replicate the functionality of Softimage's “Get Angle Between”, which takes two normals and outputs the inbetween angle, and I'm blanking. I'm using VOP.
I'm guessing it's not as simple as just subtracting the two?
Getting the angle between two 3d vectors in VOP
35309 13 3- negow
- Member
- 27 posts
- Joined: Jan. 2007
- Offline
- Allegro
- Member
- 696 posts
- Joined: March 2006
- Offline
- negow
- Member
- 27 posts
- Joined: Jan. 2007
- Offline
- symek
- Member
- 1390 posts
- Joined: July 2005
- Offline
negow
Sorry for the basic math question, but I'm trying to replicate the functionality of Softimage's “Get Angle Between”, which takes two normals and outputs the inbetween angle, and I'm blanking. I'm using VOP.
I'm guessing it's not as simple as just subtracting the two?
In VOPS land plug Dot Product VOP into Trigonometric Functions VOP selecting Arc Cosine as a function of it. This gives you an angle in radians, which you can convert to degrees with Radians to Degrees VOP. Note, vectors should be normalized!
hth,
ps. angle = acos(dot(normalize(v1),normalize(v2)))
- negow
- Member
- 27 posts
- Joined: Jan. 2007
- Offline
- symek
- Member
- 1390 posts
- Joined: July 2005
- Offline
negow
Awesome, Thanks!
Would you mind explaining, for someone who missed that class, how the Arc Cosine works to output the inbetween angle in this scenario?
Well, I'm not the best person to explain math, but basically the magic thing is a dot product or scalar product, that relates to a projection of vector A on vector B. A' = |A|*cos(angle). Because arc cosine is an inverse function to cosine, you can use it to retrieve angle from above relation (and by using normalised vectors you cancel multiplication). Check out wiki: http://en.wikipedia.org/wiki/Dot_product [en.wikipedia.org]
cheers!
skk.
- Alanw
- Member
- 320 posts
- Joined: Aug. 2007
- Offline
- symek
- Member
- 1390 posts
- Joined: July 2005
- Offline
- itriix
- Member
- 152 posts
- Joined: June 2008
- Offline
two great resources for this:
Houdini specific:
http://www.3dbuzz.com/xcart/product.php?productid=58 [3dbuzz.com]
Peter Claes uses quite a bit of vector math and does a great breakdown of using the dot product and cross product for a few scenarios!
3DS MAX Specific - Which I don't use, but wanted to find some more material on 3D Math… The CG Academy's - MAXSCRIPT 3 DVD - The Matrix Explained…
Fantastic resource for getting a good understanding of 3D Math from vectors to matrices and their uses in 3d
Cheers,
Jonathan
Houdini specific:
http://www.3dbuzz.com/xcart/product.php?productid=58 [3dbuzz.com]
Peter Claes uses quite a bit of vector math and does a great breakdown of using the dot product and cross product for a few scenarios!
3DS MAX Specific - Which I don't use, but wanted to find some more material on 3D Math… The CG Academy's - MAXSCRIPT 3 DVD - The Matrix Explained…
Fantastic resource for getting a good understanding of 3D Math from vectors to matrices and their uses in 3d
Cheers,
Jonathan
- Alanw
- Member
- 320 posts
- Joined: Aug. 2007
- Offline
- negow
- Member
- 27 posts
- Joined: Jan. 2007
- Offline
- pelos
- Member
- 621 posts
- Joined: Aug. 2008
- Offline
- Saiyawong
- Member
- 4 posts
- Joined: Oct. 2010
- Offline
- BabaJ
- Member
- 2129 posts
- Joined: Sept. 2015
- Offline
what is normal_pt and nn_pt ?
They are two user-defined vectors for the dot function.
http://www.sidefx.com/docs/houdini/vex/functions/dot.html [www.sidefx.com]
-
- Quick Links