public class PamVector
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
Constructor and Description |
---|
PamVector() |
PamVector(double[] vector) |
PamVector(double x,
double y,
double z) |
PamVector(PamVector vector) |
Modifier and Type | Method and Description |
---|---|
double |
absAngle(PamVector vec)
Calculates the smallest angle between two vectors (0 <= angle < pi/2);
|
PamVector |
absElements()
Make all elements within the vector positive.
|
static PamVector |
add(PamVector... pamVectors)
Add any number of vectors together.
|
PamVector |
add(PamVector vec)
Add another vector to this vector and return the result in a
new Vector
|
static PamVector |
addQuadrature(PamVector... pamVectors)
Add any number of vectors together in quadrature.
|
double |
angle(PamVector vec)
Calculate the angle between two vectors
|
static Jama.Matrix |
arrayToMatrix(PamVector[] pamVectors)
convert a series of vectors into a Matrix
|
PamVector |
clone() |
double |
dist(PamVector vec) |
double |
distSquared(PamVector vec) |
double |
dotProd(PamVector vec) |
boolean |
equals(PamVector vec) |
static PamVector |
fromHeadAndSlant(double heading,
double slantAngle)
Create a unit vector based on a heading (degrees from North)
and a slant angle 90 up up, -90 = down
|
static PamVector |
getCartesianAxes(int iAxis) |
double |
getElement(int iElement)
Get a single vector element
|
int |
getPrincipleAxis() |
static Jama.Matrix |
getRotMatrixX(double angle)
Get a matrix which rotates a vector around the x axis.
|
static Jama.Matrix |
getRotMatrixY(double angle)
Get a matrix which rotates a vector around the y axis.
|
static Jama.Matrix |
getRotMatrixZ(double angle)
Get a matrix which rotates a vector around the z axis.
|
PamVector |
getUnitVector()
Get the unit vector, or if the vector is zero, return
the zero vector (0,0,0).
|
double[] |
getVector() |
static PamVector[] |
getVectorPairs(PamVector[] vectors)
Create a set of vector pairs, which are vectors between all
the vectors in the input argument
|
static PamVector |
getXAxis() |
static PamVector |
getYAxis() |
static PamVector |
getZAxis() |
boolean |
isInLine(PamVector vec)
Test to see whether two vectors lie in a perfect line
|
boolean |
isParallel(PamVector vec)
Tests to see whether two vectors are parallel
|
double |
norm() |
double |
normalise()
Normalise a vector so it has a magnitue of 1.
|
double |
normSquared() |
PamVector |
rotate(double rotationAngle)
Rotate a vector anti-clockwise by an angle.
|
PamVector |
rotate(Jama.Matrix rotationMatrix)
Rotate the vector by a matrix.
|
PamVector |
rotate(PamVector rotationVector)
Rotate a vector using another vector.
|
static PamVector |
rotateVector(PamVector vector,
double[] angle)
Rotates a vector by the Euler angles.
|
static PamVector |
rotateVector(PamVector vector,
PamQuaternion orientation)
Rotates a vector by a Quaternion .
|
void |
setElement(int iElement,
double val)
Set a single vector element
|
void |
setVector(double[] vector) |
PamVector |
sub(PamVector vec)
Subtract another vector from this vector and return the result in a
new Vector
|
double |
sumComponentsSquared(PamVector vec)
A bit like a dot product, but the three components are added
in quadrature.
|
PamVector |
times(double scalar)
Multiply a vector by a scalar
|
java.lang.String |
toString() |
double |
tripleDotProduct(PamVector v1,
PamVector v2)
Calculate the triple product of this with v1 and v2
|
PamVector |
vecProd(PamVector vec) |
static double[] |
vectorsToSurfaceBearings(PamVector[] vectors)
Convert an array of Cartesian vectors into bearings from North.
|
static double |
vectorToSurfaceBearing(PamVector vector)
Convert a Cartesian vector into a bearing from North.
|
double |
xyDistance() |
public PamVector(double[] vector)
public PamVector(double x, double y, double z)
public PamVector(PamVector vector)
public PamVector()
public PamVector clone()
clone
in class java.lang.Object
public double normSquared()
public static PamVector fromHeadAndSlant(double heading, double slantAngle)
heading
- heading from North in degreesslantAngle
- slant angle from the horizontal.public boolean equals(PamVector vec)
vec
- other vector to compare.public PamVector sub(PamVector vec)
vec
- vector to subtractpublic PamVector add(PamVector vec)
vec
- vector to addpublic static PamVector add(PamVector... pamVectors)
pamVectors
- list of vectorspublic static PamVector addQuadrature(PamVector... pamVectors)
pamVectors
- list of vectorspublic static Jama.Matrix arrayToMatrix(PamVector[] pamVectors)
pamVectors
- array of vectorspublic PamVector rotate(Jama.Matrix rotationMatrix)
rotationMatrix
- rotation matrixpublic PamVector rotate(double rotationAngle)
rotationAngle
- rotation angle in radians.public PamVector rotate(PamVector rotationVector)
rotationVector
- public PamVector times(double scalar)
scalar
- scalar valuepublic PamVector getUnitVector()
public double angle(PamVector vec)
vec
- other vectorpublic double absAngle(PamVector vec)
vec
- other vectorpublic double distSquared(PamVector vec)
vec
- other vectorpublic double dist(PamVector vec)
vec
- other vectorpublic double norm()
public double dotProd(PamVector vec)
vec
- a PamVectorpublic double sumComponentsSquared(PamVector vec)
vec
- a Pam Vectorpublic PamVector vecProd(PamVector vec)
vec
- public double tripleDotProduct(PamVector v1, PamVector v2)
v1
- other vectorv2
- other vectorpublic boolean isParallel(PamVector vec)
vec
- other vectorpublic boolean isInLine(PamVector vec)
vec
- other vectorpublic double xyDistance()
public double[] getVector()
public void setVector(double[] vector)
public double getElement(int iElement)
iElement
- element indexpublic void setElement(int iElement, double val)
iElement
- element indexval
- element valuepublic static PamVector getXAxis()
public static PamVector getYAxis()
public static PamVector getZAxis()
public static PamVector getCartesianAxes(int iAxis)
iAxis
- public static PamVector[] getVectorPairs(PamVector[] vectors)
vectors
- array of vectorspublic int getPrincipleAxis()
public java.lang.String toString()
toString
in class java.lang.Object
public static double[] vectorsToSurfaceBearings(PamVector[] vectors)
vectors
- Cartesian vector (need not be a unit vector)public static double vectorToSurfaceBearing(PamVector vector)
vector
- Cartesian vector (need not be a unit vector)public double normalise()
public PamVector absElements()
public static Jama.Matrix getRotMatrixX(double angle)
angle-
- angle to rotate around the x axis in RADIANS.public static Jama.Matrix getRotMatrixY(double angle)
angle-
- angle to rotate around the y axis in RADIANS.public static Jama.Matrix getRotMatrixZ(double angle)
angle-
- angle to rotate around the z axis in RADIANS.public static PamVector rotateVector(PamVector vector, PamQuaternion orientation)
PamQuaternion
- - orientationpublic static PamVector rotateVector(PamVector vector, double[] angle)
heading-
- heading in RADIANS. Here we use 0 to 360 for heading.pitch-
- pitch in RADIANS. Use the standard PAMGUARD convention 90=-g; 0=0 -90=g (g =direction of gravitational field)tilt-
- tilt in RADIANS. Use the standard PAMGUARD convention