projectVector()

Synopsis

Projects a vector onto a plane, returning a new vector in that plane. The plane is defined by a point and normal vector . The plane normal is the projection direction. If the vector and the normal are aligned, then a degenerate geometry situation is created (a zero vector ), but this is not considered an error, since some vector algebra correctly handles zero vectors as intermediate results. Note, however, that handing a zero vector into most geometry-creation functions will cause problems.

Syntax

projectVector ( v As Vector, _
                planePoint As Point, _
                nor As Vector ) As Vector
Argument Type Description
v Vector The vector to be projected.
planePoint Point A point on the projection plane.
nor Vector The plane normal vector , and the projection vector .

Example 1

The identity projection.
Intent >projectVector(UnitX, point(0,0,0), UnitZ) 
--> Vector_(1.0, 0.0, 0.0, WorldFrame())

Example 2

Note that this is not an error.
Intent >projectVector(UnitX, point(0,0,0), UnitX) 
--> Vector_(0.0, 0.0, 0.0, WorldFrame()) 

Example 3

X and Y components
 Intent >projectVector(vector(1,1,1), point(0,0,0), vector(0,0,1)) 
--> Vector_(1.0, 1.0, 0.0, WorldFrame())

Example 4

The projectVector() function does not make the projected vector into a unit vector .
 Intent >projectVector(vector(2,2,2), point(0,0,0), vector(1,0,0)) 
--> Vector_(0.0, 2.0, 2.0, WorldFrame())

Example 5

If the plane normal vector is in the same direction as the vector to be projected, the function will return a zero vector .
Intent >projectVector(vector(0,0,1), point(0,0,0), vector(0,0,1)) 
--> Vector_(0.0, 0.0, 0.0, WorldFrame())