DoubleXY

data class DoubleXY(val x: Double, val y: Double)

Represents a two-dimensional point or vector of doubles

Since

200.0.0

Parameters

x

The x value.

y

The y value.

Constructors

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

Types

Link copied to clipboard
object Companion

This makes it possible to add extensions to the DoubleXY companion e.g. for defining common vector constants.

Properties

Link copied to clipboard

a DoubleXY with each co-ordinate set to the absolute value of its current value.

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

Functions

Link copied to clipboard
operator fun div(divisor: Double): DoubleXY

Divides this DoubleXY x and y values by divisor and returns the result.

Link copied to clipboard
fun length(): Double

Return the Euclidean distance from (0,0) to the point at (x,y).

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

Subtracts other by subtracting its other.x from x and other.y from y and returns the result.

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

Adds other by adding this.x to other.x and this.y to other.y and returns the result.

Link copied to clipboard
open override fun toString(): String

Returns a string representation of the object.