Do not run this
Sorry to interrupt you. But I was in need of something like this but not running
Someone help me anyway
’ Calculates the angle between two 3-D vectors.
’ v0 - [in] - the first vector.
’ v1 - [in] - the second vector.
’ the angle in degrees.
Function VectorAngle(v0, v1)
Dim u0 : u0 = Rhino.VectorUnitize(v0)
Dim u1 : u1 = Rhino.VectorUnitize(v1)
Dim dot : dot = Rhino.VectorDotProduct(u0, u1)
’ Force the dot product of the two input vectors to
’ fall within the domain for inverse cosine, which
’ is -1 <= x <= 1. This will prevent runtime
’ “domain error” math exceptions.
If (dot < -1.0) Then
dot = -1.0
ElseIf (dot > 1.0) Then
dot = 1.0
VectorAngle = Rhino.ToDegrees(Rhino.ACos(dot))