All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cynosurex.graphics3D.Polygon3D

java.lang.Object
   |
   +----cynosurex.graphics3D.Polygon3D

public class Polygon3D
extends Object
implements CommonInterface
A polygon consists of a list of x, y, and z coordinates.


Variable Index

 o npoints
The number of points in this polygon
 o xpoints
The array of x coordinates.
 o XY_bounds
XY bounds of the polygon.
 o XZ_bounds
XZ bounds of the polygon.
 o ypoints
The array of y coordinates.
 o YZ_bounds
YZ bounds of the polygon.
 o zpoints
The array of z coordinates.

Constructor Index

 o Polygon3D()
Creates an empty polygon.
 o Polygon3D(int[], int[], int[], int)
Constructs and initializes a Polygon from the specified parameters.

Method Index

 o addPoint(int, int, int)
Appends a point to a polygon.
 o contains(int, int, int)
Determines whether the point (x, y, z) is inside the Polygon.
 o contains(Point3D)
Determines whether the 3D point is inside the Polygon.
 o getXYBounds()
Returns the XY bounding box of the shape.
 o getXZBounds()
Returns the XZ bounding box of the shape.
 o getYZBounds()
Returns the YZ bounding box of the shape.
 o translate(int, int, int)
Translates the vertices by deltaX, deltaY, and deltaZ.

Variables

 o npoints
 public int npoints
The number of points in this polygon

 o xpoints
 public int xpoints[]
The array of x coordinates.

 o ypoints
 public int ypoints[]
The array of y coordinates.

 o zpoints
 public int zpoints[]
The array of z coordinates.

 o XY_bounds
 protected Rectangle XY_bounds
XY bounds of the polygon.

 o YZ_bounds
 protected Rectangle YZ_bounds
YZ bounds of the polygon.

 o XZ_bounds
 protected Rectangle XZ_bounds
XZ bounds of the polygon.

Constructors

 o Polygon3D
 public Polygon3D()
Creates an empty polygon.

 o Polygon3D
 public Polygon3D(int xpoints[],
                  int ypoints[],
                  int zpoints[],
                  int npoints)
Constructs and initializes a Polygon from the specified parameters.

Parameters:
xpoints - the array of x coordinates
ypoints - the array of y coordinates
zpoints - the array of z coordinates
npoints - the total number of points in the Polygon

Methods

 o translate
 public void translate(int deltaX,
                       int deltaY,
                       int deltaZ)
Translates the vertices by deltaX, deltaY, and deltaZ.

Parameters:
deltaX - the amount to move the X coords
deltaY - the amount to move the Y coords
deltaZ - the amount to move the Z coords
 o addPoint
 public void addPoint(int x,
                      int y,
                      int z)
Appends a point to a polygon. If 'inside (x, y, z)' or another operation that calculates the bounding box has already been performed, this method updates the bounds accordingly.

Parameters:
x - the x coordinate of the point
y - the y coordinate of the point
z - the z coordinate of the piont
 o getXYBounds
 public Rectangle getXYBounds()
Returns the XY bounding box of the shape.

Returns:
a Rectangle defining the XY bounds of the Polygon.
 o getYZBounds
 public Rectangle getYZBounds()
Returns the YZ bounding box of the shape.

Returns:
a Rectangle defining the YZ bounds of the Polygon.
 o getXZBounds
 public Rectangle getXZBounds()
Returns the XZ bounding box of the shape.

Returns:
a Rectangle defining the XZ bounds of the Polygon.
 o contains
 public boolean contains(Point3D p)
Determines whether the 3D point is inside the Polygon.

Parameters:
x - the X coordinate of the point to be tested
y - the Y coordinate of the point to be tested
z - the z coordinate of the point to be tested
 o contains
 public boolean contains(int x,
                         int y,
                         int z)
Determines whether the point (x, y, z) is inside the Polygon.

Parameters:
x - the X coordinate of the point to be tested
y - the Y coordinate of the point to be tested
z - the z coordinate of the point to be tested

All Packages  Class Hierarchy  This Package  Previous  Next  Index