Package org.meteoinfo.jts.math
Class Vector3D
- java.lang.Object
-
- org.meteoinfo.jts.math.Vector3D
-
public class Vector3D extends java.lang.ObjectRepresents a vector in 3-dimensional Cartesian space.
-
-
Constructor Summary
Constructors Constructor Description Vector3D(double x, double y, double z)Vector3D(Coordinate v)Vector3D(Coordinate from, Coordinate to)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Vector3Dcreate(double x, double y, double z)Creates a new vector with given X and Y components.static Vector3Dcreate(Coordinate coord)Creates a vector from aCoordinate.static doubledot(Coordinate v1, Coordinate v2)Computes the 3D dot-product of twoCoordinates.static doubledot(Coordinate A, Coordinate B, Coordinate C, Coordinate D)Computes the dot product of the 3D vectors AB and CD.doubledot(Vector3D v)Computes the dot-product of two vectorsdoublegetX()doublegetY()doublegetZ()doublelength()static doublelength(Coordinate v)Vector3Dnormalize()static Coordinatenormalize(Coordinate v)java.lang.StringtoString()Gets a string representation of this vector
-
-
-
Constructor Detail
-
Vector3D
public Vector3D(Coordinate v)
-
Vector3D
public Vector3D(Coordinate from, Coordinate to)
-
Vector3D
public Vector3D(double x, double y, double z)
-
-
Method Detail
-
dot
public static double dot(Coordinate A, Coordinate B, Coordinate C, Coordinate D)
Computes the dot product of the 3D vectors AB and CD.- Parameters:
A-B-C-D-- Returns:
- the dot product
-
create
public static Vector3D create(double x, double y, double z)
Creates a new vector with given X and Y components.- Parameters:
x- the x componenty- the y componentz- the z component- Returns:
- a new vector
-
create
public static Vector3D create(Coordinate coord)
Creates a vector from aCoordinate.- Parameters:
coord- the Coordinate to copy- Returns:
- a new vector
-
dot
public static double dot(Coordinate v1, Coordinate v2)
Computes the 3D dot-product of twoCoordinates.- Parameters:
v1- the first vectorv2- the second vector- Returns:
- the dot product of the vectors
-
getX
public double getX()
-
getY
public double getY()
-
getZ
public double getZ()
-
dot
public double dot(Vector3D v)
Computes the dot-product of two vectors- Parameters:
v- a vector- Returns:
- the dot product of the vectors
-
length
public double length()
-
length
public static double length(Coordinate v)
-
normalize
public Vector3D normalize()
-
normalize
public static Coordinate normalize(Coordinate v)
-
toString
public java.lang.String toString()
Gets a string representation of this vector- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representing this vector
-
-