Grasshopper

algorithmic modeling for Rhino

RHINOCOMMON, HOW to test of a bounding box contains another bounding box

Does anyone know of a similar method to the "Includes" method of an Opennurbs.Boundingbox class? i wnat to tst if a boundingbox is contained wthin another bounding box.

 

There does not appear to be a similar method in Rhinocommon for the Rhino.Geometry.Boundingbox class

 

thanks

Views: 472

Replies to This Discussion

I'll add Contains() overloads for BoundingBox and Box types.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks. in the meantime can I get round this by creating a Rma.openurbs.onboundingbox from the rhinocommon bounding box extents? Is it possible to mix rhino dot net classes with rhino common?
Hi Duck,

just do the comparison yourself. Something like:

Public Function Contains(ByVal box As BoundingBox, ByVal pt As Point3d) As Boolean
   If (pt.X < box.Min.X) OrElse (pt.X > box.Max.X) Then Return False
   If (pt.Y < box.Min.Y) OrElse (pt.Y > box.Max.Y) Then Return False
   If (pt.Z < box.Min.Z) OrElse (pt.Z > box.Max.Z) Then Return False

   Return True
End Function


--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks David, good point, yes I could always try and do it myself using your example as a template. I would have to tweak it a bit though because I want to find if a bounding box contains another bounding box, not just a point. I guess this would be

Public Function Contains(ByVal boxOuter As BoundingBox, ByVal boxInner As BoundingBox) As Boolean
If (boxInner.Min.X < boxOuter.Min.X) OrElse (boxInner.Max.X > boxOuter.Max.X) Then Return False
If (boxInner.Min.Y < boxOuter.Min.Y) OrElse (boxInner.Max.Y > boxOuter.Max.Y) Then Return False
If (boxInner.Min.Z < boxOuter.Min.Z) OrElse (boxInner.Max.Z > boxOuter.Max.Z) Then Return False

cheers

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service