|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecty25.graphics.Point3D
Represents a point in three dimensional space.
A point's x,y and z coordinates can be retrieved and set by accessing it's
x,y and z members directly, e.g. point.x = 3*point.z
.
Most operations on a Point3D
can be chained, since a reference
to the point is returned by most methods, e.g.
point.set(2,3,4).translate(-1,2,3)
.
Field Summary | |
float |
x
The x-coordinate of the point. |
float |
y
The y-coordinate of the point. |
float |
z
The z-coordinate of the point. |
Constructor Summary | |
Point3D()
Creates a point at (0,0,0) . |
|
Point3D(float xx,
float yy,
float zz)
Creates a point at the given coordinates. |
|
Point3D(Point3D p)
Creates a point at the same position as the passed point. |
|
Point3D(Vector3D v)
Creates a point by interpreting the passed vector as a position vector. |
Method Summary | |
Point3D |
getTranslated(Vector3D v)
Creates a copy of this point, translates it by the given vector and returns the copy. |
Vector3D |
getVector3D()
Returns a Vector3D with the same x,y,z entries as this
point. |
boolean |
isZero()
Returns true if this point lies at the origin,
false otherwise. |
static Point3D |
lerp(Point3D a,
Point3D b,
float amount)
Performs a linear interpolation between two points. |
Point3D |
set(float xx,
float yy,
float zz)
Sets this point to the given coordinates and returns a reference to this point. |
Point3D |
set(Point3D p)
Sets this point to the same coordinates as the passed one and returns a reference to this point. |
Point3D |
set(Vector3D v)
Sets this point to the same coordinates as the passed vector and returns a reference to this point. |
String |
toString()
|
Point3D |
translate(Vector3D v)
Translates this point by the given vector. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public float x
public float y
public float z
Constructor Detail |
public Point3D()
(0,0,0)
.
public Point3D(float xx, float yy, float zz)
public Point3D(Point3D p)
public Point3D(Vector3D v)
Method Detail |
public Point3D set(float xx, float yy, float zz)
public Point3D set(Point3D p)
public Point3D set(Vector3D v)
public boolean isZero()
true
if this point lies at the origin,
false
otherwise.
public Point3D translate(Vector3D v)
point = point + vector
.
public Point3D getTranslated(Vector3D v)
public String toString()
public static Point3D lerp(Point3D a, Point3D b, float amount)
If amount
is 0
, a new point at position
a
is returned, if amount
is 1
,
a point at position b
is returned. For values between
0
and 1
, a
and
b
are interpolated. For values in the range
(-inf,0)
and (1,inf)
, a
and
b
are extrapolated.
public Vector3D getVector3D()
Vector3D
with the same x,y,z entries as this
point.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |