JNISpice
version 2.0.0

spice.basic
Class Vector3

java.lang.Object
  extended by spice.basic.Vector3
Direct Known Subclasses:
EllipsoidPointNearPoint, LimbPoint, PositionVector, SubObserverRecord, SubSolarRecord, SurfacePoint, TerminatorPoint, VelocityVector

public class Vector3
extends java.lang.Object

Class Vector3 represents and provides methods implementing mathematical operations on three-dimensional vectors.

Supported operations include:

   addition                             add(spice.basic.Vector3)
   cross product                        cross(spice.basic.Vector3)
   dot product                          dot(spice.basic.Vector3)
   distance between vectors             dist(spice.basic.Vector3)
   unitize vector                       hat()
   test for equality to zero            isZero()
   two-vector linear combination        lcom(double a, Vector3 v1, 
double b, Vector3 v2)
   three-vector linear combination      lcom(double a, Vector3 v1, 
double b, Vector3 v2, double c, Vector3 v3)
   vector negation                      negate()
   vector norm                          norm()
   vector perpendicular component       perp(spice.basic.Vector3)
   vector projection onto vector        proj(spice.basic.Vector3)
   rotate vector about coordinate axis  rotate(int axisIndex, 
double angle)
   rotate vector about vector           rotate(Vector3 axisVector, 
double angle)
   scalar multiplication                scale(double)
   angular separation                   sep(spice.basic.Vector3)
   subtraction                          sub(spice.basic.Vector3)
   unitized cross product               ucross(spice.basic.Vector3)

For methods involving derivatives of functions of 3-dimensional vectors, such as derivatives of dot products, see the class Vector6.

Version 1.0.0 17-NOV-2009 (NJB)


Constructor Summary
Vector3()
          Construct a zero-filled Vector3.
Vector3(double[] vin)
          Construct a Vector3 from an array of 3 doubles.
Vector3(double v0, double v1, double v2)
          Construct a Vector3 from three double scalars.
Vector3(Vector3 vin)
          Copy constructor: create a new Vector3 from another.
 
Method Summary
 Vector3 add(Vector3 v2)
          Add two 3 dimensional vectors.
 void assign(double[] values)
          Assign the contents of an array of three doubles to a Vector3.
 Vector3 cross(Vector3 v2)
          Compute the cross product of two 3-dimensional vectors.
 double dist(Vector3 v1)
          Return the distance between two three-dimensional vectors.
 double dot(Vector3 v2)
          Compute the dot product of two double precision, 3-dimensional vectors.
 double getElt(int i)
          Return the element of this instance at index [i].
 Vector3 hat()
          Find the unit vector along a double precision 3-dimensional vector.
 boolean isZero()
          Indicate whether a 3-vector is the zero vector.
static Vector3 lcom(double a, Vector3 v1, double b, Vector3 v2)
          Compute a vector linear combination of two double precision, 3-dimensional vectors.
static Vector3 lcom(double a, Vector3 v1, double b, Vector3 v2, double c, Vector3 v3)
          Compute a vector linear combination of three double precision, 3-dimensional vectors.
 Vector3 negate()
          Negate a double precision 3-dimensional vector.
 double norm()
          Compute the magnitude of a double precision, 3-dimensional vector.
 Vector3 perp(Vector3 v2)
          Find the component of this vector orthogonal to a given vector.
 Vector3 proj(Vector3 v2)
          Find the orthogonal projection of this vector onto a given vector.
 Vector3 rotate(int axisIndex, double angle)
          Transform this vector into a basis that is rotated in the counterclockwise sense about a given coordinate axis by a given angle.
 Vector3 rotate(Vector3 axisVector, double angle)
          Rotate this vector in the counterclockwise sense about a given vector by a given angle.
 Vector3 scale(double s)
          Multiply a Vector3 by a scalar.
 double sep(Vector3 v2)
          Find the separation angle in radians between two double precision, 3-dimensional vectors.
 Vector3 sub(Vector3 v2)
          Compute the difference between two 3-dimensional, double precision vectors.
 double[] toArray()
          Return the contents of a Vector3 in an array of 3 doubles.
 java.lang.String toString()
          Return a string representation of the contents of a Vector3.
 Vector3 ucross(Vector3 v2)
          Return the unitized cross product of this vector and a given vector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vector3

public Vector3()
Construct a zero-filled Vector3.


Vector3

public Vector3(Vector3 vin)
Copy constructor: create a new Vector3 from another.


Vector3

public Vector3(double[] vin)
Construct a Vector3 from an array of 3 doubles.


Vector3

public Vector3(double v0,
               double v1,
               double v2)
Construct a Vector3 from three double scalars.

Method Detail

assign

public void assign(double[] values)
            throws SpiceException
Assign the contents of an array of three doubles to a Vector3.

Throws:
SpiceException

add

public Vector3 add(Vector3 v2)
Add two 3 dimensional vectors.


cross

public Vector3 cross(Vector3 v2)
Compute the cross product of two 3-dimensional vectors.


dist

public double dist(Vector3 v1)
Return the distance between two three-dimensional vectors.


dot

public double dot(Vector3 v2)
Compute the dot product of two double precision, 3-dimensional vectors.


getElt

public double getElt(int i)
              throws SpiceException
Return the element of this instance at index [i].

Throws:
SpiceException

hat

public Vector3 hat()
Find the unit vector along a double precision 3-dimensional vector.


isZero

public boolean isZero()
Indicate whether a 3-vector is the zero vector.


lcom

public static Vector3 lcom(double a,
                           Vector3 v1,
                           double b,
                           Vector3 v2)
Compute a vector linear combination of two double precision, 3-dimensional vectors.


lcom

public static Vector3 lcom(double a,
                           Vector3 v1,
                           double b,
                           Vector3 v2,
                           double c,
                           Vector3 v3)
Compute a vector linear combination of three double precision, 3-dimensional vectors.


negate

public Vector3 negate()
Negate a double precision 3-dimensional vector.


norm

public double norm()
Compute the magnitude of a double precision, 3-dimensional vector.


perp

public Vector3 perp(Vector3 v2)
             throws SpiceException
Find the component of this vector orthogonal to a given vector.

Throws:
SpiceException

proj

public Vector3 proj(Vector3 v2)
             throws SpiceException
Find the orthogonal projection of this vector onto a given vector.

Throws:
SpiceException

rotate

public Vector3 rotate(int axisIndex,
                      double angle)
               throws SpiceException
Transform this vector into a basis that is rotated in the counterclockwise sense about a given coordinate axis by a given angle. Units are radians.

Equivalently, this method rotates this vector by the negative of the input angle about the indicated axis.

The coordinate axis is identified by an integer:

     1 == X axis
     2 == Y axis
     3 == Z axis
   

Throws:
SpiceException

rotate

public Vector3 rotate(Vector3 axisVector,
                      double angle)
               throws SpiceException
Rotate this vector in the counterclockwise sense about a given vector by a given angle. Units are radians.

Throws:
SpiceException

scale

public Vector3 scale(double s)
Multiply a Vector3 by a scalar.


sub

public Vector3 sub(Vector3 v2)
Compute the difference between two 3-dimensional, double precision vectors.


sep

public double sep(Vector3 v2)
Find the separation angle in radians between two double precision, 3-dimensional vectors. This angle is defined as zero if either vector is zero.


toArray

public double[] toArray()
Return the contents of a Vector3 in an array of 3 doubles.


toString

public java.lang.String toString()
Return a string representation of the contents of a Vector3. This overrides Object's toString method.

Overrides:
toString in class java.lang.Object

ucross

public Vector3 ucross(Vector3 v2)
               throws SpiceException
Return the unitized cross product of this vector and a given vector.

Return the zero vector if the cross product is zero.

Throws:
SpiceException

JNISpice
version 2.0.0

JNISpice Alpha Test Version 2.0.0 28-JAN-2017 (NJB)