public class DefaultWritablePolygon2D extends AbstractRealInterval implements WritablePolygon2D
DefaultWritablePolygon2D defined by the given vertices. The resulting
polygon may contain some edge points, all edge points, or no edge points
depending on the specified shape.
If consistent edge point inclusion/exclusion is needed see
OpenWritablePolygon2D or ClosedWritablePolygon2D. These implementations will
be less efficient but have consistent edge behavior.
| Modifier and Type | Field and Description |
|---|---|
protected gnu.trove.list.array.TDoubleArrayList |
x |
protected gnu.trove.list.array.TDoubleArrayList |
y |
max, minn| Constructor and Description |
|---|
DefaultWritablePolygon2D(double[] x,
double[] y)
Creates a 2D polygon with vertices at the provided x, y coordinates.
|
DefaultWritablePolygon2D(List<? extends RealLocalizable> vertices)
Creates a 2D polygon with the provided vertices.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addVertex(int index,
double[] vertex)
If the given vertex has more than 2 dimensions, the higher dimensions
will be ignored.
|
boolean |
equals(Object obj) |
int |
hashCode() |
int |
numVertices()
Get the number of vertices
|
void |
removeVertex(int index)
Removes the vertex at the given index.
|
boolean |
test(RealLocalizable localizable)
Return true if the given point is contained inside the boundary.
|
RealLocalizableRealPositionable |
vertex(int pos)
Return a copy of the vertex
|
realMax, realMax, realMax, realMin, realMin, realMinnumDimensionsclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitand, isEmpty, minus, or, realMax, realMax, realMin, realMin, transform, xorboundaryType, isAll, knownConstantnumDimensionsrealMax, realMinprotected final gnu.trove.list.array.TDoubleArrayList x
protected final gnu.trove.list.array.TDoubleArrayList y
public DefaultWritablePolygon2D(List<? extends RealLocalizable> vertices)
vertices - List of vertices which will be copied. Each vertex should have
a position in 2D space, positions beyond 2D will be ignored.public DefaultWritablePolygon2D(double[] x,
double[] y)
x - X coordinates of the vertices which will be copiedy - Y coordinates of the vertices which will be copiedpublic boolean test(RealLocalizable localizable)
test in interface Predicate<RealLocalizable>public RealLocalizableRealPositionable vertex(int pos)
vertex in interface Polygon2Dvertex in interface WritablePolygon2Dpublic int numVertices()
Polygon2DnumVertices in interface Polygon2Dpublic void addVertex(int index,
double[] vertex)
addVertex in interface WritablePolygon2Dpublic void removeVertex(int index)
WritablePolygon2DremoveVertex in interface WritablePolygon2DCopyright © 2009–2018 ImgLib2. All rights reserved.