Class Polygon3D
java.lang.Object
|
+--java.awt.Polygon
|
+--Polygon3D
- All Implemented Interfaces:
- Serializable, Shape
- class Polygon3D
- extends Polygon
Polygon3D
this class keeps track of a polygon of 3D points in terms of three integer coordinates
allowing useful distortions and transformations to be performed on them
It extends the class Polygon so that it can be passed to a Graphics object to be drawn
Only the X and Y coordinates will be taken into account when drawn, so the zoom method
should be called ONCE before drawing the polygon, to scale the points.
- See Also:
- Serialized Form
|
Constructor Summary |
Polygon3D(int[] xpoints,
int[] ypoints,
int[] zpoints,
int npoints)
Polygon3D Constructor |
|
Method Summary |
void |
move(int x,
int y,
int z)
move - moves the polygon in three-dimensional space |
void |
rotateX(double xangle)
rotateX - rotates the polygon around the X axis |
void |
rotateY(double yangle)
rotateY - rotates the polygon around the Y axis |
void |
rotateZ(double zangle)
rotateZ - rotates the polygon around the Z axis |
void |
scale(double x,
double y,
double z)
scale - scales the polygon based on the point 0, 0, 0 |
void |
zoom(double zoomfactor)
zoom - scales the x and y coordinates toward 0,0 by a factor
proportional to each points z coordinate and a zoom factor, * making a head-on view of the polygon appear to be in perspective |
| Methods inherited from class java.awt.Polygon |
addPoint, calculateBounds, contains, contains, contains, contains, contains, contains, getBoundingBox, getBounds, getBounds2D, getPathIterator, getPathIterator, inside, intersects, intersects, translate, updateBounds |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
zpoints
public int[] zpoints
Polygon3D
public Polygon3D(int[] xpoints,
int[] ypoints,
int[] zpoints,
int npoints)
- Polygon3D Constructor
- Parameters:
xpoints - - array of x coordinatesypoints - - array of y coordinateszpoints - - array of z coordinatesnpoints - - number coordinates
move
public void move(int x,
int y,
int z)
- move - moves the polygon in three-dimensional space
- Parameters:
x - the distance to move in the x directiony - the distance to move in the y directionz - the distance to move in the z direction
rotateX
public void rotateX(double xangle)
- rotateX - rotates the polygon around the X axis
- Parameters:
xangle - the angle to rotate in degrees measured counterclockwise
from the positive Y axis
rotateY
public void rotateY(double yangle)
- rotateY - rotates the polygon around the Y axis
- Parameters:
yangle - the angle to rotate in degrees measured counterclockwise
from the positive X axis
rotateZ
public void rotateZ(double zangle)
- rotateZ - rotates the polygon around the Z axis
- Parameters:
zangle - the angle to rotate in degrees measured counterclockwise
from the positive X axis
scale
public void scale(double x,
double y,
double z)
- scale - scales the polygon based on the point 0, 0, 0
- Parameters:
x - the factor to scale by in the x directiony - the factor to scale by in the y directionz - the factor to scale by in the z direction
zoom
public void zoom(double zoomfactor)
- zoom - scales the x and y coordinates toward 0,0 by a factor
proportional to each points z coordinate and a zoom factor, * making a head-on view of the polygon appear to be in perspective
- Parameters:
zoomfactor - the amount to zoom - greater values make the polygon larger
Generated by BlueJ