Grasshopper

algorithmic modeling for Rhino

Is there a VB Script method by which you can find the angle between 2 vectors?

 

Views: 557

Replies to This Discussion

http://www.rhino3d.com/5/rhinocommon/html/M_Rhino_Geometry_Vector3d...

 

Did you have a look at the file I attached in your previous question?

Thanks again.

Yes I did.  I'm still trying to get my head around the math but it looks to simplify my code if I plug it in as a function.  

However what I'd really like to know is where to find the 'home' URL for this link you just sent me.  It looks like it could be the source of the answers for a bunch of questions I have.

http://www.rhino3d.com/5/rhinocommon/

 

Don't bother with that code in my script. It's just a way to deal with negative angles. Native method only returns positive values.

 

Assuming you have three points p1,p2,p3 you can do it so:

 

Dim vec1 As New Vector3d(p2 - p1)    

Dim vec2 As New Vector3d(p3 - p1)
    

Dim angle As Double = Vector3d.VectorAngle(vec1, vec2) * ((180 / math.PI))

 

That would return degrees.

 

 

I am new to grasshopper scripting. May you tell me how to enter the script?

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