Point2D

data class Point2D(val x: Double, val y: Double)(source)

Constructors

Link copied to clipboard
constructor(x: Double, y: Double)

Properties

Link copied to clipboard
val x: Double
Link copied to clipboard
val y: Double

Functions

Link copied to clipboard
infix fun angleTo(point: Point2D): Double

Returns the angle formed by the vector from the origin to this point and the vector from the origin to the specified point. The angle is measured in radians and is in the range 0, π.

Link copied to clipboard

Combines the coordinates of this point and another point into a single array. The resulting array contains the x and y coordinates of this point followed by the x and y coordinates of the other point, in that order.

Link copied to clipboard
operator fun plus(other: Point2D): Point2D

Adds the coordinates of this point and the other point, returning a new Point2D.

Link copied to clipboard
operator fun times(factor: Double): Point2D
operator fun times(factor: Int): Point2D

Multiplies the coordinates of this point by the given factor.

Link copied to clipboard

Transforms this point by applying the given affine transformation matrix. The transformation applies the matrix multiplication to the point's coordinates treating the point as a homogeneous coordinate vector [x, y, 1].