|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object simulator.model.SMVector
public class SMVector
Vector manipulation class that implements both PolarVect and CartesianVect interfaces.
Method Summary | |
---|---|
double |
getAngle()
|
double |
getMagnitude()
|
double |
getX()
Get the x coordinate. |
double |
getY()
Get the y coordinate. |
static SMVector |
makeCartesian(double x,
double y)
Construct a vector from cartesian coordinates |
static SMVector |
makePolar(double mag,
double ang)
Construct a vector from polar coordinates |
void |
setCartesian(double x,
double y)
Set the value of this in Cartesian form |
void |
setPolar(double mag,
double ang)
Set the value of this in Polar form |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static SMVector makePolar(double mag, double ang)
mag
- magnitude 0 <= magang
- angle in degrees from the positive x axis. 0 <= ang < 360.
public static SMVector makeCartesian(double x, double y)
x
- horizontal component 0 is to the left.y
- vertical component 0 is to the bottom
public double getAngle()
getAngle
in interface PolarVect
public double getMagnitude()
getMagnitude
in interface PolarVect
public double getX()
CartesianVect
getX
in interface CartesianVect
public double getY()
CartesianVect
getY
in interface CartesianVect
public void setCartesian(double x, double y)
x
- horizontal coord. 0 is to the lefty
- vertical coord. 0 is to the toppublic void setPolar(double mag, double ang)
mag
- magnitude. 0 <= magang
- angle in degrees from positive x axis. 0 <= ang < 360
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |