CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.geom3d
Class Polygon3D

java.lang.Object
  extended by ch.randelshofer.geom3d.Polygon3D

public class Polygon3D
extends java.lang.Object

A polygon located in three dimensional (x, y, z) coordinate space. Note: The edges do not have to be on the same plane.

Version:
0.2 1999-1-1 Package renamed.
0.1 1998-12-15 Released.
0.0 1998-02-15 Created.
Author:
Werner Randelshofer, Hausmatt 10 ,6405 Immensee

Field Summary
 int npoints
          The total number of points.
 double[] xpoints
          The array of x coordinates.
 double[] ypoints
          The array of y coordinates.
 double[] zpoints
          The array of z coordinates.
 
Constructor Summary
Polygon3D()
          Creates an empty polygon.
Polygon3D(double[] xpoints, double[] ypoints, double[] zpoints, int npoints)
          Constructs and initializes a Polygon from the specified parameters.
Polygon3D(int capacity)
          Creates an empty polygon with the indicated capacity.
Polygon3D(short[][] points, int position, int npoints)
          Constructs and initializes a Polygon from the specified parameters.
 
Method Summary
 void addPoint(double x, double y, double z)
          Appends a point to a polygon.
 void setCapacity(int capacity)
          Sets the capacity of the Polygon but drops all data!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

npoints

public int npoints
The total number of points.


xpoints

public double[] xpoints
The array of x coordinates.


ypoints

public double[] ypoints
The array of y coordinates.


zpoints

public double[] zpoints
The array of z coordinates.

Constructor Detail

Polygon3D

public Polygon3D()
Creates an empty polygon.


Polygon3D

public Polygon3D(int capacity)
Creates an empty polygon with the indicated capacity.


Polygon3D

public Polygon3D(double[] xpoints,
                 double[] ypoints,
                 double[] 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

Polygon3D

public Polygon3D(short[][] points,
                 int position,
                 int npoints)
Constructs and initializes a Polygon from the specified parameters.

Parameters:
points - the array of points coordinates; the second index specifies the axis where [0]=x; [1]=y; [2]=z;
position - the start index of the points in the array
npoints - the total number of points in the Polygon
Method Detail

setCapacity

public void setCapacity(int capacity)
Sets the capacity of the Polygon but drops all data!


addPoint

public void addPoint(double x,
                     double y,
                     double z)
Appends a point to a polygon. If inside(x, y) 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 point

(c) Werner Randelshofer.
All rights reserved.