# Python ispoint in region

I am trying to check if the point is inside by using python. I do not want to use the component of it. I want to use python.

Do you might know what am I doing wrong?
There is not such thing like ‘inregion’ right?
Otherwise I need to figure out to make a brep from the curve.

Thank you for your response

Yes if you want to use this method then I think you need to make a brep and then call the method on the brep. It is complaining because it needs a ‘self’ - the brep to refer to…

Help on method-descriptor IsPointInside

| IsPointInside(…)
| IsPointInside(self: Brep, point: Point3d, tolerance: float, strictlyIn: bool) -> bool
|
| Determines if point is inside Brep. This question only makes sense when
|
| the brep is a closed manifold. This function does not not check for
|
| closed or manifold, so result is not valid in those cases. Intersects
|
| a line through point with brep, finds the intersection point Q
| closest
| to point, and looks at face normal at Q. If the point Q
| is on an edge
| or the intersection is not transverse at Q, then
| another line is used.
|
|
| point: 3d point to test.
| tolerance: 3d distance tolerance used for intersection and determining strict inclusion.
|
| A good default is RhinoMath.SqrtEpsilon.
|
| strictlyIn: if true, point is in if inside brep by at least tolerance.
| if
| false, point is in if truly in or within tolerance of boundary.
|
| Returns: true if point is in, false if not.
|

I think you’re looking for Curve.Contains method:

``````import scriptcontext as sc
plane = region.TryGetPlane()[1]
answer = region.Contains(point, plane, sc.doc.ModelAbsoluteTolerance)
``````

ForestOwl.gh (13.9 KB)

1 Like

Hey @ForestOwl,

How are ya doing?

Your question was already answered in our discussion here. The goose_revisited.gh file includes most of the methods, you need for inclusion, intersection, and/or exclusion tests.

For example, line 152 to 175 of the GHPython script, inside the method `is_inside()`:

``````# Count how many vertices of the test polyline are inside, outside of or conincident with container curve
inside_count, coincident_count, outside_count, unset_count = 0, 0, 0, 0
for vtx in test_polyline:
containment_test = other_curve.Contains(vtx)
if containment_test == rg.PointContainment.Inside:
inside_count += 1
if containment_test == rg.PointContainment.Coincident:
coincident_count += 1
if containment_test == rg.PointContainment.Outside:
outside_count += 1
if containment_test == rg.PointContainment.Unset:
unset += 1
if strict:
if inside_count > 0 and coincident_count == 0 and outside_count == 0 and unset_count == 0:
return True # strict inclusion
else:
return False
else:
if inside_count > 0 and coincident_count == 0 and outside_count == 0 and unset_count == 0:
return True # strict inclusion
elif inside_count > 0 and coincident_count > 0 and outside_count == 0 and unset_count == 0:
return True # inclusion with partiall coincidence
else:
return False
``````

I maybe should have cleared up that a vertex is basically the same as a point in this example.