|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsimulator.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 PolarVectpublic double getMagnitude()
getMagnitude in interface PolarVectpublic double getX()
CartesianVect
getX in interface CartesianVectpublic 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 top
public 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 | |||||||||