|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object math.geom2d.point.PointArray2D
public class PointArray2D
Represent the union of a finite number of Point2D.
Field Summary |
---|
Fields inherited from interface math.geom2d.Shape2D |
---|
ACCURACY |
Constructor Summary | |
---|---|
PointArray2D()
Creates a new PointArray2D without any points. |
|
PointArray2D(java.util.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. |
Method Summary | ||
---|---|---|
void |
add(int index,
Point2D point)
Inserts the specified shape at the specified position in this set (optional operation). |
|
boolean |
add(Point2D point)
Add a new point to the set of point. |
|
void |
addAll(java.util.Collection<? extends Point2D> points)
Add a series of points |
|
void |
addAll(Point2D[] points)
Add a series of points |
|
boolean |
almostEquals(GeometricObject2D obj,
double eps)
Checks if the two objects are similar up to a given threshold value. |
|
Box2D |
boundingBox()
Returns the bounding box of the shape. |
|
CirculinearDomain2D |
buffer(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. |
|
void |
clear()
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
|
create(java.util.Collection<T> points)
|
|
static PointArray2D |
create(int size)
Allocate memory for the specified number of points. |
|
static
|
create(T... points)
|
|
double |
distance(double x,
double y)
Returns 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. fillable) shape. |
|
double |
distance(Point2D p)
Return distance to the closest point of the collection |
|
void |
draw(java.awt.Graphics2D g2)
Draws the point set on the specified Graphics2D, using default radius equal to 1. |
|
void |
draw(java.awt.Graphics2D g2,
double r)
Draws the point set on the specified Graphics2D, by filling a disc with a given radius. |
|
boolean |
equals(java.lang.Object obj)
Returns true if the given object is an instance of PointSet2D that contains the same number of points, such that iteration on each set returns equal points. |
|
Point2D |
get(int index)
Returns the shape at a given position. |
|
int |
indexOf(Point2D point)
Returns the index of the shape in this set. |
|
boolean |
isBounded()
Always return true. |
|
boolean |
isEmpty()
Returns true if the point set is empty, i.e. the number of points is 0. |
|
java.util.Iterator<Point2D> |
iterator()
|
|
java.util.Collection<Point2D> |
points()
return an iterator on the internal point collection. |
|
Point2D |
remove(int index)
Removes the shape at the specified position in this set (optional operation). |
|
boolean |
remove(Point2D point)
Removes the first occurrence of the specified element from this list, if it is present. |
|
int |
size()
Returns the number of points in the set. |
|
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. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PointArray2D()
public PointArray2D(int n)
n
- the expected number of points in the PointArray2D.public PointArray2D(Point2D... points)
public PointArray2D(java.util.Collection<? extends Point2D> points)
points
- Method Detail |
---|
public static <T extends Point2D> PointArray2D create(java.util.Collection<T> points)
public static <T extends Point2D> PointArray2D create(T... points)
public static PointArray2D create(int size)
public boolean add(Point2D point)
add
in interface PointSet2D
add
in interface ShapeSet2D<Point2D>
point
- public void add(int index, Point2D point)
ShapeSet2D
add
in interface ShapeSet2D<Point2D>
public void addAll(Point2D[] points)
points
- an array of pointspublic void addAll(java.util.Collection<? extends Point2D> points)
PointSet2D
addAll
in interface PointSet2D
points
- an array of pointspublic Point2D get(int index)
ShapeSet2D
get
in interface ShapeSet2D<Point2D>
index
- the position of the shape
public boolean remove(Point2D point)
ShapeSet2D
remove
in interface ShapeSet2D<Point2D>
public Point2D remove(int index)
ShapeSet2D
remove
in interface ShapeSet2D<Point2D>
public int indexOf(Point2D point)
ShapeSet2D
indexOf
in interface ShapeSet2D<Point2D>
public java.util.Collection<Point2D> points()
points
in interface PointSet2D
points
in interface PointShape2D
public void clear()
clear
in interface ShapeSet2D<Point2D>
public int size()
size
in interface PointSet2D
size
in interface PointShape2D
size
in interface ShapeSet2D<Point2D>
public CirculinearDomain2D buffer(double dist)
CirculinearShape2D
buffer
in interface CirculinearShape2D
dist
- the maximal distance between a point of the buffer and the
shape
public PointArray2D transform(CircleInversion2D inv)
CirculinearShape2D
transform
in interface CirculinearShape2D
inv
- the circle inversion
public double distance(Point2D p)
distance
in interface Shape2D
public double distance(double x, double y)
Shape2D
distance
in interface Shape2D
public boolean isBounded()
isBounded
in interface Shape2D
public boolean isEmpty()
isEmpty
in interface Shape2D
public PointArray2D clip(Box2D box)
PointSet2D
clip
in interface PointSet2D
clip
in interface PointShape2D
clip
in interface Shape2D
box
- the clipping box
public Box2D boundingBox()
Shape2D
boundingBox
in interface Shape2D
public PointArray2D transform(AffineTransform2D trans)
PointSet2D
transform
in interface PointSet2D
transform
in interface PointShape2D
transform
in interface Shape2D
trans
- an affine transform
public boolean contains(double x, double y)
Shape2D
contains
in interface Shape2D
public boolean contains(Point2D point)
Shape2D
contains
in interface Shape2D
contains
in interface ShapeSet2D<Point2D>
public void draw(java.awt.Graphics2D g2)
draw
in interface Shape2D
g2
- the graphics to draw the point setpublic void draw(java.awt.Graphics2D g2, double r)
g2
- the graphics to draw the point setpublic java.util.Iterator<Point2D> iterator()
iterator
in interface java.lang.Iterable<Point2D>
public boolean almostEquals(GeometricObject2D obj, double eps)
GeometricObject2D
almostEquals
in interface GeometricObject2D
obj
- the object to compareeps
- a threshold value, for example the minimal coordinate difference
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public PointArray2D clone()
clone
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |