Class AbstractConvexPolygon
-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.geometry.AwtShapeCompatible
,it.unibo.alchemist.model.geometry.ConvexPolygon
,it.unibo.alchemist.model.geometry.ConvexShape
,it.unibo.alchemist.model.geometry.Shape
,java.io.Serializable
public abstract class AbstractConvexPolygon implements ConvexPolygon
An abstract ConvexPolygon providing a convexity test.
-
-
Constructor Summary
Constructors Constructor Description AbstractConvexPolygon()
-
Method Summary
Modifier and Type Method Description Boolean
liesOnBoundary(Euclidean2DPosition vector)
Checks if a vector (= a point) lies on the polygon's boundary. Boolean
containsBoundaryIncluded(Euclidean2DPosition vector)
Checks if a vector (= a point) is contained in the polygon or lies on its boundary. Boolean
containsBoundaryExcluded(Euclidean2DPosition vector)
Checks if a vector (= a point) is contained in the polygon, boundary excluded. Boolean
contains(Shape shape)
Checks if the polygon contains a polygonal java.awt.Shape (i.e. Boolean
isAdjacentTo(ConvexPolygon other)
A polygon is adjacent to another if any of its points lies on the boundary of the other. Segment2D<Euclidean2DPosition>
closestEdgeTo(Segment2D<Euclidean2DPosition> segment)
Finds the edge of the polygon closest to the provided segment, i.e. 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. String
toString()
-
Methods inherited from class it.unibo.alchemist.model.geometry.Shape
getCentroid, getDiameter, getRadius, intersects, transformed
-
Methods inherited from class it.unibo.alchemist.model.geometry.ConvexPolygon
contains, edges, getEdge, intersects, vertices
-
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
-
liesOnBoundary
Boolean liesOnBoundary(Euclidean2DPosition vector)
Checks if a vector (= a point) lies on the polygon's boundary.
- Parameters:
vector
- the vector (= point)
-
containsBoundaryIncluded
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
Boolean containsBoundaryExcluded(Euclidean2DPosition vector)
Checks if a vector (= a point) is contained in the polygon, boundary excluded.
- Parameters:
vector
- the vector (= point)
-
contains
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
-
isAdjacentTo
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
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
-
intersects
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
-
-
-
-