Point2D

@Serializable
value class Point2D(val coordinates: Pair<Double, Double>)

A 2D point represented as a pair of x and y.

Constructors

Link copied to clipboard
constructor(coordinates: Pair<Double, Double>)

Properties

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

Functions

Link copied to clipboard
operator fun component1(): Double

The x coordinate.

Link copied to clipboard
operator fun component2(): Double

The y coordinate.

Link copied to clipboard

The distance from this Point2D to another Point2D.

Link copied to clipboard
operator fun div(scalar: Double): Point2D

The division of a Point2D coordinate by a scalar.

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

The difference of two Point2D coordinates.

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

The sum of two Point2D coordinates.

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

The product of a Point2D coordinate and a scalar.

Link copied to clipboard
operator fun unaryMinus(): Point2D

The negation of a Point2D coordinate.

Link copied to clipboard
operator fun unaryPlus(): Point2D

The unary plus of a Point2D coordinate.