|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object math.geom2d.polygon.MultiPolygon2D
public class MultiPolygon2D
A polygonal domain whose boundary is composed of several disjoint continuous LinearRing2D.
Field Summary |
---|
Fields inherited from interface math.geom2d.Shape2D |
---|
ACCURACY |
Constructor Summary | |
---|---|
MultiPolygon2D()
|
|
MultiPolygon2D(java.util.Collection<LinearRing2D> lines)
|
|
MultiPolygon2D(LinearRing2D... rings)
|
|
MultiPolygon2D(LinearRing2D ring)
|
|
MultiPolygon2D(SimplePolygon2D polygon)
|
Method Summary | |
---|---|
void |
addRing(LinearRing2D ring)
|
void |
addVertex(Point2D position)
Adds a vertex at the end of the last ring of this polygon. |
boolean |
almostEquals(GeometricObject2D obj,
double eps)
Checks if the two objects are similar up to a given threshold value. |
double |
area()
Computes the signed area of the polygon. |
Polygon2D |
asPolygon(int n)
Returns an approximation of the domain as a polygon, or a MultiPolygon. |
CirculinearContourArray2D<LinearRing2D> |
boundary()
Returns the boundary of the set. |
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. |
Point2D |
centroid()
Computes the centroid (center of mass) of the polygon. |
void |
clearRings()
|
Polygon2D |
clip(Box2D box)
Clips the polygon with the specified box. |
MultiPolygon2D |
clone()
|
int |
closestVertexIndex(Point2D point)
Computes the index of the closest vertex to the input point. |
Polygon2D |
complement()
Returns the domain which complements this domain in the plane. |
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. |
java.util.Collection<LinearRing2D> |
contours()
Returns the set of contours that enclose this domain. |
static MultiPolygon2D |
create(java.util.Collection<LinearRing2D> rings)
|
static MultiPolygon2D |
create(LinearRing2D... rings)
|
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)
Returns the distance of the shape to the given point, or the distance of point to the frontier of the shape in the case of a plain shape. |
void |
draw(java.awt.Graphics2D g2)
Draws the boundary of the domain, using current Stroke and color. |
int |
edgeNumber()
Returns the number of edges of the polygon |
java.util.Collection<LineSegment2D> |
edges()
Return the edges as line segments of the polygon |
boolean |
equals(java.lang.Object obj)
|
void |
fill(java.awt.Graphics2D g)
Fills the interior of the domain, using the Graphics current Paint. |
LinearRing2D |
getRing(int index)
|
void |
insertRing(int index,
LinearRing2D ring)
|
void |
insertVertex(int index,
Point2D point)
Inserts a vertex at the given position |
boolean |
isBounded()
Returns true if the shape is bounded, that is if we can draw a finite rectangle enclosing the shape. |
boolean |
isEmpty()
The MultiPolygon2D is empty either if it contains no ring, or if all rings are empty. |
void |
removeRing(LinearRing2D ring)
|
void |
removeVertex(int i)
Returns the i-th vertex of the polygon. |
int |
ringNumber()
|
void |
setRing(int index,
LinearRing2D ring)
|
void |
setVertex(int i,
Point2D point)
Sets the position of the i-th vertex of this polygon. |
MultiPolygon2D |
transform(AffineTransform2D trans)
Transforms the shape by an affine transform. |
CirculinearDomain2D |
transform(CircleInversion2D inv)
Transforms the shape by a circle inversion. |
Point2D |
vertex(int i)
Returns the i-th vertex of the polygon. |
int |
vertexNumber()
Returns the total number of vertices in this polygon. |
java.util.Collection<Point2D> |
vertices()
Returns the vertices (singular points) of the polygon |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MultiPolygon2D()
public MultiPolygon2D(LinearRing2D ring)
public MultiPolygon2D(LinearRing2D... rings)
public MultiPolygon2D(SimplePolygon2D polygon)
public MultiPolygon2D(java.util.Collection<LinearRing2D> lines)
Method Detail |
---|
public static MultiPolygon2D create(java.util.Collection<LinearRing2D> rings)
public static MultiPolygon2D create(LinearRing2D... rings)
public void addRing(LinearRing2D ring)
public void insertRing(int index, LinearRing2D ring)
public void removeRing(LinearRing2D ring)
public void clearRings()
public LinearRing2D getRing(int index)
public void setRing(int index, LinearRing2D ring)
public int ringNumber()
public double area()
area
in interface Polygon2D
public Point2D centroid()
centroid
in interface Polygon2D
public java.util.Collection<LineSegment2D> edges()
Polygon2D
edges
in interface Polygon2D
public int edgeNumber()
Polygon2D
edgeNumber
in interface Polygon2D
public java.util.Collection<Point2D> vertices()
Polygon2D
vertices
in interface Polygon2D
public Point2D vertex(int i)
vertex
in interface Polygon2D
i
- index of the vertex, between 0 and the number of vertices minus onepublic void setVertex(int i, Point2D point)
setVertex
in interface Polygon2D
i
- index of the vertex, between 0 and the number of verticespoint
- the new position of the vertexpublic void addVertex(Point2D position)
addVertex
in interface Polygon2D
position
- the position of the new vertex
java.lang.RuntimeException
- if this MultiPolygon does not contain any ringpublic void insertVertex(int index, Point2D point)
insertVertex
in interface Polygon2D
index
- index at which the specified vertex is to be insertedpoint
- the position of the new vertexpublic void removeVertex(int i)
removeVertex
in interface Polygon2D
i
- index of the vertex, between 0 and the number of vertices minus onepublic int vertexNumber()
vertexNumber
in interface Polygon2D
public int closestVertexIndex(Point2D point)
closestVertexIndex
in interface Polygon2D
public CirculinearDomain2D transform(CircleInversion2D inv)
CirculinearShape2D
transform
in interface CirculinearDomain2D
transform
in interface CirculinearShape2D
inv
- the circle inversion
public CirculinearDomain2D buffer(double dist)
CirculinearShape2D
buffer
in interface CirculinearShape2D
dist
- the maximal distance between a point of the buffer and the
shape
public Polygon2D asPolygon(int n)
Domain2D
asPolygon
in interface Domain2D
public CirculinearContourArray2D<LinearRing2D> boundary()
Domain2D
The returned curve is oriented, with an interior and an exterior.
boundary
in interface CirculinearDomain2D
boundary
in interface Domain2D
boundary
in interface Polygon2D
public java.util.Collection<LinearRing2D> contours()
Domain2D
contours
in interface CirculinearDomain2D
contours
in interface Domain2D
contours
in interface Polygon2D
Contour2D
public Polygon2D complement()
Domain2D
complement
in interface CirculinearDomain2D
complement
in interface Domain2D
complement
in interface Polygon2D
public Box2D boundingBox()
Shape2D
boundingBox
in interface Shape2D
public Polygon2D clip(Box2D box)
clip
in interface Domain2D
clip
in interface Polygon2D
clip
in interface Shape2D
box
- the clipping box
public double distance(Point2D p)
Shape2D
distance
in interface Shape2D
public double distance(double x, double y)
Shape2D
distance
in interface Shape2D
public boolean isBounded()
Shape2D
isBounded
in interface Shape2D
public boolean isEmpty()
isEmpty
in interface Shape2D
public MultiPolygon2D transform(AffineTransform2D trans)
Shape2D
transform
in interface Domain2D
transform
in interface Polygon2D
transform
in interface Shape2D
trans
- an affine transform
public boolean contains(Point2D point)
Shape2D
contains
in interface Shape2D
public boolean contains(double x, double y)
Shape2D
contains
in interface Shape2D
public void draw(java.awt.Graphics2D g2)
Domain2D
draw
in interface Domain2D
draw
in interface Shape2D
g2
- the Graphics to draw onpublic void fill(java.awt.Graphics2D g)
Domain2D
fill
in interface Domain2D
g
- the Graphics to fill onpublic 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 MultiPolygon2D clone()
clone
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |