Vector3D

interface Vector3D

A three-dimensional vector with an x, y and z component.

Author

Nicholas Eddy

Inheritors

Types

Link copied to clipboard
object Companion

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 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
open operator fun div(value: Double): Vector3D
open operator fun div(value: Float): Vector3D
open operator fun div(value: Int): Vector3D

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

Link copied to clipboard
abstract fun magnitude(): Double

Gets the vector's length

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

open operator fun times(value: Double): Vector3D
open operator fun times(value: Float): Vector3D
open operator fun times(value: Int): Vector3D

Calculates the scalar product of this vector and a value.

Link copied to clipboard
open operator fun unaryMinus(): Vector3D

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