|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.talvi.puffinplot.data.Vec3
public class Vec3
An immutable three-dimensional cartesian vector. The class contains many methods for manipulating vectors and collections of vectors.
Field Summary | |
---|---|
static Vec3 |
DOWN
a unit vector pointing down |
static Vec3 |
EAST
a unit vector pointing east |
static Vec3 |
NORTH
a unit vector pointing north |
static Vec3 |
ORIGIN
the origin vector (zero along each axis) |
double |
x
the x component of the vector |
double |
y
the y component of the vector |
double |
z
the z component of the vector |
Constructor Summary | |
---|---|
Vec3(double x,
double y,
double z)
Creates a vector with the specified components. |
Method Summary | |
---|---|
Vec3 |
addDecRad(double angle)
Returns a new vector equal to this vector with the specified angle added to the declination. |
Vec3 |
addIncRad(double angle)
Returns a new vector equal to this vector with the specified angle added to the inclination. |
double |
angleTo(Vec3 v)
Returns the angle between this vector and another vector. |
Vec3 |
correctForm(double az,
double dip)
Applies a sample correction to this vector. |
Vec3 |
correctSample(double az,
double dip)
Applies a sample correction to this vector. |
Vec3 |
cross(Vec3 v)
Returns the cross product of this vector and another vector. |
Vec3 |
divideBy(double a)
Divides this vector by a scalar value. |
Vec3 |
divideBy(Vec3 v)
Divides the components of this vector individually by the corresponding components of another vector. |
double |
dot(Vec3 v)
Returns the dot product of this vector and another vector. |
static Vec3 |
equatorPoint(Vec3 v0,
Vec3 v1)
Returns the unit vector on the intersection of the equator (z=0 line) and the great circle between the supplied points. |
static Vec3 |
fromPolarDegrees(double mag,
double inc,
double dec)
Creates a vector from a polar specification in degrees. |
static Vec3 |
fromPolarRadians(double mag,
double inc,
double dec)
Creates a vector from a polar specification in radians. |
double |
getComponent(MeasurementAxis component)
Returns a specified component of this vector. |
double |
getDecDeg()
Returns this vector's declination in degrees. |
double |
getDecRad()
Returns this vector's declination in radians. |
static double[][] |
getFormationCorrectionMatrix(double az,
double dip)
Returns a matrix to correct a vector for a given formation orientation. |
double |
getIncDeg()
Returns this vector's inclination in degrees. |
double |
getIncRad()
Returns this vector's inclination in radians. |
static double[][] |
getSampleCorrectionMatrix(double az,
double dip)
Returns a matrix to correct a vector for a given sample orientation. |
java.util.List<Vec3> |
greatCirclePoints(int n,
boolean closed)
Returns a list of equally spaced points around a great circle having this vector as its pole. |
static java.util.List<java.util.List<Vec3>> |
interpolateEquatorPoints(java.util.List<Vec3> vs)
Given a list of points, return a a list of lists containing the same points plus possible extras. |
Vec3 |
invert()
Returns the inverse of this vector. |
double |
mag()
Returns the magnitude of this vector. |
static java.util.List<Vec3> |
makeEllipse(KentParams kentParams)
Returns a list of points outlining the confidence ellipse for a supplied set of Kent statistical parameters. |
java.util.List<Vec3> |
makeSmallCircle(double radiusDegrees)
Returns a list of vectors defining a small circle around this vector's direction. |
static Vec3 |
mean(java.util.Collection<Vec3> vectors)
Returns the mean of a collection of vectors. |
static Vec3 |
meanDirection(java.util.Collection<Vec3> points)
Returns the mean direction of a collection of unit vectors. |
Vec3 |
minus(Vec3 v)
Subtracts another vector from this vector. |
Vec3 |
nearestOnCircle(Vec3 v)
Using the enclosing vector to define the pole of a great circle G, this method accepts another unit vector v and returns the nearest unit vector to v which lies on G. |
Vec3 |
normalize()
Normalizes this vector. |
Matrix |
oTensor()
Returns the orientation tensor of this vector. |
Vec3 |
plus(Vec3 v)
Adds this vector and another vector. |
Vec3 |
rot180(MeasurementAxis axis)
Rotates the vector by180 degrees about the specified axis. |
Vec3 |
rotY(double angle)
Rotates this vector about the y axis. |
Vec3 |
rotZ(double angle)
Rotates this vector about the z axis. |
boolean |
sameHemisphere(Vec3 v)
Returns true if and only if the supplied vector is in the same (upper/lower) hemisphere as this one. |
Vec3 |
setX(double newX)
Sets the x component of this vector. |
Vec3 |
setY(double newY)
Sets the y component of this vector. |
Vec3 |
setZ(double newZ)
Sets the z component of this vector. |
static java.util.List<Vec3> |
spherInterpDir(Vec3 v0,
Vec3 v1,
Vec3 onPath,
double stepSize)
Interpolates a great-circle path in a chosen direction between two specified vectors. |
static java.util.List<Vec3> |
spherInterpolate(Vec3 v0,
Vec3 v1,
double stepSize)
Given two vectors, interpolates unit vectors along a great circle. |
static Vec3 |
sum(java.util.Collection<Vec3> vectors)
Returns the sum of a specified collection of vectors. |
Vec3 |
times(double a)
Multiplies this vector by a scalar value. |
Vec3 |
times(Vec3 v)
Multiplies the components of this vector individually by the corresponding components of another vector. |
java.lang.String |
toString()
Returns a string representation of this vector. |
Vec3 |
transform(double[][] matrix)
Multiplies this vector by a supplied matrix. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final double x
public final double y
public final double z
public static final Vec3 ORIGIN
public static final Vec3 NORTH
public static final Vec3 EAST
public static final Vec3 DOWN
Constructor Detail |
---|
public Vec3(double x, double y, double z)
x
- the x component of the new vectory
- the y component of the new vectorz
- the z component of the new vectorMethod Detail |
---|
public Vec3 addDecRad(double angle)
angle
- the angle in radians to add to the declination
public Vec3 addIncRad(double angle)
angle
- the angle in radians to add to the inclination
public Vec3 rot180(MeasurementAxis axis)
axis
- the axis about which to rotate
public static Vec3 equatorPoint(Vec3 v0, Vec3 v1)
v0
- a vector specifying a directionv1
- a vector specifying a direction
v
for which v.z==0
, which lies
on the shortest great-circle path between the normalizations of
v0
and v1
public boolean sameHemisphere(Vec3 v)
v
- a vector
true
if and only if the supplied vector is in the same (upper/lower)
hemisphere as this one.public static java.util.List<java.util.List<Vec3>> interpolateEquatorPoints(java.util.List<Vec3> vs)
vs
- a list of vectors specifying directions
vs
; none of the sub-lists crosses the equatorpublic static java.util.List<Vec3> spherInterpolate(Vec3 v0, Vec3 v1, double stepSize)
v0
- a vectorv1
- a vectorstepSize
- the step size for interpolation in radians
v0
and v1
public static java.util.List<Vec3> spherInterpDir(Vec3 v0, Vec3 v1, Vec3 onPath, double stepSize)
onPath
.
v0
- a vectorv1
- a vectoronPath
- arc direction indicatorstepSize
-
v0
and v1
, passing as close as possible to onPath
public Vec3 rotY(double angle)
angle
- an angle in radians
angle
radians about the y axispublic Vec3 rotZ(double angle)
angle
- an angle in radians
angle
radians about the z axispublic static double[][] getSampleCorrectionMatrix(double az, double dip)
az
- the sample dip azimuth in radiansdip
- the sample dip angle in radians
public Vec3 correctSample(double az, double dip)
az
- the sample dip azimuth in radiansdip
- the sample dip angle in radians
public Vec3 correctForm(double az, double dip)
az
- the formation dip azimuth in radiansdip
- the formation dip angle in radians
public static double[][] getFormationCorrectionMatrix(double az, double dip)
az
- the formation dip azimuth in radiansdip
- the formation dip angle in radians
public java.util.List<Vec3> greatCirclePoints(int n, boolean closed)
n
- number of points to returnclosed
- if true, first point will also be appended to end of list,
giving n+1 points, but only n unique ones, creating a closed circle.
public Vec3 transform(double[][] matrix)
matrix
- a three-by-three matrix
public Vec3 nearestOnCircle(Vec3 v)
v
- a unit vector
public Vec3 normalize()
public double getComponent(MeasurementAxis component)
component
- the component to return
public double mag()
public Vec3 plus(Vec3 v)
v
- a vector
v
public Vec3 minus(Vec3 v)
v
- a vector
v
public Vec3 times(double a)
a
- a number
a
public Vec3 times(Vec3 v)
v
- a vector
(this.x*v.x,
this.y*v.y, this.z*v.z)
public Vec3 divideBy(double a)
a
- a number
a
public Vec3 divideBy(Vec3 v)
v
- a vector
(this.x/v.x,
this.y/v.y, this.z/v.z)
public double dot(Vec3 v)
v
- a vector
v
public Vec3 cross(Vec3 v)
v
- a vector
v
public Vec3 invert()
public Matrix oTensor()
public double angleTo(Vec3 v)
v
- a vector
v
public static Vec3 fromPolarDegrees(double mag, double inc, double dec)
mag
- magnitude for the new vectorinc
- inclination for the new vector, in degreesdec
- declination for the new vector, in degrees
public static Vec3 fromPolarRadians(double mag, double inc, double dec)
mag
- magnitude for the new vectorinc
- inclination for the new vector, in radiansdec
- declination for the new vector, in radians
public double getIncRad()
public double getDecRad()
Returns this vector's declination in radians.
public double getIncDeg()
public double getDecDeg()
public static Vec3 sum(java.util.Collection<Vec3> vectors)
vectors
- a collections of vectors
public static Vec3 meanDirection(java.util.Collection<Vec3> points)
points
- a collection of unit vectors
points
public static Vec3 mean(java.util.Collection<Vec3> vectors)
vectors
- a collections of vectors
public Vec3 setX(double newX)
newX
- the new value for the x component
public Vec3 setY(double newY)
newY
- the new value for the y component
public Vec3 setZ(double newZ)
newZ
- the new value for the z component
public java.util.List<Vec3> makeSmallCircle(double radiusDegrees)
radiusDegrees
- the radius of the desired circle, in degrees
public static java.util.List<Vec3> makeEllipse(KentParams kentParams)
kentParams
- a set of Kent parameters
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |