Test for volume within volume


I’m wondering if there is an easy way to test whether object A with fully within object B? (EG whether a given sphere is within a particular pyramid.)

I can’t use bounding box properties, because the outer object’s shape may not necessarily be so regular.

I guess I’m hoping for a function with a name like IsWithinObject(), but I’m guessing it’s more complicated that that…


Hi Peter,

You will have to cook up your own function. Both RhinoScript and Python have IsObjectInBox and IsPointInSurface functions which might be helpful. Sample some points on the sphere and using the latter might be enough.

Thanks Dale,

I thought so. I think I’ll start with checking the centroid points with IsPointInSurface, but it gets a bit hard from there as I don’t think SurfaceSurfaceIntersection has been implemented yet. I might just have to rely on that and test all the bounding box points of the objects found inside on the first pass against the surface to be safe.

Cheers Peter

wouldn’t rs.IntersectBreps work for this? (a sphere and a pyramid)

(it wouldn’t say if one is inside the other but it will tell you if one is touching the other)