Table of contents
CSPICE_VPROJ computes the projection of one 3-dimensional vector onto
another 3-dimensional vector.
Given:
a a double precision, 3-dimensional vector.
help, a
DOUBLE = Array[3]
This vector is to be projected onto the vector `b'.
b a double precision, 3-dimensional vector.
help, b
DOUBLE = Array[3]
This vector is the vector which receives the projection.
the call:
cspice_vproj, a, b, p
returns:
p a double precision, 3-dimensional vector containing the
projection of `a' onto `b'.
help, p
DOUBLE = Array[3]
(`p' is necessarily parallel to `b'.) If `b' is the zero vector
then `p' will be returned as the zero vector.
None.
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
1) Define two sets of vectors and compute the projection of
each vector of the first set on the corresponding vector of
the second set.
Example code begins here.
PRO vproj_ex1
;;
;; Define two vector sets.
;;
a = [ [ 6.D, 6, 6], $
[ 6, 6, 6], $
[ 6, 6, 0], $
[ 6, 0, 0] ]
b = [ [ 2.D, 0, 0], $
[-3, 0, 0], $
[ 0, 7, 0], $
[ 0, 0, 9] ]
;;
;; Calculate the projections.
;;
for i=0, 3 do begin
cspice_vproj, a[*,i], b[*,i], p
print, format='("Vector A : ",3F5.1)', a[*,i]
print, format='("Vector B : ",3F5.1)', b[*,i]
print, format='("Projection: ",3F5.1)', p
print
endfor
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Vector A : 6.0 6.0 6.0
Vector B : 2.0 0.0 0.0
Projection: 6.0 0.0 0.0
Vector A : 6.0 6.0 6.0
Vector B : -3.0 0.0 0.0
Projection: 6.0 -0.0 -0.0
Vector A : 6.0 6.0 0.0
Vector B : 0.0 7.0 0.0
Projection: 0.0 6.0 0.0
Vector A : 6.0 0.0 0.0
Vector B : 0.0 0.0 9.0
Projection: 0.0 0.0 0.0
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.)
1) If any of the input arguments, `a' or `b', is undefined, an
error is signaled by the IDL error handling system.
2) If any of the input arguments, `a' or `b', is not of the
expected type, or it does not have the expected dimensions and
size, an error is signaled by the Icy interface.
3) If the output argument `p' is not a named variable, an error
is signaled by the Icy interface.
None.
1) An implicit assumption exists that `a' and `b' are specified in
the same reference frame. If this is not the case, the
numerical result has no meaning.
ICY.REQ
[1] G. Thomas and R. Finney, "Calculus and Analytic Geometry,"
7th Edition, Addison Wesley, 1988.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.3, 01-NOV-2021 (JDR)
Edited the header to comply with NAIF standard. Added example's
problem statement and reformatted example's output.
Added -Parameters, -Particulars, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.2, 23-NOV-2010 (EDW)
Improved the -I/O section. The section now meets NAIF standard
for Icy headers. Added example code and corresponding
output to the -Examples section.
-Icy Version 1.0.1, 09-DEC-2005 (EDW)
Added -Examples section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
3-vector projection
|