public abstract class SpatialVector extends VectorBase implements java.io.Serializable
Spatial vectors are either contarvariant (those associated with motion), or covariant (those associated with forces). For a contravariant spatial vector, elements 0-2 correspond to the free vector and elements 3-5 correspond to the line vector. For a covarient spatial vector, elements 0-2 correspond to the line vector and elements 3-5 correspond to the free vector (note that this transposing of element ordering is different from the treatment in Featherstone, which always asigns elements 0-2 to the line vector).
| Modifier and Type | Method and Description |
|---|---|
void |
absolute()
Sets the elements of this spatial vector to their absolute values.
|
SpatialVector |
clone() |
void |
cross(SpatialVector v1,
SpatialVector v2) |
double |
dot(SpatialVector v1)
Returns the dot product of this spatial vector and the spatial vector v1.
|
boolean |
epsilonEquals(SpatialVector v1,
double eps)
Returns true if the elements of this spatial vector equal those of vector
v1within a prescribed tolerance epsilon. |
boolean |
equals(SpatialVector v1)
Returns true if the elements of this spatial vector exactly equal those of
vector
v1. |
void |
get(double[] values)
Copies the elements of this spatial vector into an array of doubles.
|
double |
get(int i)
Gets a single element of this spatial vector.
|
void |
get(Matrix1x6 M)
Copies the value of this spatial vector into a Matrix1x6.
|
void |
get(Matrix6x1 M)
Copies the value of this spatial vector into a Matrix6x1.
|
double |
infinityNorm()
Returns the infinity norm of this spatial vector.
|
void |
inverseTransform(RigidTransform3d X)
Applies an inverse rigid spatial transformation to this vector, in place.
|
void |
inverseTransform(RotationMatrix3d R)
Applies an inverse rotational transformation to this spatial vector, in
place.
|
boolean |
isContravariant()
Returns true if this spatial vector is contravariant.
|
double |
maxElement()
Returns the maximum element value of this spatial vector.
|
double |
minElement()
Returns the minimum element value of this spatial vector.
|
void |
mul(Matrix6d M,
SpatialVector v1)
Multiplies a spatial vector v1 by a Matrix6d and places the result
in this spetial vector.
|
void |
negate()
Negates this spatial vector in place.
|
double |
norm()
Returns the 2 norm of this spatial vector.
|
void |
normalize()
Normalizes this spatial vector in place.
|
double |
normSquared()
Returns the square of the 2 norm of this spatial vector.
|
double |
oneNorm()
Returns the 1 norm of this spatial vector.
|
void |
scale(double s)
Scales the elements of this spatial vector by
s. |
void |
set(double[] values)
Sets the elements of this spatial vector from an array of doubles.
|
int |
set(double[] values,
int idx)
Sets the elements of this spatial vector from an array of doubles,
starting from a particular location.
|
void |
set(int i,
double value)
Sets a single element of this spatial vector.
|
void |
set(Matrix6x1 M)
Sets the value of this spatial vector from the contents of a Matrix6x1.
|
void |
setRandom()
Sets the elements of this vector to uniformly distributed random values in
the range -0.5 (inclusive) to 0.5 (exclusive).
|
void |
setRandom(double lower,
double upper)
Sets the elements of this vector to uniformly distributed random values in
a specified range.
|
void |
setRandom(double lower,
double upper,
java.util.Random generator)
Sets the elements of this vector to uniformly distributed random values in
a specified range, using a supplied random number generator.
|
void |
setZero()
Sets the elements of this spatial vector to zero.
|
int |
size()
Returns the size of this spatial vector (which is always 6)
|
java.lang.String |
toString(NumberFormat fmt)
Returns a String representation of this vector, in which each element is
formatted using a C
printf style format as decribed by the
parameter NumberFormat. |
void |
transform(RigidTransform3d X)
Applies a rigid spatial transformation to this spatial vector, in place.
|
void |
transform(RotationMatrix3d R)
Applies a rotational transformation to this spatial vector, in place.
|
containsNaN, copy, copyAndAdd, copyAndNegate, copyAndScale, copyAndSub, copyAndSubLeft, dot, epsilonEquals, equals, get, getDefaultFormat, hasInf, hasNaN, isColumnVectorStringsVertical, isFixedSize, isRowVector, isWritable, scan, scan, set, set, setColumnVectorStringsVertical, setDefaultFormat, setRowVector, setSize, toString, toString, write, write, write, writeToFilepublic int size()
size in interface Vectorsize in class VectorBasepublic boolean isContravariant()
public double get(int i)
get in interface Vectorget in class VectorBasei - element indexpublic void get(double[] values)
>= 6. The element ordering depends on
whether the vector is contravariant or covariant.get in interface Vectorget in class VectorBasevalues - array into which values are copiedpublic void get(Matrix6x1 M)
M - matrix to be setpublic void get(Matrix1x6 M)
M - matrix to be setpublic void set(int i,
double value)
set in interface Vectorset in class VectorBasei - element indexvalue - element valuejava.lang.ArrayIndexOutOfBoundsException - if i is not in the range 0 to 5.public void set(double[] values)
set in interface Vectorset in class VectorBasevalues - array from which values are copiedpublic int set(double[] values,
int idx)
public void set(Matrix6x1 M)
M - matrix giving new valuespublic void negate()
public void scale(double s)
s.s - scaling factorpublic double norm()
norm in interface Vectornorm in class VectorBasepublic double normSquared()
normSquared in interface VectornormSquared in class VectorBasepublic double maxElement()
maxElement in interface VectormaxElement in class VectorBasepublic double minElement()
minElement in interface VectorminElement in class VectorBasepublic double infinityNorm()
infinityNorm in interface VectorinfinityNorm in class VectorBasepublic double oneNorm()
oneNorm in interface VectoroneNorm in class VectorBasepublic double dot(SpatialVector v1)
public void normalize()
public boolean epsilonEquals(SpatialVector v1, double eps)
v1within a prescribed tolerance epsilon.v1 - vector to compare witheps - comparison tolerancepublic boolean equals(SpatialVector v1)
v1.v1 - vector to compare withpublic void setZero()
public void absolute()
public void cross(SpatialVector v1, SpatialVector v2)
public void transform(RotationMatrix3d R)
R - rotational transformation matrixpublic void inverseTransform(RotationMatrix3d R)
R - rotational transformation matrixpublic void transform(RigidTransform3d X)
X - rigid spatial transformationpublic void inverseTransform(RigidTransform3d X)
X - rigid spatial transformationpublic java.lang.String toString(NumberFormat fmt)
printf style format as decribed by the
parameter NumberFormat.toString in interface VectortoString in class VectorBasefmt - numeric formatVectorBase.isColumnVectorStringsVertical()public void setRandom()
public void setRandom(double lower,
double upper)
lower - lower random value (inclusive)upper - upper random value (exclusive)public void setRandom(double lower,
double upper,
java.util.Random generator)
lower - lower random value (inclusive)upper - upper random value (exclusive)generator - random number generatorpublic SpatialVector clone()
clone in interface Clonableclone in class VectorBasepublic void mul(Matrix6d M, SpatialVector v1)
M - matrix to multiply byv1 - vector to multiply