Grasshopper

algorithmic modeling for Rhino

I am having an intermittent problem with Intersection.MeshRay where it fails to find intersections. These intersections are found with curves and surfaces, but this takes much longer to solve. I baked the mesh and 2 curves which represent the problem vector intersections. The VB script:

Dim cell_tot As New List(Of Integer)
    Dim ray_int As New list(Of line)
    For i As Integer = 0 To cells.Count - 1
      Dim intx As Integer = 0
      For j As Integer = 0 To pts.Count - 1
        For k As Integer = 0 To sample_V.Count - 1
          Dim r As Ray3d = (New Ray3d(pts(j), sample_V(k)))
          Dim cell_intx As Double = Rhino.Geometry.Intersect.Intersection.MeshRay(cells(i), r)
          If cell_intx > 0 Then
            intx = intx + 1
            Dim l As New line(pts(j), sample_V(k), 100)
            ray_int.add(l)
          End If
        Next
      Next
      cell_tot.Add(intx)
    Next
    A = cell_tot
    B = ray_int

 

This works with 99% of the vectors but seems to systematically miss some. Wondering if it is a tolerance issue or if I am messing up the code. Screenshot of the geometry, rhino model, and GH defn attached.

Thanks,

Jeff

Views: 305

Attachments:

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service