|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectphysics.Vect
public final class Vect
Vect is an immutable abstract data type which models the mathematical notion of a vector or a point in 2-space.
| Field Summary | |
|---|---|
static Vect |
X_HAT
A unit vector in the positive x direction |
static Vect |
Y_HAT
A unit vector in the positive y direction |
static Vect |
ZERO
A Vect with zero length |
| Constructor Summary | |
|---|---|
Vect(Angle angle)
|
|
Vect(Angle angle,
double length)
|
|
Vect(double x,
double y)
|
|
Vect(java.awt.geom.Point2D p)
|
|
| Method Summary | |
|---|---|
Angle |
angle()
|
double |
distanceSquared(Vect b)
|
double |
dot(Vect b)
|
boolean |
equals(java.lang.Object o)
|
boolean |
equals(Vect v)
|
int |
hashCode()
|
double |
length()
|
Vect |
minus(Vect b)
|
Vect |
neg()
|
Vect |
plus(Vect b)
|
Vect |
projectOn(Vect b)
Returns the projection of this onto b![]() |
Vect |
rotateBy(Angle a)
|
Vect |
times(double amt)
|
java.awt.geom.Point2D.Double |
toPoint2D()
|
java.lang.String |
toString()
|
Vect |
unitSize()
|
double |
x()
|
double |
y()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Vect ZERO
public static final Vect X_HAT
public static final Vect Y_HAT
| Constructor Detail |
|---|
public Vect(Angle angle)
public Vect(Angle angle,
double length)
public Vect(double x,
double y)
public Vect(java.awt.geom.Point2D p)
| Method Detail |
|---|
public Angle angle()
this in polar coordinatespublic double length()
thispublic double x()
this
in Cartesian coordinatespublic double y()
this
in Cartesian coordinatespublic double distanceSquared(Vect b)
this and bpublic Vect plus(Vect b)
this and bpublic Vect minus(Vect b)
this and
bpublic Vect rotateBy(Angle a)
this
having been rotated around the origin by a.public Vect neg()
this
being rotated by pi radians.public Vect times(double amt)
this scaled
by amt.public Vect projectOn(Vect b)
b
this onto
b. The resulting vector has the same angle as
b, but its length is such that this -
c is perpendicular to c.public Vect unitSize()
thispublic double dot(Vect b)
this and
b.public java.awt.geom.Point2D.Double toPoint2D()
Point2D object which is
located at the same point as this.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(Vect v)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||