void vlcom_c ( SpiceDouble a,
ConstSpiceDouble v1[3],
SpiceDouble b,
ConstSpiceDouble v2[3],
SpiceDouble sum[3] )
Compute a vector linear combination of two double precision,
3-dimensional vectors.
None.
VECTOR
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
a I Coefficient of v1
v1 I Vector in 3-space
b I Coefficient of v2
v2 I Vector in 3-space
sum O Linear Vector Combination a*v1 + b*v2
a This double precision variable multiplies v1.
v1 This is an arbitrary, double precision 3-dimensional
vector.
b This double precision variable multiplies v2.
v2 This is an arbitrary, double precision 3-dimensional
vector.
sum is an arbitrary, double precision 3-dimensional vector
which contains the linear combination a*v1 + b*v2.
None.
Error free.
None
For each index from 0 to 2, this routine implements in C
code the expression:
sum[i] = a*v1[i] + b*v2[i]
No error checking is performed to guard against numeric overflow.
To generate a sequence of points on an ellipse with major
and minor axis vectors major and minor, one could use the
following code fragment
step = twopi_c()/ n;
ang = 0.0;
for ( i = 0; i < n; i++ )
{
vlcom_c ( cos(ang),major, sin(ang),minor, point );
do something with the ellipse point just constructed
ang = ang + step;
}
As a second example, suppose that u and v are orthonormal vectors
that form a basis of a plane. Moreover suppose that we wish to
project a vector x onto this plane, we could use the following
call inserts this projection into proj.
vlcom_c ( vdot_c(x,v),v, vdot_c(x,u),u, proj )
No error checking is performed to guard against numeric overflow
or underflow. The user is responsible for insuring that the
input values are reasonable.
None
W.L. Taber (JPL)
E.D. Wright (JPL)
-CSPICE Version 1.1.0, 22-OCT-1998 (NJB)
Made input vectors const.
-CSPICE Version 1.0.0, 08-FEB-1998 (EDW)
linear combination of two 3-dimensional vectors
Link to routine vlcom_c source file vlcom_c.c
|