If you use a group in any node, then the transformation is applied only to this group, which is logical. But if you use the bbox and centroid functions in the parameters, they will be calculated for the entire geometry. This can be considered logical or illogical. But I would definitely like to get the result of these functions for the selected group for the correct placement of the pivot point or alignment. Now you have to write duplicate tools in Vex, although all that is needed is to expand the functions so that they can accept a group of points as an optional argument and give a result for them. And the old tools would not be affected and in the new ones you could easily work with the bounds of the selected group. Of course, you can delete the geometry, calculate the desired point, save it in an attribute, access it from another node, or make hda. This works, but is not viable due to the inconvenience.
By the way, bbox could also return the center, why multiply unnecessary functions like centroid?
Bbox and centroid functions with a group of points.
1146 4 0-
- RGaal
- Member
- 143 posts
- Joined: June 2024
- Offline
-
- tamte
- Member
- 9142 posts
- Joined: July 2007
- Offline
I don't think Hscript has options to specify groups for those functions
depending on what you are doing it may be convenient to do it in VEX/VOPs which can use group with getbbox*() functions, then you either use it for the logic directly in VEX/VOPs or export as attribtue and reference in parameters you need
but if you really need it in parameter as a direct expression you can also use Python and pointBoundingBox() or primBoundingBox() functions for point or prim groups respectively
depending on what you are doing it may be convenient to do it in VEX/VOPs which can use group with getbbox*() functions, then you either use it for the logic directly in VEX/VOPs or export as attribtue and reference in parameters you need
but if you really need it in parameter as a direct expression you can also use Python and pointBoundingBox() or primBoundingBox() functions for point or prim groups respectively
hou.pwd().inputGeometry(0).pointBoundingBox("mygroup").sizevec()[0] hou.pwd().inputGeometry(0).pointBoundingBox("mygroup").sizevec()[1] hou.pwd().inputGeometry(0).pointBoundingBox("mygroup").sizevec()[2]
hou.pwd().inputGeometry(0).pointBoundingBox("mygroup").center()[0] hou.pwd().inputGeometry(0).pointBoundingBox("mygroup").center()[1] hou.pwd().inputGeometry(0).pointBoundingBox("mygroup").center()[2]
Tomas Slancik
CG Supervisor
Framestore, NY
CG Supervisor
Framestore, NY
-
- tamte
- Member
- 9142 posts
- Joined: July 2007
- Offline
RGaalit could, but it doesn't
By the way, bbox could also return the center, why multiply unnecessary functions like centroid?
and it's difficult to know historically what was the evolution, maybe centroid() was first, so removing it even if it was added to bbox would not make sense from backwards compatibility point of view
Tomas Slancik
CG Supervisor
Framestore, NY
CG Supervisor
Framestore, NY
-
- RGaal
- Member
- 143 posts
- Joined: June 2024
- Offline
tamteyes, this feature is missing, but what would stop developers from adding it?
I don't think Hscript has options to specify groups for those functions
I don't like the idea of replacing a short string like bbox(0, D_XMIN, chs("group")) with a long string hou.pwd().inputGeometry(0).pointBoundingBox("my group").sizevec(), which 1) needs to be memorized 2) learned in the Python library for Houdini 3) entered into a tiny 5-character window. This is strictly the opposite of convenience and speed.
In an era when AI will soon throw us out on the street, we want the shortest and fastest tools. This is my message to developers.
Or, for example, you could make a module of 3 lines with 3 small buttons and the user could set the pivot to any corner of the geometry or group in three clicks.
X - /MIN/ /CEN/ /MAX/
Y - /MIN/ /CEN/ /MAX/
Z - /MIN/ /CEN/ /MAX/
And include this module in the interface in all nodes where there is a pivot/origin.
three clicks vs hou.pwd().inputGeometry(0).pointBoundingBox("my group").sizevec()
hou.pwd().inputGeometry(0).pointBoundingBox("my group").sizevec()
hou.pwd().inputGeometry(0).pointBoundingBox("my group").sizevec()
Yes, this is fantastic
Edited by RGaal - July 31, 2024 12:26:36
-
- BabaJ
- Member
- 2144 posts
- Joined: Sept. 2015
- Offline
RGaal
Or, for example, you could make a module of 3 lines with 3 small buttons and the user could set the pivot to any corner of the geometry or group in three clicks.
X - /MIN/ /CEN/ /MAX/
Y - /MIN/ /CEN/ /MAX/
Z - /MIN/ /CEN/ /MAX/
You could put in an RFE and/or make your own asset that provides this.
Personaly for my own workflow, I commonly have the need for a maximum size often so I have a vexpression available for an attribute wrangle that creates a detail attribute that I would use in multiple downstream nodes:
// BBoxes
v@Max = getbbox_max(geoself());
v@Min = getbbox_min(geoself());
v@Size = getbbox_size(geoself());
v@Center = getbbox_center(geoself());
v@Size = getbbox_size(geoself());
f@Max_Size = v@Size.x;
if(v@Size.z > f@Max_Size) v@Max_Size = v@Size.z;
if(v@Size.y > f@Max_Size) v@Max_Size = v@Size.y;
You could do the same (create a detail attribute specific to your needs) and reference that where needed downstream in your parameter expressions.
The getbox functions can utilize the chosen group/s to apply the function too by referencing the nodes 'group' parameter with chs('group').
The functions will take into account if you have more than one group selected too(in the wrangles group parm)
Edited by BabaJ - Aug. 2, 2024 08:55:23
-
- Quick Links