Is there a faster way to check if two boundingboxes intersects/collides than converting those bboxes to meshes and using meshmeshfast:

Rhino.Geometry.Intersect.Intersection.MeshMeshFast

I just need true and false output.

Is there a faster way to check if two boundingboxes intersects/collides than converting those bboxes to meshes and using meshmeshfast:

Rhino.Geometry.Intersect.Intersection.MeshMeshFast

I just need true and false output.

Just compare Min and Max of both bounding boxes, mathematically.

This is a fastest way.

Got it thanks:

bool Intersects(BoundingBox current, BoundingBox other) {

return

(current.Min.X < other.Max.X) && (current.Max.X > other.Min.X) &&

(current.Min.Y < other.Max.Y) && (current.Max.Y > other.Min.Y) &&

(current.Min.Z < other.Max.Z) && (current.Max.Z > other.Min.Z);

}

2 Likes

We had a thread on this topic that might be useful here as well (for non-world orientated boxes etc):

Is non-world oriented boxes can be called bounding boxes?

I have a question of this because bbox is generally defined by min and max point.

You can get/calculate bounding boxes aligned to any plane using this overload (a good approach in 2.5D is to run it with a number of samples, incrementally rotating the plane N times, and then returning the smallest box):

http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_GeometryBase_GetBoundingBox.htm