Request : BoundingBox.Plane function for WIP


(Paul Poinet) #1

Hi,

It would be great if one could not only get the Center but also the Plane from which a BoundingBox is drawn. Apologies if such function exists already or if the request has already been made.

Paul


#2

Would this just be for convenience? I guess you already can construct the frame at the bbox center?


(David Cockey) #3

@PaulPoinet How would you define the plane for a 3D bounding box? A surface of the box? If so which surface?


(Paul Poinet) #4

No I meant the plane from which the BoundingBox has been built from. It could be either aligned on the WorldXY or customized


#5

It looks like the BoundingBox object actually has no “memory” of how it was built… But I guess a property could be built in, normally the corners are numbered 0 to 7, starting in the “lower left corner” and going first around the “bottom” face and then around the “top” face in CCW order. So a BoundingBox.Plane property could be defined inside the BoundingBox object as Rhino.Geometry.Plane(p0,p1,p3)…

–Mitch


(David Cockey) #6

The BoundingBox command does not build a box from a plane. Rather it builds the minimum size box with edges parallel to the X, Y and Z axes which encloses the selected objects. The BoundingBox command has an option, CoordinateSystem, which selects which set of axes are used, the World XYZ or the CPlane XYZ.


#7

Well, that’s more or less a question of semantics… The Rhino.Geometry.BoundingBox() function does take a plane as an optional argument. It then builds a plane-aligned bounding box. --Mitch


(Paul Poinet) #8

Are you sure about this?
Can’t find such argument here.

As far as I know only the Box class constructor allows to do so.


#9

No you’re correct, sorry - it is the rhinoscriptsyntax function that takes a plane as an argument, but the RhinoCommon doesn’t. The rhinoscriptsyntax gets a world aligned BB first, then transforms the points to the desired plane afterwards…


#10

Ah, I think now I understand the request.

This doc for GeometryBase.GetBoundingBox() doesn’t have a plane as input variable, but they do use it in the example on the page:

So I think that documentation is not accurate or I am missing it.

The help in the python editor is:

GetBoundingBox(self: GeometryBase, plane: Plane) -> BoundingBox

Aligned Boundingbox solver. Gets the plane aligned boundingbox.

plane: Orientation plane for BoundingBox.
Returns: A BoundingBox in plane coordinates.

It returns a plane-aligned bbox, not a transformed-to-world space from plane space bbox, so you cannot infer the original plane, which is not what I thought initially.

But I don’t understand how you can get a non world space bbox that you didn’t already know the plane of? If you use the Rhino.Geometry.BoundingBox() constructor the only option is world space. The only other way is from the GeometryBase but you have to specify the plane. Is there another function to get a bbox?


(Paul Poinet) #11

The request is confusing… Apologies.
At first I thought that a BoundingBox would be computed directly tightly around an object, thus dismissing the WorldXYZ alignment. This is why I was asking to get the plane from there.

I am amazed to read this example now, thanks for looking at this! Indeed some documentation is lacking…