# Mesh.IsPointInside() persistent bug

**URL:** <https://discourse.mcneel.com/t/mesh-ispointinside-persistent-bug/48124>\
**Category:** Rhino Developer\
**Created:** [October 10, 2017, 4:24pm UTC](https://discourse.mcneel.com/t/mesh-ispointinside-persistent-bug/48124 "2017-10-10T16:24:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dave\_stasiuk](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dave_stasiuk/32/507722_2.png) [@dave\_stasiuk](https://discourse.mcneel.com/u/dave_stasiuk)\
**Post date:** [October 10, 2017, 4:24pm UTC](https://discourse.mcneel.com/t/mesh-ispointinside-persistent-bug/48124/1 "2017-10-10T16:24:36Z")

</div>

Hi there-

It looks like Mesh.IsPointInside() will occasionally fail, when a test vertex strikes the inclusion mesh precisely on an edge. Writing one from scratch following David’s logic from this thread over on the old GH forum: [http://www.grasshopper3d.com/forum/topics/mesh-ispointinside-always-false](http://www.grasshopper3d.com/forum/topics/mesh-ispointinside-always-false) reproduces the error. I made a quick fix that does a second test based on another arbitrary vector and then determines if the number of intersections for either test is an odd number…doubles the effort, but seems to work. In any event, it’s worth knowing that this bug is persistent.

thanks,

Dave

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/685184_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [October 10, 2017, 5:03pm UTC](https://discourse.mcneel.com/t/mesh-ispointinside-persistent-bug/48124/2 "2017-10-10T17:03:15Z")

</div>

Hi Dave,

This is a known issue.

[https://mcneel.myjetbrains.com/youtrack/issue/RH-10076](https://mcneel.myjetbrains.com/youtrack/issue/RH-10076)

I’ll mention this to the developer again.

– Dale

---

<div class="post-metadata">

**Author:** ![dave\_stasiuk](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dave_stasiuk/32/507722_2.png) [@dave\_stasiuk](https://discourse.mcneel.com/u/dave_stasiuk)\
**Post date:** [October 10, 2017, 5:06pm UTC](https://discourse.mcneel.com/t/mesh-ispointinside-persistent-bug/48124/3 "2017-10-10T17:06:21Z")

</div>

Thanks, Dale! It fails rarely…but does indeed.

---

<div class="post-metadata">

**Author:** ![D-W](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/d-w/32/487927_2.png) [@D-W](https://discourse.mcneel.com/u/D-W)\
**Post date:** [March 28, 2018, 3:10pm UTC](https://discourse.mcneel.com/t/mesh-ispointinside-persistent-bug/48124/4 "2018-03-28T15:10:28Z")

</div>

This method don’t work at all in my case - [http://developer.rhino3d.com/5/api/RhinoCommonWin/html/M\_Rhino\_Geometry\_Mesh\_IsPointInside.htm](http://developer.rhino3d.com/5/api/RhinoCommonWin/html/M_Rhino_Geometry_Mesh_IsPointInside.htm)

Mesh is closed also tolerance here no matter if ZeroTolerance / Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance / 1000 also no change with true or false always is false i wanted to build convexhull so it’s crucial for me.

First i thought that normals here are crucial but they are not 🤔

Ok method will work if:

```
mesh.Vertices.CombineIdentical(true, true);
mesh.FaceNormals.ComputeFaceNormals;
mesh.UnifyNormals();
mesh.Normals.ComputeNormals();
mesh.Compact();

```

First i thought it will work but now i see that it randomly gives different results.

@stevebaer Any recomendations?

---

<div class="post-metadata">

**Author:** ![stevebaer](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/stevebaer/32/473567_2.png) [@stevebaer](https://discourse.mcneel.com/u/stevebaer)\
**Post date:** [March 29, 2018, 1:58am UTC](https://discourse.mcneel.com/t/mesh-ispointinside-persistent-bug/48124/5 "2018-03-29T01:58:26Z")

</div>

I’m not sure what your mesh looks like. The algorithm simply creates a line from the test point to a point know to be outside of the mesh. An intersection is run on this line with the mesh and if the number of intersections is an odd number, true is returned. I’m sure there is a more robust approach, but that is what we currently have implemented.

You could try the same test with the MeshLine intersect routine in RhinoCommon.

---

<div class="post-metadata">

**Author:** ![D-W](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/d-w/32/487927_2.png) [@D-W](https://discourse.mcneel.com/u/D-W)\
**Post date:** [March 29, 2018, 2:05am UTC](https://discourse.mcneel.com/t/mesh-ispointinside-persistent-bug/48124/6 "2018-03-29T02:05:24Z")

</div>

Thanks @stevebaer for suggestion. I’ll try with MeshLine one. Btw. i’m making quickhull algorithm so there’s a lot of points on edge and that’s probably the issue here.

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/685184_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [March 29, 2018, 3:28pm UTC](https://discourse.mcneel.com/t/mesh-ispointinside-persistent-bug/48124/7 "2018-03-29T15:28:24Z")

</div>

> [@D-W](#):
>
> i’m making quickhull algorithm

The [Waterman Polyhedra](http://www.food4rhino.com/app/waterman-polyhedra) add-on included a QuickHull implementation - and it’s available in Grasshopper…

– Dale

---

<div class="post-metadata">

**Author:** ![D-W](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/d-w/32/487927_2.png) [@D-W](https://discourse.mcneel.com/u/D-W)\
**Post date:** [March 29, 2018, 3:51pm UTC](https://discourse.mcneel.com/t/mesh-ispointinside-persistent-bug/48124/8 "2018-03-29T15:51:46Z")

</div>

@dale i use GH only for quick prototyping code i needed this in c# and now i have partially with IsPointInside and if something is giving false it just falls to closest point with tolerance quick and dirty workaround but it works finally.

---

<div class="post-metadata">

**Author:** ![brian](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/brian/32/504171_2.png) [@brian](https://discourse.mcneel.com/u/brian)\
**Post date:** [March 24, 2026, 9:59pm UTC](https://discourse.mcneel.com/t/mesh-ispointinside-persistent-bug/48124/9 "2026-03-24T21:59:57Z")

</div>

[RH-10076](https://mcneel.myjetbrains.com/youtrack/issue/RH-10076) is fixed in Rhino [WIP](https://discourse.mcneel.com/t/welcome-to-serengeti/9612)
