Package nl.colorize.multimedialib.math
Class Vector
- java.lang.Object
-
- nl.colorize.multimedialib.math.Vector
-
public class Vector extends java.lang.ObjectA two-dimensional vector with a direction and a magnitude, both defined with float precision. The direction of the vector is defined by an angle in degrees. An angle of 0 degrees represents the vector (1, 0). Angles greater than 0 rotate in a clockwise direction, so an angle of 180 degress would represent the vector (-1, 0).
-
-
Field Summary
Fields Modifier and Type Field Description static floatEPSILON
-
Constructor Summary
Constructors Constructor Description Vector(float direction, float magnitude)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vectorcopy()booleanequals(java.lang.Object o)floatgetDirection()floatgetMagnitude()floatgetX()floatgetY()inthashCode()voidsetDirection(float direction)voidsetMagnitude(float magnitude)PointtoPoint()java.lang.StringtoString()
-
-
-
Field Detail
-
EPSILON
public static final float EPSILON
- See Also:
- Constant Field Values
-
-
Method Detail
-
setDirection
public void setDirection(float direction)
-
getDirection
public float getDirection()
-
setMagnitude
public void setMagnitude(float magnitude)
-
getMagnitude
public float getMagnitude()
-
getX
public float getX()
-
getY
public float getY()
-
toPoint
public Point toPoint()
-
copy
public Vector copy()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-