public final class GeomPoint
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
The GeomPoint class uses an object pool. This means that when you request a new object using "getInstance()", that method will attempt to recycle GeomPoint objects from a pool of unused objects if there are any available. This reduces the overhead compared with creating new objects on the stack using "new". If the pool is empty, a new object is created and returned to you. It is your responsibility to return GeomPoint objects to the pool using "freeInstance()" when you are finished with them. If you forget to return an object to the pool, it will simply be garbage collected like any other object, but you loose the advantages provided by the object pool.
Modified by: Joseph A. Huwaldt
Modifier | Constructor and Description |
---|---|
protected |
GeomPoint() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Make a copy of this GeomPoint object.
|
boolean |
equals(java.lang.Object obj)
Compares the specified object with this point for equality.
|
static void |
freeInstance(GeomPoint point)
Add an instance of a GeomPoint object to the object pool so that it can be re-used
again.
|
static GeomPoint |
getInstance()
Create an instance of a GeomPoint object where everything is set to zero.
|
static GeomPoint |
getInstance(double x,
double y,
double z)
Create an instance of a GeomPoint object by providing the coordinate values.
|
double |
getX()
Return the X-coordinate of the point.
|
double |
getY()
Return the Y-coordinate of the point.
|
double |
getZ()
Return the Z-coordinate of the point.
|
int |
hashCode()
Returns the hash code value for this point.
|
void |
scale(double sx,
double sy,
double sz)
Scale this point by a specified factor along each axis.
|
void |
setX(double value)
Set the X-coordinate of the point.
|
void |
setY(double value)
Set the Y-coordinate of the point.
|
void |
setZ(double value)
Set the Z-coordinate of the point.
|
java.lang.String |
toString()
Creates a string representation of this point by simply outputting the X,Y,Z
coordinates of the point.
|
void |
translate(double dx,
double dy,
double dz)
Translate this point by an incremental amount along each axis.
|
public static GeomPoint getInstance()
freeInstance(jahuwaldt.aero.panelgeom.GeomPoint)
public static GeomPoint getInstance(double x, double y, double z)
x
- X-coordinate value.y
- Y-coordinate value.z
- Z-coordinate value.freeInstance(jahuwaldt.aero.panelgeom.GeomPoint)
public static void freeInstance(GeomPoint point)
point
- The GeomPoint object to be recycled.public double getX()
public double getY()
public double getZ()
public void setX(double value)
value
- X-coordinate of the point.public void setY(double value)
value
- Y-coordinate of the point.public void setZ(double value)
value
- Z-coordinate of the point.public void translate(double dx, double dy, double dz)
dx
- The amount to translate the point in the X direction.dy
- The amount to translate the point in the Y direction.dz
- The amount to translate the point in the Z direction.public void scale(double sx, double sy, double sz)
sx
- The amount to scale the point in the X direction.sy
- The amount to scale the point in the Y direction.sz
- The amount to scale the point in the Z direction.public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
true
if and only if the specified object is also a point and both
points have the same coordinate values.equals
in class java.lang.Object
obj
- The object to be compared for equality with this point.true
if the specified object is equal to this point.public int hashCode()
hashCode
in class java.lang.Object