Table of contents
CSPICE_UCRSS computes the normalized cross product of two 3-vectors.
Given:
v1,
v2 two double precision 3-dimensional vectors.
help, v1
DOUBLE = Array[3]
help, v2
DOUBLE = Array[3]
Typically, these might represent the (possibly unit) vector to
a planet, Sun, or a star which defines the orientation of axes
of some reference frame.
the call:
cspice_ucrss, v1, v2, vout
returns:
vout the double precision 3-dimensional normalized cross product of
`v1' and `v2'.
help, vout
DOUBLE = Array[3]
`vout' is the result of the computation
v1 x v2
---------------
|| v1 x v2 ||
where "x" denotes the cross product and ||x||| the norm
of a vector `x'.
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 normalized cross
product of each vector in first set and the corresponding
vector in the second set.
Example code begins here.
PRO ucrss_ex1
;;
;; Local parameters.
;;
SETSIZ = 2L
;;
;; Define the two vector sets.
;;
v1 = [ [ 0.D0, 1.D0, 0.D0 ], [ 5.D0, 5.D0, 5.D0 ] ]
v2 = [ [ 3.D0, 0.D0, 0.D0 ], [ -2.D0, -2.D0, -2.D0 ] ]
;;
;; Calculate the cross product of each pair of vectors
;;
for i=0L, SETSIZ-1L do begin
cspice_ucrss, v1[*,i], v2[*,i], vout
print, format='(A,3F5.1)', 'Vector A : ', v1[*,i]
print, format='(A,3F5.1)', 'Vector B : ', v2[*,i]
print, format='(A,3F5.1)', 'Normalized cross product: ', vout
print, ' '
endfor
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Vector A : 0.0 1.0 0.0
Vector B : 3.0 0.0 0.0
Normalized cross product: 0.0 0.0 -1.0
Vector A : 5.0 5.0 5.0
Vector B : -2.0 -2.0 -2.0
Normalized cross product: 0.0 0.0 0.0
Native IDL code to perform the same operation:
vout = crossp( v1, v2) / norm( crossp(v1,v2) )
The IDL functions accept arbitrary size N-vectors.
1) If the cross product of `v1' and `v2' yields the zero-vector,
then the zero-vector is returned instead of a vector of
unit length.
2) If any of the input arguments, `v1' or `v2', is undefined, an
error is signaled by the IDL error handling system.
3) If any of the input arguments, `v1' or `v2', is not of the
expected type, or it does not have the expected dimensions and
size, an error is signaled by the Icy interface.
4) If the output argument `vout' is not a named variable, an
error is signaled by the Icy interface.
None.
None.
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.3, 10-AUG-2021 (JDR)
Edited the header to comply with NAIF standard. Added complete
code examples.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections. Moved the
contents of the existing -Examples section to -Particulars.
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, 13-JUN-2011 (EDW)
Edits to comply with NAIF standard for Icy headers.
-Icy Version 1.0.1, 09-DEC-2005 (EDW)
Added -Examples section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
unitized cross product
|