Interface ConvexPolygon
-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.geometry.AwtShapeCompatible
,it.unibo.alchemist.model.geometry.ConvexShape
,it.unibo.alchemist.model.geometry.Shape
,java.io.Serializable
public interface ConvexPolygon implements ConvexShape<Euclidean2DPosition, Euclidean2DTransformation>, AwtShapeCompatible
A simple polygon (i.e. not self-intersecting and without holes) in which no line segment between two points on the boundary ever goes outside the polygon.
-
-
Method Summary
Modifier and Type Method Description abstract List<Euclidean2DPosition>
vertices()
abstract List<Segment2D<Euclidean2DPosition>>
edges()
abstract Segment2D<Euclidean2DPosition>
getEdge(Integer index)
Depending on the implementation, this may be faster than edges. abstract Boolean
contains(Euclidean2DPosition vector)
Checks if the polygon contains a vector (= a point). abstract Boolean
contains(Shape shape)
Checks if the polygon contains a polygonal java.awt.Shape (i.e. abstract Boolean
liesOnBoundary(Euclidean2DPosition vector)
Checks if a vector (= a point) lies on the polygon's boundary. abstract Boolean
containsBoundaryIncluded(Euclidean2DPosition vector)
Checks if a vector (= a point) is contained in the polygon or lies on its boundary. abstract Boolean
containsBoundaryExcluded(Euclidean2DPosition vector)
Checks if a vector (= a point) is contained in the polygon, boundary excluded. abstract Boolean
intersects(Shape shape)
Checks if a java.awt.Shape intersects the polygon, adjacent shapes are not considered to be intersecting. abstract Boolean
intersects(Segment2D<Euclidean2DPosition> segment)
Checks if a segment intersects with the polygon, segments lying on the polygon's boundary are not considered to be intersecting. abstract Boolean
isAdjacentTo(ConvexPolygon other)
A polygon is adjacent to another if any of its points lies on the boundary of the other. abstract Segment2D<Euclidean2DPosition>
closestEdgeTo(Segment2D<Euclidean2DPosition> segment)
Finds the edge of the polygon closest to the provided segment, i.e. -
Methods inherited from class it.unibo.alchemist.model.geometry.Shape
getCentroid, getDiameter, getRadius, intersects, transformed
-
Methods inherited from class it.unibo.alchemist.model.geometry.AwtShapeCompatible
asAwtShape
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
vertices
abstract List<Euclidean2DPosition> vertices()
-
edges
abstract List<Segment2D<Euclidean2DPosition>> edges()
-
getEdge
abstract Segment2D<Euclidean2DPosition> getEdge(Integer index)
- Parameters:
index
- indicates which edge to get: edge i connects vertices i and i+1 (with respect to the ordering of vertices used in vertices)
-
contains
abstract Boolean contains(Euclidean2DPosition vector)
Checks if the polygon contains a vector (= a point). The definition of insideness may vary depending on the implementation, this may affect the outcome for points lying on the polygon's boundary. For accurate operations see containsBoundaryIncluded and containsBoundaryExcluded.
- Parameters:
vector
- the vector (= point)
-
contains
abstract Boolean contains(Shape shape)
Checks if the polygon contains a polygonal java.awt.Shape (i.e. without curved segments). A polygonal shape is contained in a polygon if all of its points are contained in (or lie on the boundary of) the latter.
- Parameters:
shape
- the polygonal shape
-
liesOnBoundary
abstract Boolean liesOnBoundary(Euclidean2DPosition vector)
Checks if a vector (= a point) lies on the polygon's boundary.
- Parameters:
vector
- the vector (= point)
-
containsBoundaryIncluded
abstract Boolean containsBoundaryIncluded(Euclidean2DPosition vector)
Checks if a vector (= a point) is contained in the polygon or lies on its boundary.
- Parameters:
vector
- the vector (= point)
-
containsBoundaryExcluded
abstract Boolean containsBoundaryExcluded(Euclidean2DPosition vector)
Checks if a vector (= a point) is contained in the polygon, boundary excluded.
- Parameters:
vector
- the vector (= point)
-
intersects
abstract Boolean intersects(Shape shape)
Checks if a java.awt.Shape intersects the polygon, adjacent shapes are not considered to be intersecting.
- Parameters:
shape
- the shape
-
intersects
abstract Boolean intersects(Segment2D<Euclidean2DPosition> segment)
Checks if a segment intersects with the polygon, segments lying on the polygon's boundary are not considered to be intersecting.
- Parameters:
segment
- the segment
-
isAdjacentTo
abstract Boolean isAdjacentTo(ConvexPolygon other)
A polygon is adjacent to another if any of its points lies on the boundary of the other.
- Parameters:
other
- the other polygon
-
closestEdgeTo
abstract Segment2D<Euclidean2DPosition> closestEdgeTo(Segment2D<Euclidean2DPosition> segment)
Finds the edge of the polygon closest to the provided segment, i.e. the first one that would collide (= intersect) with the segment in case the polygon extended on each side.
- Parameters:
segment
- the segment
-
-
-
-