public class PointArray2D extends Object implements PointSet2D, CirculinearShape2D, Cloneable
| Modifier and Type | Field and Description |
|---|---|
protected ArrayList<Point2D> |
points
The inner collection of points composing the set.
|
| Constructor and Description |
|---|
PointArray2D()
Creates a new PointArray2D without any points.
|
PointArray2D(Collection<? extends Point2D> points)
Points must be a collection of java.awt.Point.
|
PointArray2D(int n)
Creates a new empty PointArray2D, but preallocates the memory for storing a
given amount of points.
|
PointArray2D(Point2D[] points)
Instances of Point2D are directly added, other Point are converted to
Point2D with the same location.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPoint(Point2D point)
Add a new point to the set of point.
|
void |
addPoints(Collection<? extends Point2D> points)
Add a series of points
|
void |
addPoints(Point2D[] points)
Add a series of points
|
void |
clearPoints()
remove all points of the set.
|
PointArray2D |
clip(Box2D box)
Returns a new point set containing only points located within the box.
|
PointArray2D |
clone() |
boolean |
contains(double x,
double y)
Checks if the shape contains the planar point defined by (x,y).
|
boolean |
contains(Point2D point)
Checks if the shape contains the given point.
|
static PointSet2D |
create(Collection<? extends Point2D> points) |
static PointSet2D |
create(int size) |
static PointSet2D |
create(Point2D[] points) |
void |
draw(Graphics2D g2)
Draws the point set on the specified Graphics2D, using default radius
equal to 1.
|
void |
draw(Graphics2D g2,
double r)
Draws the point set on the specified Graphics2D, by filling a disc with a
given radius.
|
boolean |
equals(Object obj) |
Box2D |
getBoundingBox()
Returns the bounding box of the shape.
|
CirculinearDomain2D |
getBuffer(double dist)
Computes the buffer of the shape, formed by the set of points located
at a distance from the shape that is lower or equal to d.
|
double |
getDistance(double x,
double y)
get the distance of the shape to the given point, specified by x and y,
or the distance of point to the frontier of the shape in the case of a
plain (i.e.
|
double |
getDistance(Point2D p)
Return distance to the closest point of the collection
|
int |
getPointNumber()
Returns the number of points in the set.
|
Collection<Point2D> |
getPoints()
return an iterator on the internal point collection.
|
boolean |
isBounded()
always return true.
|
boolean |
isEmpty()
Returns true if the shape does not contain any point.
|
Iterator<Point2D> |
iterator() |
PointArray2D |
transform(AffineTransform2D trans)
Transforms the point set by returning a new point set containing each
transformed point.
|
PointArray2D |
transform(CircleInversion2D inv)
Transforms the shape by a circle inversion.
|
public PointArray2D()
public PointArray2D(int n)
n - the expected number of points in the PointArray2D.public PointArray2D(Point2D[] points)
public PointArray2D(Collection<? extends Point2D> points)
points - public static final PointSet2D create(Collection<? extends Point2D> points)
public static final PointSet2D create(Point2D[] points)
public static final PointSet2D create(int size)
public void addPoint(Point2D point)
addPoint in interface PointSet2Dpoint - public void addPoints(Point2D[] points)
points - an array of pointspublic void addPoints(Collection<? extends Point2D> points)
PointSet2DaddPoints in interface PointSet2Dpoints - an array of pointspublic Collection<Point2D> getPoints()
getPoints in interface PointSet2DgetPoints in interface PointShape2Dpublic void clearPoints()
public int getPointNumber()
getPointNumber in interface PointSet2DgetPointNumber in interface PointShape2Dpublic CirculinearDomain2D getBuffer(double dist)
CirculinearShape2DgetBuffer in interface CirculinearShape2Ddist - the maximal distance between a point of the buffer and the
shapepublic PointArray2D transform(CircleInversion2D inv)
CirculinearShape2Dtransform in interface CirculinearShape2Dinv - the circle inversionpublic double getDistance(Point2D p)
getDistance in interface Shape2Dpublic double getDistance(double x,
double y)
Shape2DgetDistance in interface Shape2Dpublic boolean isBounded()
public boolean isEmpty()
Shape2Dpublic PointArray2D clip(Box2D box)
PointSet2Dclip in interface PointSet2Dclip in interface PointShape2Dclip in interface Shape2Dbox - the clipping boxpublic Box2D getBoundingBox()
Shape2DgetBoundingBox in interface Shape2Dpublic PointArray2D transform(AffineTransform2D trans)
PointSet2Dtransform in interface PointSet2Dtransform in interface PointShape2Dtransform in interface Shape2Dtrans - an affine transformpublic boolean contains(double x,
double y)
Shape2Dpublic boolean contains(Point2D point)
Shape2Dpublic void draw(Graphics2D g2)
public void draw(Graphics2D g2, double r)
g2 - the graphics to draw the point setpublic PointArray2D clone()
Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.