org.osm2world.core.math
Class VectorXYZ

Object
  extended by VectorXYZ
All Implemented Interfaces:
Vector3D

public class VectorXYZ
extends Object
implements Vector3D


Field Summary
static VectorXYZ NULL_VECTOR
           
 double x
           
static VectorXYZ X_UNIT
           
 double y
           
static VectorXYZ Y_UNIT
           
 double z
           
static VectorXYZ Z_UNIT
           
 
Constructor Summary
VectorXYZ(double x2, double y2, double z2)
           
 
Method Summary
 VectorXYZ add(double x, double y, double z)
           
 VectorXYZ add(VectorXYZ other)
           
 VectorXYZ add(VectorXZ other)
           
static List<VectorXYZ> addYList(List<VectorXYZ> list, double addY)
           
 double angleTo(VectorXYZ other)
          calculates the angle between this vector and other, but only if both are normalized!
 VectorXYZ cross(VectorXYZ other)
           
 VectorXYZ crossNormalized(VectorXYZ other)
          same result as calling normalize() after cross(VectorXYZ), but avoids creating a temporary vector
 double distanceTo(VectorXYZ other)
           
 double distanceToSquared(VectorXYZ other)
           
 double distanceToXZ(VectorXYZ other)
           
 double distanceToXZ(VectorXZ other)
           
 double dot(VectorXYZ other)
           
 boolean equals(Object obj)
           
 double getX()
           
 double getY()
           
 double getZ()
           
 int hashCode()
           
 VectorXYZ invert()
           
 double length()
           
 double lengthSquared()
           
 VectorXYZ mult(double scalar)
           
 VectorXYZ normalize()
           
 VectorXYZ rotateVec(double angleRad, VectorXYZ n)
          returns the result of rotating this vector around the given normalized vector n
 VectorXYZ rotateX(double angleRad)
          returns the result of rotating this vector around the x axis
 VectorXYZ rotateY(double angleRad)
          returns the result of rotating this vector around the y axis
 VectorXYZ rotateZ(double angleRad)
          returns the result of rotating this vector around the z axis
 VectorXYZ subtract(VectorXYZ other)
           
 VectorXYZ subtract(VectorXZ other)
           
 String toString()
           
 VectorXYZ x(double x)
           
static VectorXYZ xyz(VectorXYZ vector3D)
          creates a VectorXYZ for any Vector3D object.
 VectorXZ xz()
           
 VectorXYZ y(double y)
           
 VectorXYZ z(double z)
           
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public final double x

y

public final double y

z

public final double z

NULL_VECTOR

public static final VectorXYZ NULL_VECTOR

X_UNIT

public static final VectorXYZ X_UNIT

Y_UNIT

public static final VectorXYZ Y_UNIT

Z_UNIT

public static final VectorXYZ Z_UNIT
Constructor Detail

VectorXYZ

public VectorXYZ(double x2,
                 double y2,
                 double z2)
Method Detail

getX

public double getX()
Specified by:
getX in interface Vector3D

getY

public double getY()
Specified by:
getY in interface Vector3D

getZ

public double getZ()
Specified by:
getZ in interface Vector3D

length

public double length()

lengthSquared

public double lengthSquared()

normalize

public VectorXYZ normalize()

add

public VectorXYZ add(VectorXYZ other)

add

public VectorXYZ add(VectorXZ other)

add

public VectorXYZ add(double x,
                     double y,
                     double z)

subtract

public VectorXYZ subtract(VectorXYZ other)

subtract

public VectorXYZ subtract(VectorXZ other)

cross

public VectorXYZ cross(VectorXYZ other)

crossNormalized

public VectorXYZ crossNormalized(VectorXYZ other)
same result as calling normalize() after cross(VectorXYZ), but avoids creating a temporary vector


dot

public double dot(VectorXYZ other)

mult

public VectorXYZ mult(double scalar)

toString

public String toString()
Overrides:
toString in class Object

rotateX

public VectorXYZ rotateX(double angleRad)
returns the result of rotating this vector around the x axis

Parameters:
angleRad - angle in radians

rotateY

public VectorXYZ rotateY(double angleRad)
returns the result of rotating this vector around the y axis

Parameters:
angleRad - angle in radians

rotateZ

public VectorXYZ rotateZ(double angleRad)
returns the result of rotating this vector around the z axis

Parameters:
angleRad - angle in radians

rotateVec

public VectorXYZ rotateVec(double angleRad,
                           VectorXYZ n)
returns the result of rotating this vector around the given normalized vector n

Parameters:
angleRad - angle in radians
n - normalized vector

angleTo

public double angleTo(VectorXYZ other)
calculates the angle between this vector and other, but only if both are normalized!


distanceTo

public double distanceTo(VectorXYZ other)

distanceToSquared

public double distanceToSquared(VectorXYZ other)

distanceToXZ

public double distanceToXZ(VectorXZ other)

distanceToXZ

public double distanceToXZ(VectorXYZ other)

xz

public VectorXZ xz()

x

public VectorXYZ x(double x)

y

public VectorXYZ y(double y)

z

public VectorXYZ z(double z)

invert

public VectorXYZ invert()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

xyz

public static VectorXYZ xyz(VectorXYZ vector3D)
creates a VectorXYZ for any Vector3D object. If the Vector3D is already a VectorXYZ, this can return the original vector.


addYList

public static List<VectorXYZ> addYList(List<VectorXYZ> list,
                                       double addY)