Python check if points are inside

python
#1

I am trying to see if the points are inside the brep, but I cannot make 3dpoints of the vertices. Do you might know how to make 3dpoints of the vertices?

Thank you for your response. :smiley:
problem points inside.gh (4.2 KB)

0 Likes

(IVELIN PEYCHEV) #2

Is the BREP always a box?

because rs.AddBox returns a list of points (the vertices)

Sorry, correction it is rs.GetBox
https://developer.rhino3d.com/api/RhinoScriptSyntax/#collapse-GetBox

0 Likes

#3

no, it is always a brep

0 Likes

(IVELIN PEYCHEV) #4

I did something similar recently. Now I looked at it. In order to check if brep is inside another brep I simply test for intersection. If there’s an intersection then there is a collision. If there isn’t you can check the location of the centroid if it is inside then the object is fully inside. If the centroid is outside then the object is fully outside.

https://developer.rhino3d.com/api/RhinoScriptSyntax/#collapse-IntersectBreps

# use this to compute the centroid
Rhino.Geometry.AreaMassProperties.Compute(Brep).Centroid
0 Likes

#5

Use the Brep.DuplicateVertices() method.

2 Likes

(IVELIN PEYCHEV) #6

Something you need to consider.
If your breps that you check are of a more complex shape or one is longer that goes completely through the other brep you may not detect a collision by simply checking the vertices.

0 Likes