|
RoboJDETM v2.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ridgesoft.robotics.Vector2D
public class Vector2D
Implements a two dimensional (magnitude and direction) vector for physics calculations and provides a method for summing vectors.
Constructor Summary | |
---|---|
Vector2D(float magnitude,
float directionDegrees)
Constructs a Vector2D object. |
|
Vector2D(Vector2D[] vectors)
Constructs a Vector2D object that is the sum of a set of vectors. |
Method Summary | |
---|---|
Vector2D |
add(Vector2D vector)
Adds a vector to this vector and returns a new Vector2D object containing the result. |
float |
getDirection()
Gets the direction of the vector. |
float |
getMagnitude()
Gets the magnitude of the vector. |
void |
setDirection(float directionDegrees)
Sets the direction component of the vector. |
void |
setMagnitude(float magnitude)
Sets the magnitude of the vector. |
String |
toString()
Returns a String object containing the magnitude and direction (in degrees) of the vector in the format: magnitude, direction |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait |
Constructor Detail |
---|
public Vector2D(float magnitude, float directionDegrees)
magnitude
- magnitude of the vectordirectionDegrees
- direction of the vector in degreespublic Vector2D(Vector2D[] vectors)
vectors
- the vectors to sum when constructing the new vectorMethod Detail |
---|
public Vector2D add(Vector2D vector)
vector
- vector to add to this vector
public float getDirection()
public float getMagnitude()
public void setDirection(float directionDegrees)
directionDegrees
- direction in degreespublic void setMagnitude(float magnitude)
magnitude
- vector magnitude in user defined unitspublic String toString()
toString
in class Object
|
RoboJDETM v2.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |