- Abstract
Compute a vector linear combination of two double precision,
3-dimensional vectors.
- Required_Reading
None.
- Brief_I/O
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
- Detailed_Input
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.
- Detailed_Output
sum is an arbitrary, double precision 3-dimensional vector
which contains the linear combination a*v1 + b*v2.
- Parameters
None.
- Particulars
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.
- Examples
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 )
- Restrictions
No error checking is performed to guard against numeric overflow
or underflow. The user is responsible for insuring that the
input values are reasonable.
- Exceptions
Error free.
- Files
None
- Author_and_Institution
W.L. Taber (JPL)
E.D. Wright (JPL)
- Literature_References
None
- Version
-CSPICE Version 1.1.0, 22-OCT-1998 (NJB)
Made input vectors const.
-CSPICE Version 1.0.0, 08-FEB-1998 (EDW)
- Index_Entries
linear combination of two 3-dimensional vectors
- Link to routine source