void vproj_c ( ConstSpiceDouble a[3],
ConstSpiceDouble b[3],
SpiceDouble p[3] )
vproj_c finds the projection of one vector onto another vector.
All vectors are 3-dimensional.
None.
VECTOR
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
a I The vector to be projected.
b I The vector onto which a is to be projected.
p O The projection of a onto b.
a is a double precision, 3-dimensional vector. This
vector is to be projected onto the vector b.
b is a double precision, 3-dimensional vector. This
vector is the vector which receives the projection.
p is a double precision, 3-dimensional vector containing
the projection of a onto b. p may overwrite either
a or b. (p is necessarily parallel to b.) If b is
the zero vector then p will be returned as the zero vector.
None.
Error free.
None.
The given any vectors a and b there is a unique decomposition
of a as a sum v + p such that v the dot product of v and b
is zero, and the dot product of p with b is equal the product
of the lengths of p and b. p is called the projection of
a onto b. It can be expressed mathematically as
dot(a,b)
-------- * b
dot(b,b)
(This is not necessarily the prescription used to compute
the projection. It is intended only for descriptive purposes.)
The following table gives sample inputs and results from calling
vproj_c.
a b p
--------------------------------------------------
(6, 6, 6) ( 2, 0, 0) (6, 0, 0)
(6, 6, 6) (-3, 0, 0) (6, 0, 0)
(6, 6, 0) ( 0, 7, 0) (0, 6, 0)
(6, 0, 0) ( 0, 0, 9) (0, 0, 0)
None.
REFERENCE: Any reasonable calculus text (for example Thomas)
W.L. Taber (JPL)
-CSPICE Version 1.0.0, 08-FEB-1998 (EDW)
3-dimensional vector projection
Link to routine vproj_c source file vproj_c.c
|