org.osm2world.core.math
Class VectorXZ

Object
  extended by VectorXZ
All Implemented Interfaces:
Vector3D

public class VectorXZ
extends Object
implements Vector3D

immutable two-dimensional vector with x and z component


Field Summary
static VectorXZ NULL_VECTOR
           
 double x
           
static VectorXZ X_UNIT
           
 double z
           
static VectorXZ Z_UNIT
           
 
Constructor Summary
VectorXZ(double x, double z)
           
 
Method Summary
 VectorXZ add(VectorXZ other)
          adds the parameter to this vector and returns the result
 double angle()
          gets this vector's angle relative to (0,1).
 double angleTo(VectorXZ other)
           
static double distance(VectorXZ v1, VectorXZ v2)
           
static Function<VectorXZ,Double> distanceFunction(VectorXZ v1)
           
static double distanceSquared(VectorXZ v1, VectorXZ v2)
           
 double distanceTo(VectorXZ other)
           
 double dot(VectorXZ other)
           
 boolean equals(Object obj)
           
static VectorXZ fromAngle(double directionRad)
          returns a unit vector based on an angular direction.
 double getX()
           
 double getY()
           
 double getZ()
           
 int hashCode()
           
 VectorXZ invert()
           
 double length()
           
 double lengthSquared()
           
static List<VectorXYZ> listXYZ(List<VectorXZ> vs, double y)
           
 VectorXZ mult(double scalar)
           
 VectorXZ normalize()
           
 VectorXZ rightNormal()
          returns the vector that would result from calculating the cross product of this vector (normalized and extended to three dimensions) and (0,1,0).
 VectorXZ subtract(VectorXZ other)
          subtracts the parameter from this vector and returns the result
 String toString()
           
 VectorXYZ xyz(double y)
           
static Function<VectorXZ,VectorXYZ> xyzFunction(double y)
           
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public final double x

z

public final double z

NULL_VECTOR

public static final VectorXZ NULL_VECTOR

X_UNIT

public static final VectorXZ X_UNIT

Z_UNIT

public static final VectorXZ Z_UNIT
Constructor Detail

VectorXZ

public VectorXZ(double x,
                double z)
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 VectorXZ normalize()

add

public VectorXZ add(VectorXZ other)
adds the parameter to this vector and returns the result


subtract

public VectorXZ subtract(VectorXZ other)
subtracts the parameter from this vector and returns the result


mult

public VectorXZ mult(double scalar)

invert

public VectorXZ invert()

dot

public double dot(VectorXZ other)

rightNormal

public VectorXZ rightNormal()
returns the vector that would result from calculating the cross product of this vector (normalized and extended to three dimensions) and (0,1,0). It's the vector that, seen from "above", points to the right side of this vector and is orthogonal to it. The resulting vector's length is 1.


distanceTo

public double distanceTo(VectorXZ other)

angle

public double angle()
gets this vector's angle relative to (0,1). Inverse of fromAngle(double).

Returns:
angle in radians

angleTo

public double angleTo(VectorXZ other)
See Also:
angle()

toString

public String toString()
Overrides:
toString in class Object

xyz

public VectorXYZ xyz(double y)

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

fromAngle

public static VectorXZ fromAngle(double directionRad)
returns a unit vector based on an angular direction. For example, angle 0 creates vector (0,1), angle PI/2 creates vector (1,0).

Parameters:
directionRad - direction angle in radians

distance

public static final double distance(VectorXZ v1,
                                    VectorXZ v2)

distanceSquared

public static final double distanceSquared(VectorXZ v1,
                                           VectorXZ v2)

listXYZ

public static final List<VectorXYZ> listXYZ(List<VectorXZ> vs,
                                            double y)

distanceFunction

public static final Function<VectorXZ,Double> distanceFunction(VectorXZ v1)

xyzFunction

public static final Function<VectorXZ,VectorXYZ> xyzFunction(double y)