All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.awt.Polygon
Polygon class encapsulates a description of a 
 closed, two-dimensional region within a coordinate space. This 
 region is bounded by an arbitrary number of line segments, each of 
 which is one side of the polygon. Internally, a polygon 
 comprises of a list of (x, y) coordinate pairs, 
 where each pair defines a vertex of the polygon, and two 
 successive pairs are the endpoints of a line that is a side of the 
 polygon. The first and final pairs of (x, y) 
 points are joined by a line segment that closes the polygon.
 
 bounds
	bounds
   npoints
	npoints
   xpoints
	xpoints
   ypoints
	ypoints
   
 Polygon()
	Polygon()
   Polygon(int[], int[], int)
	Polygon(int[], int[], int)
   
 addPoint(int, int)
	addPoint(int, int)
   contains(int, int)
	contains(int, int)
   contains(Point)
	contains(Point)
   getBoundingBox()
	getBoundingBox()
   getBounds()
	getBounds()
   inside(int, int)
	inside(int, int)
   translate(int, int)
	translate(int, int)
  deltaX along the 
 x axis and by deltaY along the 
 y axis.
 
 npoints
npoints
public int npoints
 xpoints
xpoints
public int xpoints[]
 ypoints
ypoints
public int ypoints[]
 bounds
bounds
protected Rectangle bounds
 
 Polygon
Polygon
public Polygon()
 Polygon
Polygon
 public Polygon(int xpoints[],
                int ypoints[],
                int npoints)
npoints is negative.
   
 translate
translate
 public void translate(int deltaX,
                       int deltaY)
deltaX along the 
 x axis and by deltaY along the 
 y axis.
 addPoint
addPoint
 public void addPoint(int x,
                      int y)
 If an operation that calculates the bounding box of this polygon
 has already been performed, such as getBounds 
 or contains, then this method updates the bounding box.
 getBounds
getBounds
public Rectangle getBounds()
 getBoundingBox
getBoundingBox
public Rectangle getBoundingBox()
getBounds().
 contains
contains
public boolean contains(Point p)
 contains
contains
 public boolean contains(int x,
                         int y)
 (The contains method is based on code by 
 Hanpeter van Vliet [hvvliet@inter.nl.net].)
true if the point (x, y)
                       is contained by this polygon; 
                       false otherwise.
   inside
inside
 public boolean inside(int x,
                       int y)
contains(int, int).
All Packages Class Hierarchy This Package Previous Next Index