IsPointInside of Rhino3dmIO seems to fail completely

We are using Rhino3dmIO in a .net core environment and it seems I have trouble with Mesh.IsPointInside that is failing failing completely. For comparison I implemented similar “unit test” (see below) that passes in GHpython component, but not with the Rhino3dmIO lib.

Any thoughts?
Tnx, Wei

import Rhino.Geometry

s = 10

# Cube from 0,0,0 to s,s,s
m.Vertices.Add(0,0,0)
m.Vertices.Add(s,0,0)
m.Vertices.Add(s,s,0)
m.Vertices.Add(0,s,0)

m.Vertices.Add(0,0,s)
m.Vertices.Add(s,0,s)
m.Vertices.Add(s,s,s)
m.Vertices.Add(0,s,s)

m.Faces.AddFace(0,1,2,3)
m.Faces.AddFace(0,1,5,4)
m.Faces.AddFace(1,2,6,5)
m.Faces.AddFace(2,3,7,6)
m.Faces.AddFace(3,0,4,7)
m.Faces.AddFace(4,5,6,7)

pointIsInside = m.IsPointInside(Rhino.Geometry.Point3d(1,1,1),0.001,True)
pointIsNotInside = not m.IsPointInside(Rhino.Geometry.Point3d(-1,1,1),0.001,True)

print "pointShouldBeInside : ", pointIsInside
print "pointShouldBeOutside : ", pointIsNotInside

Hi @wpl,

Mesh.IsPointInside always returns false in Rhino3dmIO, as the code behind this method uses functionality only found in core Rhino.

– Dale

Hi. @dale, is there a reason to keep a method that has no use ? I thought method if not implemented were not present in Rhino3dmIo. For example distance in Quaternion…
Thanks.

There’s no good reason. We should remove functions that are useless. I must have missed this one

1 Like

Agreed - https://mcneel.myjetbrains.com/youtrack/issue/RH-59355

1 Like

Ok, tnx for the reply. Other function where already stripped. So you can imagine how delighted we were to find the IsPointInside function. Removing it is indeed recommended.

We assuming it to work and are currently at a standstill, is there an alternative for this specific function?
Regards, Wei

Hi @wpl,

A popular way of determining whether or not a point all inside of a closed, manifold mesh, is to shoot a ray from the test point thru the mesh and count the number of ray/triangle intersections. This is basicaly what Mesh.IsPointInside. What makes this function unusable in Rhino3dm is that the mesh intersector is in core Rhino, not openNURBS. Rhino3dm is based on openNURBS.

I have no doubt that if you Google “point inside closed mesh” you’ll find a number of algorithms and/or source you can reference.

– Dale

Tnx for the reply @dale,

I hoped there would be combination of functions in Rhino3dmIO that will lead to the same, but I get the drift. I’ll first look for implementations of others a lib or something, before implementing it myself.

Regards, Wei