Grasshopper

generative modeling for Rhino

# Select within a volume?

Hey all.

I have two things. The first is a series of vertical planes that are quite short in length. The second is a series of spheres. My hope is to use the spheres a method to select the smaller, vertical planes.

ie: Select all of the Vertical Planes that occur INSIDE of a certain sphere.

What I'm looking for is a 'select all objects inside of a given volume' component.

Any thoughts or examples? I know how to do this by intersection... but many of the smaller elements are inside of my sphere and do not intersect the outside in any way.

Example by intersection

Thanks!

JMP

Views: 336

Attachments:

### Replies to This Discussion

Hi JMP,

selecting points inside volumes is easy enough. Arbitrary geometry is much harder. If you can simplify your geometry into a collection of points so that if all these points are on the inside, the base geometry is also guaranteed to be on the inside, then it's only mildly difficult.

Rectangular surfaces are relatively easy this way, you can check the 4 corner points for inclusion. However, this only works if the volume is convex (Spheres are convex, so again, you seem to be lucky here). I attached a file which tests the inclusion for all corners of a rectangular surface, then adds those inside/outside bools together to get a number representing the state (0 = outside, 1/2/3 = mixed, 4 = inside)

Another way to simplify this problem is to limit yourself to spherical volumes only. It's very easy to determine whether a point is on the inside of a sphere or not. If the distance from that point to the sphere center point is less than the sphere radius, you're on the inside. You could use this shortcut to test -say- all the points in a mesh-representation of your shape.

--

David Rutten

david@mcneel.com

Attachments:

• View All