org.onebusaway.geospatial.model
Class PointVector

java.lang.Object
  extended by org.onebusaway.geospatial.model.PointVector

public class PointVector
extends Object


Constructor Summary
PointVector(double... vector)
           
 
Method Summary
<T extends Point>
T
addToPoint(T origin)
           
static
<T extends Point>
PointVector
create(T origin, T direction)
           
 double dotProduct(PointVector v)
           
 boolean equals(Object obj)
          Object Interface
 double getAngle()
           
 double getAngle(PointVector v)
           
 PointVector getAsLength(double length)
          Scale our vector such that it has the specified length
 double getCosAngle(PointVector v)
           
 PointVector getCrossProduct(PointVector v)
           
 int getDimensions()
           
 double getOrdinate(int dimension)
           
 double[] getOrdinates()
           
 PointVector getProjection(PointVector v)
          Project a vector v onto this vector
 PointVector getScaled(double factor)
          Operations
 double getSinAngle(PointVector v)
           
 PointVector getUnitVector()
           
 double getX()
           
 double getY()
           
 double getZ()
           
 int hashCode()
           
 double length()
          Properties
 PointVector rotate(double angle)
           
 PointVector rotate(double angle, int dimensionA, int dimensionB)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PointVector

public PointVector(double... vector)
Method Detail

create

public static <T extends Point> PointVector create(T origin,
                                                   T direction)

getDimensions

public int getDimensions()

getOrdinate

public double getOrdinate(int dimension)

getOrdinates

public double[] getOrdinates()

getX

public double getX()

getY

public double getY()

getZ

public double getZ()

length

public double length()
Properties


dotProduct

public double dotProduct(PointVector v)

getCrossProduct

public PointVector getCrossProduct(PointVector v)

getCosAngle

public double getCosAngle(PointVector v)

getSinAngle

public double getSinAngle(PointVector v)

getAngle

public double getAngle(PointVector v)
Parameters:
v - the other vector
Returns:
the angle between two vectors

getAngle

public double getAngle()

getScaled

public PointVector getScaled(double factor)
Operations


getUnitVector

public PointVector getUnitVector()

getProjection

public PointVector getProjection(PointVector v)
Project a vector v onto this vector

Parameters:
v - the vector to project
Returns:
the projection of v onto this vector

getAsLength

public PointVector getAsLength(double length)
Scale our vector such that it has the specified length

Parameters:
length - - the target length
Returns:
a vector in the same direction but with the specified length

rotate

public PointVector rotate(double angle)

rotate

public PointVector rotate(double angle,
                          int dimensionA,
                          int dimensionB)

addToPoint

public <T extends Point> T addToPoint(T origin)
Type Parameters:
T - the position type
Parameters:
origin - point to translate
Returns:
a new position equal to the specified shifted by the vector

equals

public boolean equals(Object obj)
Object Interface

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 OneBusAway. All Rights Reserved.