Table of contents
CSPICE_VLCOM3 computes the vector linear combination of three double
precision 3-dimensional vectors.
Given:
a the double precision scalar variable that multiplies `v1'.
help, a
DOUBLE = Scalar
v1 an arbitrary, double precision 3-dimensional vector.
help, v1
DOUBLE = Array[3]
b the double precision scalar variable that multiplies `v2'.
help, b
DOUBLE = Scalar
v2 an arbitrary, double precision 3-dimensional vector.
help, v2
DOUBLE = Array[3]
c the double precision scalar variable that multiplies `v3'.
help, c
DOUBLE = Scalar
v3 a double precision 3-dimensional vector.
help, v3
DOUBLE = Array[3]
the call:
cspice_vlcom3, a, v1, b, v2, c, v3, sum
returns:
sum the double precision 3-dimensional vector which
contains the linear combination
a * v1 + b * v2 + c * v3
help, sum
DOUBLE = Array[3]
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) Suppose you have an instrument with an elliptical field
of view described by its angular extent along the semi-minor
and semi-major axes.
The following code example demonstrates how to create
16 vectors aiming at visualizing the field-of-view in
three dimensional space.
Example code begins here.
PRO vlcom3_ex1
;;
;; Local parameters.
;;
;; Define the two angular extends, along the semi-major
;; (u) and semi-minor (v) axes of the elliptical field
;; of view, in radians.
;;
MAXANG = 0.07D0
MINANG = 0.035D0
;;
;; Let `u' and `v' be orthonormal 3-vectors spanning the
;; focal plane of the instrument, and `z' its
;; boresight.
;;
u = [1.D0, 0.D0, 0.D0]
v = [0.D0, 1.D0, 0.D0]
z = [0.D0, 0.D0, 1.D0]
;;
;; Find the length of the ellipse's axes. Note that
;; we are dealing with unitary vectors.
;;
a = TAN ( MAXANG )
b = TAN ( MINANG )
;;
;; Compute the vectors of interest and display them
;;
theta = 0.D0
step = cspice_twopi() / 16L
for i=0L, 15L do begin
cspice_vlcom3, 1.D0, z, a * cos(theta), u, $
b * sin(theta), v, vector
print, format='(I2,A,3F10.6)', i, ':', vector
theta = theta + step
endfor
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
0: 0.070115 0.000000 1.000000
1: 0.064777 0.013399 1.000000
2: 0.049578 0.024759 1.000000
3: 0.026832 0.032349 1.000000
4: 0.000000 0.035014 1.000000
5: -0.026832 0.032349 1.000000
6: -0.049578 0.024759 1.000000
7: -0.064777 0.013399 1.000000
8: -0.070115 0.000000 1.000000
9: -0.064777 -0.013399 1.000000
10: -0.049578 -0.024759 1.000000
11: -0.026832 -0.032349 1.000000
12: -0.000000 -0.035014 1.000000
13: 0.026832 -0.032349 1.000000
14: 0.049578 -0.024759 1.000000
15: 0.064777 -0.013399 1.000000
The code reflects precisely the following mathematical expression
For each value of the index `i', from 0 to 2:
sum[i] = a * v1[i] + b * v2[i] + c * v3[i]
No error checking is performed to guard against numeric overflow.
IDL native code to perform the same operation:
sum = a * v1 + b * v2 + c * v3
The IDL expression accepts three n-dimensional vectors.
1) If any of the input arguments, `a', `v1', `b', `v2', `c' or
`v3', is undefined, an error is signaled by the IDL error
handling system.
2) If any of the input arguments, `a', `v1', `b', `v2', `c' or
`v3', 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 `sum' is not a named variable, an error
is signaled by the Icy interface.
None.
1) No error checking is performed to guard against numeric
overflow or underflow. The user is responsible for insuring
that the input values are reasonable.
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, and
completed -Particulars section. 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)
linear combination of three 3-dimensional vectors
|