public class GeomPanel
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
Defines a geometry element called a panel. A panel consists of 4 corner points in 3D space and a normal vector.
Panel corner points are defined as follows: Imagine a rectangle on a piece of paper. The normal vector points out of the page. The 4 corner points are ordered, starting in the lower left corner and going around the panel in a counter clockwise direction.
The GeomPanel class uses an object pool. This means that when you request a new object using "getInstance()", that method will attempt to recycle GeomPanel 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 GeomPanel 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 |
GeomPanel()
Force the user to create a new instance using "getInstance()".
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Make a copy of this GeomPanel object.
|
boolean |
equals(java.lang.Object obj)
Compares the specified object with this panel for equality.
|
static void |
freeInstance(GeomPanel panel)
Add an instance of a GeomPanel object to the object pool so that it can be re-used
again.
|
double[] |
getAllX()
Return the X-coordinates of each corner point in an array.
|
double[] |
getAllY()
Return the Y-coordinates of each corner point in an array.
|
double[] |
getAllZ()
Return the Z-coordinates of each corner point in an array.
|
double |
getArea()
Return the surface area of the panel.
|
GeomPoint |
getBoundsMax()
Return the coordinate point representing the maximum bounding box corner (max X,
max Y, max Z).
|
GeomPoint |
getBoundsMin()
Return the coordinate point representing the minimum bounding box corner (min X,
min Y, min Z).
|
GeomPoint |
getCentroid()
Return the centroid location for this panel.
|
double |
getCentroidX()
Get the panel centroid X coordinate.
|
double |
getCentroidY()
Get the panel centroid Y coordinate.
|
double |
getCentroidZ()
Get the panel centroid Z coordinate.
|
static GeomPanel |
getInstance()
Create an instance of a GeomPanel object where everything is set to zero.
|
static GeomPanel |
getInstance(double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
double x3,
double y3,
double z3,
double x4,
double y4,
double z4)
Create an instance of a GeomPanel object by providing the corner point locations.
|
static GeomPanel |
getInstance(double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
double x3,
double y3,
double z3,
double x4,
double y4,
double z4,
double nx,
double ny,
double nz,
double xc,
double yc,
double zc,
double area)
Create an instance of a GeomPanel object by providing the corner point locations,
unit normal vector, panel centroid location and panel surface area.
|
static GeomPanel |
getInstance(GeomPoint p1,
GeomPoint p2,
GeomPoint p3,
GeomPoint p4)
Create an instance of a GeomPanel object that has the given points for corner
points.
|
static GeomPanel |
getInstance(GeomPoint p1,
GeomPoint p2,
GeomPoint p3,
GeomPoint p4,
GeomPoint normal,
GeomPoint centroid,
double area)
Create an instance of a GeomPanel object that has the given points for corner
points, the given point for a unit normal vector and the given surface area.
|
double |
getMaxX()
Return the maximum bounding X coordinate for this panel.
|
double |
getMaxY()
Return the maximum bounding Y coordinate for this panel.
|
double |
getMaxZ()
Return the maximum bounding Z coordinate for this panel.
|
double |
getMinX()
Return the minimum bounding X coordinate for this panel.
|
double |
getMinY()
Return the minimum bounding Y coordinate for this panel.
|
double |
getMinZ()
Return the minimum bounding Z coordinate for this panel.
|
GeomPoint |
getNormal()
Return the unit normal vector for this panel.
|
double |
getNormalX()
Get the X-component of the panel unit normal vector.
|
double |
getNormalY()
Get the Y-component of the panel unit normal vector.
|
double |
getNormalZ()
Get the Z-component of the panel unit normal vector.
|
GeomPoint |
getPoint1()
Return the corner point #1.
|
GeomPoint |
getPoint2()
Return the corner point #2.
|
GeomPoint |
getPoint3()
Return the corner point #3.
|
GeomPoint |
getPoint4()
Return the corner point #4.
|
double |
getX1()
Return the X-coordinates of corner point #1.
|
double |
getX2()
Return the X-coordinates of corner point #2.
|
double |
getX3()
Return the X-coordinates of corner point #3.
|
double |
getX4()
Return the X-coordinates of corner point #4.
|
double |
getY1()
Return the Y-coordinates of corner point #1.
|
double |
getY2()
Return the Y-coordinates of corner point #2.
|
double |
getY3()
Return the Y-coordinates of corner point #3.
|
double |
getY4()
Return the Y-coordinates of corner point #4.
|
double |
getZ1()
Return the Z-coordinates of corner point #1.
|
double |
getZ2()
Return the Z-coordinates of corner point #2.
|
double |
getZ3()
Return the Z-coordinates of corner point #3.
|
double |
getZ4()
Return the Z-coordinates of corner point #4.
|
int |
hashCode()
Returns the hash code value for this panel.
|
void |
scale(double sx,
double sy,
double sz)
Scale this panel by the given factor along each axis.
|
java.lang.String |
toString()
Create a string representation of this panel by outputting the panel centroid
location.
|
void |
translate(double dx,
double dy,
double dz)
Translate this panel by an incremental amount along each axis.
|
protected GeomPanel()
public static GeomPanel getInstance()
freeInstance(jahuwaldt.aero.panelgeom.GeomPanel)
public static GeomPanel getInstance(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
x1
- Corner point #1, X coordinate.y1
- Corner point #1, Y coordinate.z1
- Corner point #1, Z coordinate.x2
- Corner point #2, X coordinate.y2
- Corner point #2, Y coordinate.z2
- Corner point #2, Z coordinate.x3
- Corner point #3, X coordinate.y3
- Corner point #3, Y coordinate.z3
- Corner point #3, Z coordinate.x4
- Corner point #3, X coordinate.y4
- Corner point #3, Y coordinate.z4
- Corner point #3, Z coordinate.freeInstance(jahuwaldt.aero.panelgeom.GeomPanel)
public static GeomPanel getInstance(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double nx, double ny, double nz, double xc, double yc, double zc, double area)
x1
- Corner point #1, X coordinate.y1
- Corner point #1, Y coordinate.z1
- Corner point #1, Z coordinate.x2
- Corner point #2, X coordinate.y2
- Corner point #2, Y coordinate.z2
- Corner point #2, Z coordinate.x3
- Corner point #3, X coordinate.y3
- Corner point #3, Y coordinate.z3
- Corner point #3, Z coordinate.x4
- Corner point #3, X coordinate.y4
- Corner point #3, Y coordinate.z4
- Corner point #3, Z coordinate.nx
- The pre-calculated unit normal vector X component.ny
- The pre-calculated unit normal vector Y component.nz
- The pre-calculated unit normal vector Z component.xc
- The pre-calculated panel centroid X coordinate.yc
- The pre-calculated panel centroid Y coordinate.zc
- The pre-calculated panel centroid Z coordinate.area
- The pre-calculated panel surface area.freeInstance(jahuwaldt.aero.panelgeom.GeomPanel)
public static GeomPanel getInstance(GeomPoint p1, GeomPoint p2, GeomPoint p3, GeomPoint p4)
p1
- The location of corner point #1.p2
- The location of corner point #2.p3
- The location of corner point #3.p4
- The location of corner point #4.freeInstance(jahuwaldt.aero.panelgeom.GeomPanel)
public static GeomPanel getInstance(GeomPoint p1, GeomPoint p2, GeomPoint p3, GeomPoint p4, GeomPoint normal, GeomPoint centroid, double area)
p1
- The location of corner point #1.p2
- The location of corner point #2.p3
- The location of corner point #3.p4
- The location of corner point #4.normal
- The pre-calculated panel unit normal vector.centroid
- The pre-calculated panel centroid location.area
- The pre-calculated panel surface area.freeInstance(jahuwaldt.aero.panelgeom.GeomPanel)
public static void freeInstance(GeomPanel panel)
panel
- The GeomPanel object to be recycled.public double[] getAllX()
public double[] getAllY()
public double[] getAllZ()
public GeomPoint getPoint1()
public GeomPoint getPoint2()
public GeomPoint getPoint3()
public GeomPoint getPoint4()
public double getX1()
public double getY1()
public double getZ1()
public double getX2()
public double getY2()
public double getZ2()
public double getX3()
public double getY3()
public double getZ3()
public double getX4()
public double getY4()
public double getZ4()
public double getNormalX()
public double getNormalY()
public double getNormalZ()
public GeomPoint getNormal()
public double getCentroidX()
public double getCentroidY()
public double getCentroidZ()
public GeomPoint getCentroid()
public double getArea()
public double getMinX()
public double getMaxX()
public double getMinY()
public double getMaxY()
public double getMinZ()
public double getMaxZ()
public GeomPoint getBoundsMin()
public GeomPoint getBoundsMax()
public void translate(double dx, double dy, double dz)
dx
- The amount to translate the panel in the X direction.dy
- The amount to translate the panel in the Y direction.dz
- The amount to translate the panel in the Z direction.public void scale(double sx, double sy, double sz)
sx
- The amount to scale the panel in the X direction.sy
- The amount to scale the panel in the Y direction.sz
- The amount to scale the panel 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)
equals
in class java.lang.Object
obj
- The object to be compared for equality with this panel.public int hashCode()
hashCode
in class java.lang.Object