|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jimmc.spelsim.DVector
public class DVector
Immutable 2D vector.
Constructor Summary | |
---|---|
DVector()
Create a vector with values (0,0). |
|
DVector(double x,
double y)
Create a vector by specifying rectangular coordinates. |
Method Summary | |
---|---|
double |
dot(DVector that)
Get the dot product of this vector and another vector. |
double |
getAngle()
Get the angle of the current point in polar coordinates. |
double |
getRadius()
Get the radius of the current point in polar coordinates. |
double |
getX()
Get the x coordinate of this point. |
double |
getY()
Get the y coordinate of this point. |
double |
length()
Get the length of this vector. |
double |
lengthSquared()
Get the length squared of this vector. |
DVector |
minus(DVector that)
Return a vector which is this vector minus another one. |
static DVector |
newPolar(double r,
double theta)
Create a vector by specifying polar coordinates. |
DVector |
normal()
Get a vector normal to this vector and of the same magnitude. |
DVector |
plus(DVector that)
Return a new vector which is the sum of this vector plus another one. |
DVector |
rotated(double theta)
Get a new vector which is a rotated version of this vector. |
DVector |
times(double k)
Return a new vector which is this vector times a constant. |
java.lang.String |
toString()
|
DVector |
unit()
Get a vector of unit length pointing in the same direction as this vector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DVector()
public DVector(double x, double y)
Method Detail |
---|
public static DVector newPolar(double r, double theta)
public DVector times(double k)
public DVector plus(DVector that)
public DVector minus(DVector that)
public DVector rotated(double theta)
public DVector normal()
public DVector unit()
public double lengthSquared()
public double length()
public double getX()
public double getY()
public double getRadius()
public double getAngle()
public double dot(DVector that)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |