org.simtk.geometry3d
Class Vector2DClass
java.lang.Object
org.simtk.geometry3d.MathVectorClass
org.simtk.geometry3d.Vector2DClass
- All Implemented Interfaces:
- java.lang.Iterable, Location, MathVector, MutableMathVector, MutableVector2D, Vector2D
public class Vector2DClass
- extends MathVectorClass
- implements MutableVector2D
- Author:
- Christopher Bruns
A point or direction vector in three dimensions.
Methods inherited from class org.simtk.geometry3d.MathVectorClass |
distance, distanceSquared, dot, get, getDimension, getElement, iterator, length, lengthSquared, minusEquals, plusEquals, selfUnit, set, timesEquals |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.lang.Iterable |
iterator |
Methods inherited from interface java.lang.Iterable |
iterator |
Vector2DClass
public Vector2DClass()
Vector2DClass
public Vector2DClass(double x,
double y)
Vector2DClass
public Vector2DClass(double[] vec)
Vector2DClass
public Vector2DClass(MathVector template)
copy
public void copy(MathVector v2)
- Description copied from class:
MathVectorClass
- copy contents of argument vector into this one
- Specified by:
copy
in interface MutableMathVector
- Overrides:
copy
in class MathVectorClass
initialize
protected void initialize(Vector2D v2)
setX
public void setX(double d)
- Specified by:
setX
in interface MutableVector2D
setY
public void setY(double d)
- Specified by:
setY
in interface MutableVector2D
getX
public double getX()
- Specified by:
getX
in interface Vector2D
getY
public double getY()
- Specified by:
getY
in interface Vector2D
x
public double x()
- Specified by:
x
in interface Vector2D
y
public double y()
- Specified by:
y
in interface Vector2D
unit
public Vector2D unit()
- Specified by:
unit
in interface MathVector
- Specified by:
unit
in interface Vector2D
- Overrides:
unit
in class MathVectorClass
minus
public Vector2D minus(MathVector v2)
- Specified by:
minus
in interface MathVector
- Specified by:
minus
in interface Vector2D
- Overrides:
minus
in class MathVectorClass
plus
public Vector2D plus(MathVector v2)
- Specified by:
plus
in interface MathVector
- Specified by:
plus
in interface Vector2D
- Overrides:
plus
in class MathVectorClass
times
public Vector2D times(double s)
- Specified by:
times
in interface MathVector
- Specified by:
times
in interface Vector2D
- Overrides:
times
in class MathVectorClass
centroid
public static Vector2D centroid(java.util.Collection<Vector2D> bagOfPoints)
throws InsufficientPointsException
- Compute the centroid or mean point
- Throws:
InsufficientPointsException
centroid
public static Vector2D centroid(Vector2D[] coordinates,
double[] weights)
throws InsufficientPointsException
- Throws:
InsufficientPointsException
cross
public Vector3D cross(Vector2D v2)
- Specified by:
cross
in interface Vector2D
toString
public java.lang.String toString()
- Overrides:
toString
in class MathVectorClass
equals
public boolean equals(java.lang.Object v)
- Overrides:
equals
in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
rotate
public Vector2D rotate(double angle)
- Specified by:
rotate
in interface Vector2D
toArray
public double[] toArray()
- Specified by:
toArray
in interface Vector2D