How to Set the Diagonal Length of a Grid in Houdini

   450   2   0
User Avatar
Member
8 posts
Joined: July 2024
Offline
Hello everyone,

I'm working with a primitive grid in Houdini and need to set its diagonal length to a specific value, say 10 units, while maintaining the grid's aspect ratio.

Is there a straightforward way to achieve this in Houdini? Any advice or solutions would be greatly appreciated.

Thank you!
Edited by JosephH2024 - July 20, 2024 22:30:07
User Avatar
Member
674 posts
Joined: Sept. 2013
Offline
https://www.cuemath.com/diagonal-of-rectangle-formula/ [www.cuemath.com]

Put this in an attribute wrangle running over points:

float diag = chf('diagonal_length');

vector s = getbbox_size(0);
float d = sqrt(s.x * s.x + s.y * s.y);
float f = diag / d;

v@P *= f;
Edited by Konstantin Magnus - July 21, 2024 04:11:10
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
8 posts
Joined: July 2024
Offline
Konstantin Magnus
https://www.cuemath.com/diagonal-of-rectangle-formula/ [www.cuemath.com]

Put this in an attribute wrangle running over points:

float diag = chf('diagonal_length');

vector s = getbbox_size(0);
float d = sqrt(s.x * s.x + s.y * s.y);
float f = diag / d;

v@P *= f;
Thanks. This is just what I was looking for. I appreciate your help.
  • Quick Links