|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.quinncurtis.chart3djava.Polygon3D
public class Polygon3D
A 3D polygon class.
Field Summary | |
---|---|
static int |
MAX_VALUE_SORT
Specifies polygon sort using max values of polygon vertices. |
static int |
MEAN_VALUE_SORT
Specifies polygon sort using mean values of polygon vertices. |
static int |
MIN_VALUE_SORT
Specifies polygon sort using minimum values of polygon vertices. |
Constructor Summary | |
---|---|
Polygon3D()
The default constructor. |
|
Polygon3D(ChartPoint3D[] newpoints)
Constructor initializes a polygon. |
|
Polygon3D(ChartPoint3D[] newpoints,
ChartAttribute outsideattrib)
Constructor initializes a polygon. |
|
Polygon3D(int size)
Constructor initializes a polygon with a fixed number of vertices, but with all point values set to (0,0,0). |
|
Polygon3D(PhysicalCoordinates transform)
Constructor initializes the coordinate system associated with the polygon. |
|
Polygon3D(PhysicalCoordinates transform,
ChartAttribute outsideattrib)
Constructor initializes a polygon. |
|
Polygon3D(PhysicalCoordinates transform,
ChartPoint3D[] newpoints,
ChartAttribute outsideattrib)
Constructor initializes a polygon. |
|
Polygon3D(PhysicalCoordinates transform,
ChartPoint3D[] newpoints,
int[] pointindices,
ChartAttribute outsideattrib)
Constructor initializes a polygon. |
|
Polygon3D(PhysicalCoordinates transform,
ChartPoint3D p1,
ChartPoint3D p2,
ChartAttribute outsideattrib)
Constructor initializes a polyline as a simple 2-point line. |
|
Polygon3D(PhysicalCoordinates transform,
double[] x,
double[] y,
double[] z,
ChartAttribute outsideattrib)
Constructor initializes a polygon. |
|
Polygon3D(PhysicalCoordinates transform,
DoubleArray x,
DoubleArray y,
DoubleArray z,
ChartAttribute outsideattrib)
Constructor initializes a polygon. |
|
Polygon3D(Polygon3D source)
Constructor initializes the polygon as acopy of a another Polygon3D object. |
Method Summary | |
---|---|
int |
addLine(ChartPoint3D p1,
ChartPoint3D p2)
Add a pair of points to the polygon. |
int |
addLine(double x1,
double y1,
double z1,
double x2,
double y2,
double z2)
Add a pair of points to the polygon. |
int |
addVertex(ChartPoint3D newpoint)
Add a new vertex to the polygon. |
int |
addVertex(double x,
double y,
double z)
Add a new vertex to the polygon. |
int |
addVertices(ChartPoint3D[] newpoints,
ChartAttribute outsideattrib)
Add an array of new vertices to the polygon. |
void |
clampPolygonToCoordinateLimits()
Clamp the polygon vertex values to the coordinate systems limits. |
void |
clear()
Resets the polygon back to it's default (empty) state. |
java.lang.Object |
clone()
Returns an object that is a clone of this object. |
void |
closePolygon()
Checks to see if the last point matches the first point in the polygon, and adds a point if it isn't. |
int |
compareTo(java.lang.Object obj)
CompareTo method require by IComparable interface. |
static Polygon3D |
convertForStepMode(Polygon3D polygon,
int stepmode)
Convert a polygon to a "stepped" version of the same polygon. |
void |
copy(Polygon3D source)
Copies the source object. |
int |
count()
Get the number of vertices. |
void |
draw(java.awt.Graphics2D g2)
The draw function for the class. |
static void |
draw(java.awt.Graphics2D g2,
Polygon3D polygon)
A static routine that draws a Polygon3D object. |
PhysicalCoordinates |
getCoordinateSystem()
Get the objects coordinate system. |
int |
getCoordinateType()
Get the coordinate system type of the polygon (SCREEN_POS, DEV_POS, PHYS_POS). |
ChartPoint3D[] |
getCopyOfVertices()
Returns a copy of the vertices of the polygon as an array of ChartPoint3D objects. |
int |
getDataPointIndex()
Get data point index of the polygon. |
ChartPoint3D |
getElement(int index)
This accessor is the indexer for the class and get/sets the value of an individual vertex in the polygon. |
boolean |
getEnableCullRearFacing()
Returns true if culling of rear facing polygons is enabled. |
boolean |
getEnablePolygon()
Returns true to enable the polygon. |
int |
getGroupIndex()
Get the group index of the polygon. |
ChartAttribute |
getInsideAttribute()
Get inside color attribute of the object. |
double |
getMaxValue(int axis)
Returns the maximum value of the polygon vertices for a given axis. |
double |
getMeanValue(int axis)
Returns the mean value of the polygon vertices for a given axis. |
double |
getMinValue(int axis)
Returns the minimum value of the polygon vertices for a given axis. |
ChartAttribute |
getOutsideAttribute()
Get outside color attribute of the object. |
Point3DArray |
getPointArray()
Get the pointArray object holding the point list that define the polygon. |
Polygon3D |
getTransformPolygon()
Transforms the polygon to screen coordinates and return the result as a new Polygon3D object. |
ChartPoint3D[] |
getVertices()
Returns the vertices of the polygon as an array of ChartPoint3D objects. |
int |
insertAt(int index,
ChartPoint3D newpoint)
Inserts an object at the specified index. |
boolean |
isClosedPolygon()
Returns true if the polyon is a closed, rather than just a polyline. |
void |
markPolygonIndices(int datapoint,
int group)
Save the polygon data point and group indices. |
static void |
polygonTransform3D(Polygon3D polygon,
Transform3D transform)
Static routine transform the polygon using the specified Transform3D object. |
int |
removeAt(int index)
Remove an object at the specified index. |
void |
reset()
Resets the polygon back to it's default (empty) state. |
void |
reversePolygon()
Reverses the drawing order of the polygon |
void |
scalePolygon(ChartPoint3D scalef,
ChartPoint3D offset)
Apply an mx + b scaling to each point. |
void |
setCoordinateSystem(PhysicalCoordinates value)
Set the objects coordinate system. |
void |
setCoordinateType(int value)
Set the coordinate system type of the polygon (SCREEN_POS, DEV_POS, PHYS_POS). |
void |
setCopyVertices(ChartPoint3D[] newpoints)
Sets the vertices of the polygon, making a copy of each point. |
void |
setDataPointIndex(int value)
Set data point index of the polygon. |
void |
setElement(int index,
ChartPoint3D value)
This accessor is the indexer for the class and get/sets the value of an individual vertex in the polygon. |
void |
setEnableCullRearFacing(boolean value)
Set to true to enable the culling of rear facing polygons. |
void |
setEnablePolygon(boolean value)
Set to true to enable the polygon. |
void |
setGroupIndex(int value)
Set the group index of the polygon. |
void |
setInsideAttribute(ChartAttribute value)
Set inside color attribute of the object. |
void |
setOutsideAttribute(ChartAttribute value)
Set outside color attribute of the object. |
void |
setVertices(ChartPoint3D[] newpoints)
Sets the vertices of the polygon. |
void |
setVertices(ChartPoint3D[] newpoints,
ChartAttribute outsideattrib)
Sets the vertices and attribute of the polygon. |
void |
setVertices(DoubleArray x,
DoubleArray y,
DoubleArray z,
ChartAttribute outsideattrib)
Sets the vertices and attribute of the polygon. |
boolean |
testPoint(double x,
double y)
Test to see if a screen coordinates point is in the region of the transformed polygon. |
void |
transformPolygon()
Transform the polygon to Screen coordinates. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MEAN_VALUE_SORT
public static final int MAX_VALUE_SORT
public static final int MIN_VALUE_SORT
Constructor Detail |
---|
public Polygon3D(PhysicalCoordinates transform)
transform
- The coordinate system associated with the polygon.public Polygon3D()
public Polygon3D(Polygon3D source)
source
- The source polygon.public Polygon3D(PhysicalCoordinates transform, ChartPoint3D[] newpoints, int[] pointindices, ChartAttribute outsideattrib)
transform
- The coordinate system associated with the polygon.newpoints
- An array of Point3D objects used to initialize the polygon.pointindices
- An array of indices into the newpoints array, forming the polygon.outsideattrib
- The outside color attribute of the polygon.public Polygon3D(PhysicalCoordinates transform, ChartPoint3D[] newpoints, ChartAttribute outsideattrib)
transform
- The coordinate system associated with the polygon.newpoints
- An array of ChartPoint3D objects used to initialize the polygon.outsideattrib
- The outside color attribute of the polygon.public Polygon3D(ChartPoint3D[] newpoints, ChartAttribute outsideattrib)
newpoints
- An array of ChartPoint3D objects used to initialize the polygon.outsideattrib
- The outside color attribute of the polygon.public Polygon3D(ChartPoint3D[] newpoints)
newpoints
- An array of ChartPoint3D objects used to initialize the polygon.public Polygon3D(int size)
size
- The number of vertices in the polygon.public Polygon3D(PhysicalCoordinates transform, DoubleArray x, DoubleArray y, DoubleArray z, ChartAttribute outsideattrib)
transform
- The coordinate system associated with the polygon.x
- An array of x-values used to initialize the polygon.y
- An array of y-values used to initialize the polygon.z
- An array of z-values used to initialize the polygon.outsideattrib
- The outside color attribute of the polygon.public Polygon3D(PhysicalCoordinates transform, double[] x, double[] y, double[] z, ChartAttribute outsideattrib)
transform
- The coordinate system associated with the polygon.x
- An array of x-values used to initialize the polygon.y
- An array of y-values used to initialize the polygon.z
- An array of z-values used to initialize the polygon.outsideattrib
- The outside color attribute of the polygon.public Polygon3D(PhysicalCoordinates transform, ChartAttribute outsideattrib)
transform
- The coordinate system associated with the polygon.outsideattrib
- The outside color attribute of the polygon.public Polygon3D(PhysicalCoordinates transform, ChartPoint3D p1, ChartPoint3D p2, ChartAttribute outsideattrib)
transform
- The coordinate system associated with the polygon.p1
- The first point of the line.p2
- The second point of the line.outsideattrib
- The outside color attribute of the polygon.Method Detail |
---|
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
obj
- sort object.
public void transformPolygon()
public static void polygonTransform3D(Polygon3D polygon, Transform3D transform)
transform
- The Transform3D associated with the polygon.polygon
- The polygon to transform.public Polygon3D getTransformPolygon()
public void setVertices(ChartPoint3D[] newpoints, ChartAttribute outsideattrib)
newpoints
- An array of points.outsideattrib
- The color attribute for the outside of the polygon.public void setVertices(DoubleArray x, DoubleArray y, DoubleArray z, ChartAttribute outsideattrib)
x
- An array of the x-values of the polygon.y
- An array of the y-values of the polygon.z
- An array of the z-values of the polygon.outsideattrib
- The color attribute for the outside of the polygon.public void setVertices(ChartPoint3D[] newpoints)
newpoints
- An array of points.public void setCopyVertices(ChartPoint3D[] newpoints)
newpoints
- An array of points.public void clear()
public void reset()
public void closePolygon()
public void copy(Polygon3D source)
source
- The source object.public java.lang.Object clone()
clone
in class java.lang.Object
public int addVertex(ChartPoint3D newpoint)
newpoint
- The point to add.
public int addVertex(double x, double y, double z)
x
- The x-value of the point to add.y
- The y-value of the point to add.z
- The z-value of the point to add.
public int addVertices(ChartPoint3D[] newpoints, ChartAttribute outsideattrib)
newpoints
- Ann array of ChartPoint3D objects to add to the polygon.outsideattrib
- The color attribute of the outside of the polygon.
public int addLine(ChartPoint3D p1, ChartPoint3D p2)
p1
- The first of the two points to add.p2
- The second of the two points to add.
public int addLine(double x1, double y1, double z1, double x2, double y2, double z2)
x1
- The x-value of the first point to add.y1
- The y-value of the first point to add.z1
- The z-value of the first point to add.x2
- The x-value of the second point to add.y2
- The y-value of the second point to add.z2
- The z-value of the second point to add.
public int insertAt(int index, ChartPoint3D newpoint)
index
- Insert new point at the index element.newpoint
- The new point to insert at index.
public int removeAt(int index)
index
- Delete point at the index element.
public ChartPoint3D[] getVertices()
public ChartPoint3D[] getCopyOfVertices()
public void markPolygonIndices(int datapoint, int group)
datapoint
- The data point index of the polygon.group
- The group index of the polygon.public void reversePolygon()
public void scalePolygon(ChartPoint3D scalef, ChartPoint3D offset)
scalef
- The scale factor to apply to each point.offset
- The offset to apply to each point.public boolean testPoint(double x, double y)
x
- The x-value of the test point.y
- The y-value of the test point.
public double getMeanValue(int axis)
axis
- The axis id (X_AXIS, Y_AXIS, Z_AXIS).
public void clampPolygonToCoordinateLimits()
public static Polygon3D convertForStepMode(Polygon3D polygon, int stepmode)
polygon
- The source Polygon3D object.stepmode
- The desired step mode (NO_STEP, STEP_END, STEP_START).
public double getMinValue(int axis)
axis
- The axis id (X_AXIS, Y_AXIS, Z_AXIS).
public double getMaxValue(int axis)
axis
- The axis id (X_AXIS, Y_AXIS, Z_AXIS).
public boolean isClosedPolygon()
public void draw(java.awt.Graphics2D g2)
g2
- A graphics contextpublic static void draw(java.awt.Graphics2D g2, Polygon3D polygon)
g2
- A graphics contextpolygon
- The source polygon.public PhysicalCoordinates getCoordinateSystem()
public void setCoordinateSystem(PhysicalCoordinates value)
value
- Set the objects coordinate system.public ChartAttribute getInsideAttribute()
public void setInsideAttribute(ChartAttribute value)
value
- Set the objects inside attribute.public ChartAttribute getOutsideAttribute()
public void setOutsideAttribute(ChartAttribute value)
value
- Set the objects outside attribute.public int getGroupIndex()
public void setGroupIndex(int value)
value
- Set the group index of the polygon.public int getDataPointIndex()
public void setDataPointIndex(int value)
value
- Set the data point index of the polygon.public boolean getEnableCullRearFacing()
public void setEnableCullRearFacing(boolean value)
value
- Set to true to enable the culling of rear facing polygons.public boolean getEnablePolygon()
public void setEnablePolygon(boolean value)
value
- Set to true to enable the polygon.public int getCoordinateType()
public void setCoordinateType(int value)
value
- Set the coordinate system type of the polygon.public int count()
public Point3DArray getPointArray()
public ChartPoint3D getElement(int index)
index
- Get the point at the index element.
public void setElement(int index, ChartPoint3D value)
index
- Set the point at the index element.value
- Set the point at the index element using this value.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |