AwtMutableConvexPolygon

MutableConvexPolygon partly delegated to AwtEuclidean2DShape and java.awt.geom. Each modification operation on this object has a time complexity of O(n), where n is the number of vertices/edges. Collinear points are allowed.

Inheritors

Constructors

Link copied to clipboard
constructor(vertices: MutableList<Euclidean2DPosition>)

Properties

Link copied to clipboard
open override val centroid: Euclidean2DPosition
Link copied to clipboard
open override val diameter: Double
Link copied to clipboard
open val radius: Double

Functions

Link copied to clipboard
open override fun addVertex(index: Int, x: Double, y: Double): Boolean

Adds a vertex to the polygon.

Link copied to clipboard
override fun asAwtShape(): Shape
Link copied to clipboard

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.

Link copied to clipboard
open override fun contains(shape: Shape): Boolean

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.

open override fun contains(vector: Euclidean2DPosition): Boolean

Delegated to AwtEuclidean2DShape (adopts the definition of insideness used by java.awt.Shapes).

Link copied to clipboard

Checks if a vector (= a point) is contained in the polygon, boundary excluded.

Link copied to clipboard

Checks if a vector (= a point) is contained in the polygon or lies on its boundary.

Link copied to clipboard
open override fun edges(): List<Segment2D<Euclidean2DPosition>>
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun getEdge(index: Int): Segment2DImpl<Euclidean2DPosition>
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun intersects(segment: Segment2D<Euclidean2DPosition>): Boolean

Checks if a segment intersects with the polygon, segments lying on the polygon's boundary are not considered to be intersecting.

open override fun intersects(other: Euclidean2DShape): Boolean

Delegated to AwtEuclidean2DShape unless other is AwtShapeCompatible, in which case intersects is used so as to guarantee maximum accuracy.

open override fun intersects(shape: Shape): Boolean

Delegated to java.awt.geom.Area, this is accurate and does not consider adjacent shapes to be intersecting.

Link copied to clipboard
open override fun isAdjacentTo(other: ConvexPolygon): Boolean

A polygon is adjacent to another if any of its points lies on the boundary of the other.

Link copied to clipboard
open override fun liesOnBoundary(vector: Euclidean2DPosition): Boolean

Checks if a vector (= a point) lies on the polygon's boundary.

Link copied to clipboard
open override fun moveVertex(index: Int, newX: Double, newY: Double): Boolean

Moves a vertex of the polygon to a new absolute position.

Link copied to clipboard
open override fun removeVertex(index: Int): Boolean

Removes a vertex from the polygon.

Link copied to clipboard
open override fun replaceEdge(index: Int, newEdge: Segment2D<Euclidean2DPosition>): Boolean

Replaces an edge of the polygon.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
Link copied to clipboard
open override fun vertices(): List<Euclidean2DPosition>