I have a vector X, and I'd like to randomly generate a vector Y so that the angle between X and Y is 60 degrees.
There is a VEX function sample_direction_cone that can generate a vector Y so that the angle between X and Y is no more than maxangle degrees.
But that's not what I need. I need the angle between X and Y to be exactly 60 degrees, not <= 60 degrees. How could I do that?
sample_direction_cone but on the maxangle instead of within?
1410 3 1-
- kodra
- Member
- 373 posts
- Joined: June 2023
- Offline
-
- tamte
- Member
- 9384 posts
- Joined: July 2007
- Offline
-
- animatrix_
- Member
- 5100 posts
- Joined: Feb. 2012
- Offline
Here is one way using matrices:
vector dir = @N; float angle = radians ( ch("angle") ); float u = rand ( i + @ptnum * ( i + 14.2351 ) ); vector axis = sample_direction_cone ( dir, PI, u ); vector pdir = normalize ( cross ( dir, axis ) ); matrix M = ident ( ); rotate ( M, angle, pdir ); vector rdir = dir * M;
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]
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
-
- kodra
- Member
- 373 posts
- Joined: June 2023
- Offline
-
- Quick Links

