Polygon

data class Polygon<T : Number, Comparable<T>>(val vertices: List<<Error class: unknown class><T>>, val type: KClass<T>) : Shape<T>

2D polygon with given vertices.

Since

v2.0.0

Constructors

Link copied to clipboard
constructor(vertices: List<<Error class: unknown class><T>>, type: KClass<T>)

Functions

Link copied to clipboard
open operator override fun contains(point: <Error class: unknown class><T>): Boolean

Returns true if given point is inside this polygon.

Link copied to clipboard
open override fun distanceTo(point: <Error class: unknown class><T>): T

Returns the distance between this polygon and the given point.

Link copied to clipboard
open infix override fun intersects(circle: Circle<T>): Boolean

Returns true if given circle intersects this circle.

open infix override fun intersects(polygon: Polygon<T>): Boolean

Returns true if given polygon intersects this polygon.

open infix override fun intersects(section: Section2<T>): Boolean

Returns true if given section intersects this polygon.

open infix override fun intersects(other: Shape<T>): Boolean

Returns true if given other shape intersects this polygon.

open infix fun intersects(rectangle: Rectangle<T>): Boolean

Returns true if given rectangle intersects this shape.

Link copied to clipboard
operator fun minus(vertex: <Error class: unknown class><T>): Polygon<T>

Returns a polygon composed of all vertices of this polygon except a given vertex.

Link copied to clipboard
operator fun plus(vertex: <Error class: unknown class><T>): Polygon<T>

Returns a polygon composed of all vertices of this polygon and a given vertex added at the end.

Link copied to clipboard

Returns the same polygon, but with vertices in reversed order.

Link copied to clipboard
open override fun rotate(angle: <Error class: unknown class><T>): Polygon<T>

Returns this polygon rotated by given angle around origin point.

open override fun rotate(angle: <Error class: unknown class><T>, pivot: <Error class: unknown class><T>): Polygon<T>

Returns this polygon rotated by given angle around given pivot point.

Link copied to clipboard
open override fun scale(scale: T): Polygon<T>

Returns this polygon scaled by given scale value relative to origin point.

open override fun scale(scale: T, center: <Error class: unknown class><T>): Polygon<T>

Returns this polygon scaled by given scale value relative to given center point.

Link copied to clipboard
fun transform(matrix: <Error class: unknown class><T>): Polygon<T>

Returns this polygon transformed using given matrix.

Link copied to clipboard
open override fun translate(vector: <Error class: unknown class><T>): Polygon<T>

Returns this polygon translated by given vector.

Properties

Link copied to clipboard
open override val boundingBox: Rectangle<T>

Bounding box of this polygon.

Link copied to clipboard

Edges of this polygon.

Link copied to clipboard
open override val midpoint: <Error class: unknown class><T>

Midpoint of this polygon.

Link copied to clipboard
open override val type: KClass<T>

Type of coordinates in this polygon.

Link copied to clipboard
val vertices: List<<Error class: unknown class><T>>

Vertices of this polygon.