public class Polyline2D extends Polygon2D
Polygon2D
, except that the figure is not closed.Modifier and Type | Field and Description |
---|---|
protected static float |
ASSUME_ZERO |
Constructor and Description |
---|
Polyline2D()
Constructor.
|
Polyline2D(float[] xpoints,
float[] ypoints,
int npoints)
Constructor.
|
Polyline2D(int[] xpoints,
int[] ypoints,
int npoints)
Constructor.
|
Polyline2D(Line2D line)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
boolean |
contains(double x,
double y)
Return false.
|
boolean |
contains(double x,
double y,
double w,
double h)
Return false.
|
boolean |
contains(int x,
int y)
Return false.
|
boolean |
contains(Point p)
Return false.
|
boolean |
contains(Point2D p)
Return false.
|
boolean |
contains(Rectangle2D r)
Return false.
|
PathIterator |
getPathIterator(AffineTransform at)
Returns an iterator object that iterates along the boundary of this
Polygon and provides access to the geometry
of the outline of this Polygon . |
Polygon2D |
getPolygon2D() |
addPoint, addPoint, calculatePath, getBounds, getBounds2D, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, getPolygon, getPolyline2D, intersects, intersects, reset, updateComputingPath, updatePath
protected static final float ASSUME_ZERO
public Polyline2D()
public Polyline2D(float[] xpoints, float[] ypoints, int npoints)
xpoints
- an array of x coordinatesypoints
- an array of y coordinatesnpoints
- the total number of points in the Polyline2D
NegativeArraySizeException
- if the value of
npoints
is negative.IndexOutOfBoundsException
- if npoints
is
greater than the length of xpoints
or the length of ypoints
.NullPointerException
- if xpoints
or
ypoints
is null
.public Polyline2D(int[] xpoints, int[] ypoints, int npoints)
xpoints
- an array of x coordinatesypoints
- an array of y coordinatesnpoints
- the total number of points in the Polyline2D
NegativeArraySizeException
- if the value of npoints
is negative.IndexOutOfBoundsException
- if npoints
is greater than the length of xpoints
or the length of ypoints
.NullPointerException
- if xpoints
or ypoints
is null
.public Polyline2D(Line2D line)
line
- the linepublic boolean contains(Point p)
contains
in class Polygon2D
p
- the specified Point
to be testedPolygon2D.contains(double, double)
public boolean contains(double x, double y)
public boolean contains(int x, int y)
public boolean contains(Point2D p)
contains
in interface Shape
contains
in class Polygon2D
p
- a specified Point2D
Polygon2D.contains(double, double)
public boolean contains(double x, double y, double w, double h)
contains
in interface Shape
contains
in class Polygon2D
x
- the x coordinate of the top-left corner of the
specified set of rectangular coordinatesy
- the y coordinate of the top-left corner of the
specified set of rectangular coordinatesw
- the width of the set of rectangular coordinatesh
- the height of the set of rectangular coordinatespublic boolean contains(Rectangle2D r)
contains
in interface Shape
contains
in class Polygon2D
r
- the specified Rectangle2D
Polygon2D.contains(double, double, double, double)
public PathIterator getPathIterator(AffineTransform at)
Polygon
and provides access to the geometry
of the outline of this Polygon
. An optional
AffineTransform
can be specified so that the coordinates
returned in the iteration are transformed accordingly.getPathIterator
in interface Shape
getPathIterator
in class Polygon2D
at
- an optional AffineTransform
to be applied to the
coordinates as they are returned in the iteration, or
null
if untransformed coordinates are desiredPathIterator
object that provides access to the
geometry of this Polygon
.public Polygon2D getPolygon2D()