Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5791

Vector3d.PerpendicularTo Method Elegance

$
0
0

@Jonathan_Hutchinson wrote:

I’ve managed to get this working, but feel I’ve gone the long way around, and not really got the satisfaction of knowing why it’s right / was wrong.

# Perpendicular Vectors
import rhinoscriptsyntax as rs
import Rhino

vector = rs.VectorCreate( [0,0,0] , [2,10,0] )
vector_perp = Rhino.Geometry.Vector3d(vector) #New instance
vector_perp.PerpendicularTo(vector_perp) # Operate on copy vs original

print vector
print vector_perp

-2,-10,0
-10,2,0

I thought the below would have worked. But I got an exception for only providing one argument when two were required. Documentation says there is one parameter though for perpTo, ‘other’, and I can’t see how I’ve used two arguments when it worked.

# Thought it was good, Except it wasn't
import rhinoscriptsyntax as rs
import Rhino

vector = rs.VectorCreate( [0,0,0] , [2,10,0] )
vector_perp = Rhino.Geometry.Vector3d.PerpendicularTo(vector)

Thanks!

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5791

Trending Articles