Point

sealed interface Point : Vector3D

A two-dimensional vector with an x and y component.

Author

Nicholas Eddy

Types

Link copied to clipboard
object Companion

Inherited properties

Link copied to clipboard
abstract val x: Double

x position

Link copied to clipboard
abstract val y: Double

y position

Link copied to clipboard
abstract val z: Double

z position

Functions

Link copied to clipboard
abstract fun as3d(): Vector3D
Link copied to clipboard
open infix fun distanceFrom(other: Vector2D): Double

Calculates the euclidean distance between two points.

Link copied to clipboard
abstract operator override fun div(value: Double): Vector2D
abstract operator override fun div(value: Float): Vector2D
abstract operator override fun div(value: Int): Vector2D

Calculates the scalar product of this vector and the inverse of a value.

Link copied to clipboard
open override fun magnitude(): Double

Gets the vector's length

Link copied to clipboard
open operator fun minus(other: Vector2D): Vector2D

Calculates the vector difference of two vectors.

Link copied to clipboard
open operator fun plus(other: Vector2D): Vector2D

Calculates the vector sum of two vectors.

Link copied to clipboard
abstract operator override fun times(value: Double): Vector2D
abstract operator override fun times(value: Float): Vector2D
abstract operator override fun times(value: Int): Vector2D

Calculates the scalar product of this vector and a value.

Link copied to clipboard
abstract operator override fun unaryMinus(): Vector2D

Performs a negation of this vector, resulting in a new vector with inverted x and y directions.

Inherited functions

Link copied to clipboard
abstract fun as2d(): Vector2D

Gets a 2D version of this vector

Link copied to clipboard
abstract infix fun cross(other: Vector3D): Vector3D

Computes the cross-product of the two vectors.

Link copied to clipboard
open infix fun distanceFrom(other: Vector3D): Double

Calculates the euclidean distance between two vectors.

Link copied to clipboard

Calculate the interior angle between 2 vectors =>angle := cos(α) = a·b / (|a|·|b|).

Link copied to clipboard
open operator fun minus(other: Vector3D): Vector3D

Calculates the vector difference of two vectors.

Link copied to clipboard
abstract fun normalize(): Vector3D

Gets a unit vector pointing in the same direction as this one, if (and only if) the vector's length is not 0. Otherwise, the vector itself is returned.

Link copied to clipboard
open operator fun plus(other: Vector3D): Vector3D

Calculates the vector sum of two vectors.

Link copied to clipboard
open operator fun times(other: Vector3D): Double

Computes the dot-product of the two vectors