-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.implementations.geometry.AwtShapeCompatible,it.unibo.alchemist.model.interfaces.geometry.ConvexGeometricShape,it.unibo.alchemist.model.interfaces.geometry.GeometricShape,it.unibo.alchemist.model.interfaces.geometry.euclidean2d.ConvexPolygon,java.io.Serializable
public abstract class AbstractConvexPolygon implements ConvexPolygon
An abstract ConvexPolygon providing a convexity test.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classAbstractConvexPolygon.Companion
-
Constructor Summary
Constructors Constructor Description AbstractConvexPolygon()
-
Method Summary
Modifier and Type Method Description abstract Euclidean2DPositiongetCentroid()abstract DoublegetDiameter()DoublegetRadius()BooleanliesOnBoundary(Euclidean2DPosition vector)Checks if a vector (= a point) lies on the polygon's boundary. BooleancontainsBoundaryIncluded(Euclidean2DPosition vector)Checks if a vector (= a point) is contained in the polygon or lies on its boundary. BooleancontainsBoundaryExcluded(Euclidean2DPosition vector)Checks if a vector (= a point) is contained in the polygon, boundary excluded. Booleancontains(Shape shape)Checks if the polygon contains a polygonal java.awt.Shape (i.e. BooleanisAdjacentTo(ConvexPolygon other)A polygon is adjacent to another if any of its points lies on the boundary of the other. Booleanintersects(Segment2D<Euclidean2DPosition> segment)Checks if a segment intersects with the polygon, segments lying on the polygon's boundary are not considered to be intersecting. Segment2D<Euclidean2DPosition>closestEdgeTo(Segment2D<Euclidean2DPosition> segment)Finds the edge of the polygon closest to the provided segment, i.e. StringtoString()-
Methods inherited from class it.unibo.alchemist.model.implementations.geometry.euclidean2d.AbstractConvexPolygon
contains, edges, getEdge, intersects, vertices -
Methods inherited from class it.unibo.alchemist.model.interfaces.geometry.ConvexGeometricShape
intersects, transformed -
Methods inherited from class it.unibo.alchemist.model.interfaces.geometry.euclidean2d.ConvexPolygon
asAwtShape -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getCentroid
abstract Euclidean2DPosition getCentroid()
-
getDiameter
abstract Double getDiameter()
-
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
-
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
-
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
-
-
-
-