perpendicular()

Synopsis

Returns a unit vector which is perpendicular to the given vector . This function uses the "Arbitrary Axis Algorithm" and even though there are an infinite number of possible valid results, the results are predictable and consistent. Vectors which are in one of the primary planes will get results in another primary plane. Furthermore, if the given vector is in the XY plane, then the perpendicular is as well. This ensures that 2D problems stay in-plane. This function will always return a unit vector .

Syntax

perpendicular ( vec As Vector ) As Vector 
Argument Type Description
vec Vector The given vector .

Example 1

Intent >perpendicular(Vector(1,0,0)) 
--> Vector_(0.0, 1.0, 0.0, WorldFrame()) 
The actual output display may vary.

Example 2

Intent >perpendicular(Vector(1,1,0)) 
--> Vector_(-0.707, 0.707, 0.0, WorldFrame()) 
Note that the result is always a unit vector .