public interface Polygon2d extends Iterable<Vector2d>
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Polygon2d polygon)
Returns true if the given polygon is inside this polygon.
|
boolean |
contains(Vector2d point)
Returns true if the given point is inside this polygon.
|
static Polygon2d |
create(List<? extends Vector2d> vertices)
Creates a 2-dimensional polygon with the given vertices.
|
static Polygon2d |
create(Polygon2d polygon)
Creates a 2-dimensional polygon with the contents deep copied from the given
polygon.
|
default double |
distance(Polygon2d polygon)
Returns the minimum distance between this polygon and the given polygon.
|
default double |
distance(Segment2d segment)
Returns the minimum distance between this polygon and the given segment.
|
default double |
distance(Vector2d point)
Returns the distance between this polygon and the given point.
|
double |
distanceSquared(Polygon2d polygon)
Returns the square of the distance between this polygon and the given
polygon.
|
double |
distanceSquared(Segment2d segment)
Returns the square of the minimum distance between this polygon and the
given segment.
|
double |
distanceSquared(Vector2d point)
Returns the square of the distance between this polygon and the given
point.
|
double |
getArea()
Returns the area of this polygon.
|
MAABB2d |
getBoundingRectangle()
Returns a copy of the minimum area axis aligned bounding rectangle.
|
MVector2d |
getCentroid()
Returns the centroid of this polygon.
|
Iterator<Segment2d> |
getEdgeIterator()
Returns an iterator that iterates through the edges of this polygon.
|
MRectangle2d |
getOrientedBoundingRectangle()
Returns the minimum area oriented bounding rectangle for this polygon.
|
double |
getPerimeter()
Returns the perimeter length of this polygon.
|
int |
getVertexCount()
Returns the number of vertices in this polygon.
|
List<Vector2d> |
getVertices()
Returns the vertices of this polygon.
|
Collection<MVector2d> |
intersectEdges(Segment2d segment)
Returns all intersection points between the edges of this polygon and the
given segment.
|
boolean |
intersects(Polygon2d polygon)
Returns true if this polygon intersects the given polygon.
|
boolean |
isConvex()
Returns true if this polygon is convex.
|
boolean |
isCounterClockwise()
Returns true if the vertices of this polygon are in counter clockwise
order.
|
Segment2d |
shortestSegmentTo(Polygon2d polygon)
Returns the shortest segment between this polygon and the given polygon.
|
MArea |
toArea()
Returns this polygon as an
MArea object. |
forEach, iterator, spliterator
boolean contains(Polygon2d polygon)
polygon
- the polygon that is checked for containment inside this
polygonboolean contains(Vector2d point)
point
- the point that is checked for containment inside this
polygondefault double distance(Polygon2d polygon)
polygon
- the polygon to which the distance is computeddefault double distance(Segment2d segment)
segment
- the segment to which the distance is computeddefault double distance(Vector2d point)
point
- the point to which the distance is computeddouble distanceSquared(Polygon2d polygon)
polygon
- the polygon to which the squared distance is computeddouble distanceSquared(Segment2d segment)
segment
- the segment to which the squared distance is computeddouble distanceSquared(Vector2d point)
point
- the point to which the squared distance is computeddouble getArea()
MVector2d getCentroid()
MAABB2d getBoundingRectangle()
MRectangle2d getOrientedBoundingRectangle()
Iterator<Segment2d> getEdgeIterator()
double getPerimeter()
Collection<MVector2d> intersectEdges(Segment2d segment)
segment
- the segment with which the intersections are computedSegment2d shortestSegmentTo(Polygon2d polygon)
polygon
- the polygon to which the shortest distance segment is
returnedint getVertexCount()
List<Vector2d> getVertices()
boolean intersects(Polygon2d polygon)
polygon
- the polygon that is checked for intersection with this
polygonboolean isCounterClockwise()
boolean isConvex()
MArea toArea()
MArea
object.MArea
objectstatic Polygon2d create(List<? extends Vector2d> vertices)
vertices
- the vertices used for creating the returned polygonstatic Polygon2d create(Polygon2d polygon)
polygon
- the polygon whose contents are deep copied into the returned
polygonCopyright © 2019 Solibri, Inc.. All rights reserved.