Grasshopper

algorithmic modeling for Rhino

Hi,

i 'm looking for compute the angle between two lignes wit one intersection.

I doesn't find something on SDK...

Any idea?

Thanks for help:)

Views: 309

Replies to This Discussion

Wouldn't it just be the angle between the tangents of those lines?

 

Have a look at Rhino.Geometry.Vector3d.VectorAngle

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

perfect:)

 

Dim angleR As Double
    Dim v1 As New vector3d
    Dim v2 As New vector3d

    Dim p1 As New Point3d
    Dim p2 As New Point3d

    Dim p_inter As New point3d


    'on cherche l'intersection entre ligne1 et ligne2
    '--------------------------------------------------------------------------------------------------------------
    Dim x As Intersect.CurveIntersections = Intersect.Intersection.CurveCurve(ligne1, ligne2, 0.0001, 0.0001)
    'on présume une seule intersection, un point 3d
    If x.count > 0  Then
      If (x(0).IsPoint) Then
        p_Inter = x.item(0).PointA
      End If
    End If
    '--------------------------------------------------------------------------------------------------------------

    p1 = ligne1.pointAtend
    p2 = ligne2.pointAtend

    'on calcul les vecteures
    '--------------------------------------------------------------------------------------------------------------
    v1.X = p1.X - p_inter.X
    v1.Y = p1.Y - p_inter.Y
    v1.Z = p1.Z - p_inter.Z

    v2.X = p2.X - p_inter.X
    v2.Y = p2.Y - p_inter.Y
    v2.Z = p2.Z - p_inter.Z
    '--------------------------------------------------------------------------------------------------------------


    'on calcule l'angle
    angleR = Vector3d.vectorAngle(v1, v2)

    'On transforme les radians en degree
    A = (180 / math.Pi) * angleR

    REFLEX = 360 - A

 

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