RhinoCommon Mesh Line Intersection Problem

Hi everyone,

I am trying to test the RhinoCommon MeshLine Intersetion command on a simple example but it seems that this function is missing some intersection points.

I have a valid manifold planar mesh where all the faces have the same orientation and I try to find the intersection points with 3 lines as shown in the following picture (I highlighted this missing intersection points with black rectangles):

So please I want to know if I’m not using this command in the right way or if this is a bug. Please find below the script I used for this test and the input mesh (the mesh is in OFF format so to read it using Rhino, simply change the extension of the file from “.txt” to “.OFF” and then import it using Rhino “Import” command). Thank you in advance for your help.

Dim att As DocObjects.ObjectAttributes = New DocObjects.ObjectAttributes With {.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject}
Dim mesh As Geometry.Mesh = Nothing : mesh.GetFromDocument()
If mesh Is Nothing Then Return Result.Nothing
Dim P11 As New Geometry.Point3d(-4.0, -4.0, 0.0)
Dim P12 As New Geometry.Point3d(-4.0, 4.0, 0.0)
Dim line1 As New Geometry.Line(P11, P12)
att.ObjectColor = Drawing.Color.Red
doc.Objects.AddLine(line1, att)
Dim intPts1 As Geometry.Point3d() = Geometry.Intersect.Intersection.MeshLine(mesh, line1, Nothing)
For i As Integer = 0 To intPts1.Length - 1
Dim P21 As New Geometry.Point3d(-3.0, -4.0, 0.0)
Dim P22 As New Geometry.Point3d(-3.0, 4.0, 0.0)
Dim line2 As New Geometry.Line(P21, P22)
att.ObjectColor = Drawing.Color.Blue
doc.Objects.AddLine(line2, att)
Dim intPts2 As Geometry.Point3d() = Geometry.Intersect.Intersection.MeshLine(mesh, line2, Nothing)
For i As Integer = 0 To intPts2.Length - 1
Dim P31 As New Geometry.Point3d(-1.5, -4.0, 0.0)
Dim P32 As New Geometry.Point3d(-0.5, 4.0, 0.0)
Dim line3 As New Geometry.Line(P31, P32)
att.ObjectColor = Drawing.Color.Green
doc.Objects.AddLine(line3, att)
Dim intPts3 As Geometry.Point3d() = Geometry.Intersect.Intersection.MeshLine(mesh, line3, Nothing)
For i As Integer = 0 To intPts3.Length - 1

Test.txt (586 Bytes)

I think that if you want to intersect a Mesh with a Line that is co-planar with the mesh, you’re better off with Mesh-Plane intersection, using a Plane that is not co-planar to the mesh that contains the line.

Line/Mesh intersection is suitable for lines that penetrate the mesh (i.e. not co-planar).

Thank you!! everything works perfectly when using Mesh Plane Intersection.