- java.lang.Object
-
- spice.basic.Vector6
-
- Direct Known Subclasses:
StateVector
public class Vector6 extends java.lang.Object
Class Vector6 represents six-dimensional, double precision vectors. This class provides the common mathematical operations applicable to state vectors.Version 1.0.0 22-DEC-2009 (NJB)
-
-
Field Summary
Fields Modifier and Type Field Description private double[]
v
-
Constructor Summary
Constructors Constructor Description Vector6()
Construct a zero-filled Vector6.Vector6(double[] vin)
Construct a Vector6 from an array of 6 doubles.Vector6(double s0, double s1, double s2, double s3, double s4, double s5)
Construct a Vector6 from 6 double scalars.Vector6(Vector3 v1, Vector3 v2)
Construct a Vector6 from two three-vectors.Vector6(Vector6 vin)
Copy constructor: create a Vector6 from another.
-
Method Summary
Modifier and Type Method Description Vector6
add(Vector6 v2)
Add a Vector6 instance to this instance.void
assign(double[] values)
Assign to a Vector6 instance the contents of an array of 6 doubles.Vector6
dcross(Vector6 s2)
Return the cross product and corresponding derivative defined by two state vectors, where the state vectors are represented by this and a second Vector6 instance.double
ddot(Vector6 s2)
Return the derivative of the dot product of the position components of two state vectors, where the state vectors are represented by this and a second Vector6 instance.Vector6
dhat()
Return the unit-length vector and corresponding derivative defined by a state vector, where the state vector is represented by this instance.double
dist(Vector6 v2)
Return the distance between this and a second Vector6 instance.double
dot(Vector6 v2)
Return the dot product of this and a second Vector6 instance.double
dsep(Vector6 s2)
Return the derivative of the angular separation of the position components of two state vectors, where the state vectors are represented by this and a second Vector6 instance.double
getElt(int i)
Return the element of this instance at index [i].Vector3
getVector3(int i)
Regarding this instance as an array of two 3-vectors, return the specified 3-vector.boolean
isZero()
Indicate whether a Vector6 instance is the zero vector.static Vector6
lcom(double a, Vector6 v1, double b, Vector6 v2)
Compute a vector linear combination of two Vector6 instances.Vector6
negate()
Negate a Vector6 instance, returning a new instance.double
norm()
Return the vector (L2) norm of this instance.Vector6
scale(double s)
Scale a Vector6 instance, creating a new instance.Vector6
sub(Vector6 v2)
Subtract a Vector6 instance from this instance.double[]
toArray()
Return the contents of a Vector6 in an array of 6 doubles.java.lang.String
toString()
Return a string representation of the contents of a Vector6.This overrides Object's toString method.
-
-
-
Constructor Detail
-
Vector6
public Vector6()
Construct a zero-filled Vector6.
-
Vector6
public Vector6(Vector6 vin)
Copy constructor: create a Vector6 from another.- Parameters:
vin
-
-
Vector6
public Vector6(double s0, double s1, double s2, double s3, double s4, double s5)
Construct a Vector6 from 6 double scalars.- Parameters:
s0
-s5
-s1
-s4
-s2
-s3
-
-
Vector6
public Vector6(double[] vin) throws SpiceException
Construct a Vector6 from an array of 6 doubles.- Parameters:
vin
-- Throws:
SpiceException
-
-
Method Detail
-
add
public Vector6 add(Vector6 v2)
Add a Vector6 instance to this instance.- Parameters:
v2
-- Returns:
-
assign
public void assign(double[] values) throws SpiceException
Assign to a Vector6 instance the contents of an array of 6 doubles.- Parameters:
values
-- Throws:
SpiceException
-
dcross
public Vector6 dcross(Vector6 s2) throws SpiceException
Return the cross product and corresponding derivative defined by two state vectors, where the state vectors are represented by this and a second Vector6 instance.- Parameters:
s2
-- Returns:
- Throws:
SpiceException
-
ddot
public double ddot(Vector6 s2) throws SpiceException
Return the derivative of the dot product of the position components of two state vectors, where the state vectors are represented by this and a second Vector6 instance.- Parameters:
s2
-- Returns:
- Throws:
SpiceException
-
dhat
public Vector6 dhat() throws SpiceException
Return the unit-length vector and corresponding derivative defined by a state vector, where the state vector is represented by this instance.- Returns:
- Throws:
SpiceException
-
dist
public double dist(Vector6 v2)
Return the distance between this and a second Vector6 instance.- Parameters:
v2
-- Returns:
-
dot
public double dot(Vector6 v2) throws SpiceException
Return the dot product of this and a second Vector6 instance.- Parameters:
v2
-- Returns:
- Throws:
SpiceException
-
dsep
public double dsep(Vector6 s2) throws SpiceException
Return the derivative of the angular separation of the position components of two state vectors, where the state vectors are represented by this and a second Vector6 instance.- Parameters:
s2
-- Returns:
- Throws:
SpiceException
-
getElt
public double getElt(int i) throws SpiceException
Return the element of this instance at index [i].- Parameters:
i
-- Returns:
- Throws:
SpiceException
-
getVector3
public Vector3 getVector3(int i) throws SpiceException
Regarding this instance as an array of two 3-vectors, return the specified 3-vector.- Parameters:
i
-- Returns:
- Throws:
SpiceException
-
isZero
public boolean isZero()
Indicate whether a Vector6 instance is the zero vector.- Returns:
-
lcom
public static Vector6 lcom(double a, Vector6 v1, double b, Vector6 v2)
Compute a vector linear combination of two Vector6 instances.- Parameters:
a
-v2
-v1
-b
-- Returns:
-
negate
public Vector6 negate()
Negate a Vector6 instance, returning a new instance.- Returns:
-
norm
public double norm()
Return the vector (L2) norm of this instance.- Returns:
-
scale
public Vector6 scale(double s)
Scale a Vector6 instance, creating a new instance.- Parameters:
s
-- Returns:
-
sub
public Vector6 sub(Vector6 v2)
Subtract a Vector6 instance from this instance.- Parameters:
v2
-- Returns:
-
toArray
public double[] toArray()
Return the contents of a Vector6 in an array of 6 doubles.- Returns:
-
toString
public java.lang.String toString()
Return a string representation of the contents of a Vector6.This overrides Object's toString method.- Overrides:
toString
in classjava.lang.Object
- Returns:
-
-