|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object physics3d.Vect3
public class Vect3
Vect3 represents a vector in 3 space
x
: double // x coordinate
y
: double // y coordinate
z
: double // z coordinate
rho
: double // length of vector
theta
: Angle // azimuthal angle
phi
: Angle // angle from projection on xy plane to line x=0
Field Summary | |
---|---|
static Vect3 |
X_HAT
A unit vector in the positive x direction |
static Vect3 |
Y_HAT
A unit vector in the positive y direction |
static Vect3 |
Z_HAT
A unit vector in the positive z direction |
static Vect3 |
ZERO
A Vect3 with zero length |
Constructor Summary | |
---|---|
Vect3(Angle theta,
Angle phi)
|
|
Vect3(double rho,
Angle theta,
Angle phi)
|
|
Vect3(double x,
double y,
double z)
|
Method Summary | |
---|---|
Angle |
angleBetween(Vect3 b)
|
Vect3 |
cross(Vect3 b)
|
double |
distanceSquared(Vect3 b)
|
double |
dot(Vect3 b)
|
boolean |
equals(Object o)
|
boolean |
equals(Vect3 v)
|
int |
hashCode()
|
static boolean |
isAbout(double d1,
double d2)
|
boolean |
isAbout(Vect3 v1)
|
Vect3 |
minus(Vect3 b)
|
Vect3 |
neg()
|
Angle |
phi()
|
Vect3 |
plus(Vect3 b)
|
Vect3 |
projectOnToB(Vect3 b)
Returns the projection of this onto b |
double |
rho()
|
Vect3 |
rotateAroundVect(Vect3 axis,
Angle ccwRotAngle)
|
static double |
roundToNearest100(double d)
|
Angle |
theta()
|
Vect3 |
times(double amt)
|
String |
toString()
|
Vect3 |
unitSize()
|
double |
x()
|
double |
y()
|
double |
z()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Vect3 ZERO
public static final Vect3 X_HAT
public static final Vect3 Y_HAT
public static final Vect3 Z_HAT
Constructor Detail |
---|
public Vect3(Angle theta, Angle phi)
theta, phi
are not nulltheta, phi
.public Vect3(double rho, Angle theta, Angle phi)
theta, phi
are not nulltheta, phi
with length rho
, where
(rho, theta, phi)
is the standard spherical
representation of a point in 3 space.public Vect3(double x, double y, double z)
Method Detail |
---|
public double rho()
this
public Angle theta()
this
to the z axispublic Angle phi()
this
to the x axis, measured from the
XY plane.public double x()
this
in Cartesian coordinatespublic double y()
this
in Cartesian coordinatespublic double z()
this
in Cartesian coordinatespublic double distanceSquared(Vect3 b)
this
and b
b
is not nullpublic Angle angleBetween(Vect3 b)
this
and b
public Vect3 plus(Vect3 b)
this
and b
b
is not nullpublic Vect3 minus(Vect3 b)
this
and b
b
is not nullpublic Vect3 neg()
this
being rotated by
pi radians.public Vect3 times(double amt)
this
scaled by
amt
.public Vect3 projectOnToB(Vect3 b)
b
this
onto
b
. The resulting vector c
has the
same angle as b
, but its length is such that
this
- c
is perpendicular to
c
.b
is not nullpublic Vect3 cross(Vect3 b)
b
is not nullpublic Vect3 unitSize()
this
this.rho()
>= 0public Vect3 rotateAroundVect(Vect3 axis, Angle ccwRotAngle)
this
rotated counter clockwise by
an angle ccwRotAngle
about the axis of rotation
axis
.axis
is not null && axis.rho()
> 0 &&
ccwRotAngle
is not nullpublic double dot(Vect3 b)
this
and b
.b
is not nullpublic String toString()
toString
in class Object
public boolean equals(Vect3 v)
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public boolean isAbout(Vect3 v1)
d1
- d2
-
|d1-d2|
<
GameConstants.Tolerance
false otherwisev1
is not nullpublic static boolean isAbout(double d1, double d2)
d1
- d2
-
GameConstants.Tolerance
false
otherwisepublic static double roundToNearest100(double d)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |