Grasshopper

algorithmic modeling for Rhino

Hi....

In the SDk help file,

I found VB_SimpleGeometry and

 

Select Case Rhino.Geometry.Intersect.Intersection.LineCircle(line, circle, t1, p1, t2, p2)
    Case Rhino.Geometry.Intersect.LineCircleIntersection.None
      AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "No intersections were found")
      Return
    Case Rhino.Geometry.Intersect.LineCircleIntersection.Single
      AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Only a single intersection was found")
      Return
  End Select


but, I want to retreive curve-curve intersection result, but it was not easy.

Would you help me?

Views: 928

Replies to This Discussion

Hi Daniel,

 

Curve-Curve intersection potentially return any number between zero and, well, not infinity, but certainly very very large. The function does not return a code telling you what sort of intersection happened, it returns all the intersections it found.

 

I attached a script which returns all the curve-curve intersections that are not inside a given box.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Hi David

Thank you very much.

May I ask one more help? about RayShoot

 

 Private Sub RunScript(ByVal pt As Point3d, ByVal v As Vector3d, ByVal s As Surface, ByRef A As Object)
    'your code goes here…

    Dim ry As New rhino.Geometry.Ray3d(pt, v)
    a = rhino.Geometry.Intersect.Intersection.RayShoot(ry, s, 1)

  End Sub

It returns casting error, but I do not understand, would you tell me how to fix the code?

Thank you.

Hi Daniel,

 

this is the signature of the RayShoot function:

 

Public Shared Function RayShoot(ByVal ray As Ray3d, ByVal geometry As IEnumerable(Of GeometryBase), ByVal maxReflections As Int32) As Point3d()

 

The second argument is IEnumerable(Of GeometryBase) and you're feeding it a single surface. This is not valid as a single surface is not a collection of geometry.

 

You'll need to create some form of collection and add your surface to it. It doesn't really matter which one, pretty much all collection classes in .NET implement the IEnumerable interface.

 

Dim mirrors As New List(Of GeometryBase)

mirrors.Add(s)

 

or

 

Dim mirrors As GeometryBase() = New GeometryBase() { s }

 

then you use the mirrors variable to call RayShoot().

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service