data class Vector2D: AbstractPoint2D

Represents a vector in two-dimensional space.

Fields

Name Description
val norm: /** L_2 norm of the vector */

L_2 norm of the vector

val x: Double

x component (abscissa) of the vector

val y: Double

y component (ordinate) of the vector

Constructors

<init>

constructor(v: Pair<Double, Double>)

Parameters

Name Description
v: Pair<Double, Double>

<init>

constructor(x: Double, y: Double)

Represents a vector in two-dimensional space.

Parameters

Name Description
x: Double

x component (abscissa) of the vector

y: Double

y component (ordinate) of the vector

Methods

plus

operator fun plus(v: Vector2D): (v: Vector2D)

Parameters

Name Description
v: Vector2D

ReturnValue

Name Description
(v: Vector2D)

minus

operator fun minus(v: Vector2D): (v: Vector2D)

Parameters

Name Description
v: Vector2D

ReturnValue

Name Description
(v: Vector2D)

times

operator fun times(m: Double): Vector2D

Parameters

Name Description
m: Double

ReturnValue

Name Description
Vector2D

div

operator fun div(m: Double): Vector2D

Parameters

Name Description
m: Double

ReturnValue

Name Description
Vector2D

unaryPlus

operator fun unaryPlus(): Vector2D

ReturnValue

Name Description
Vector2D

unaryMinus

operator fun unaryMinus(): Vector2D

ReturnValue

Name Description
Vector2D

scalarMultiply

fun scalarMultiply(factor: Double): Vector2D

Returns the scalar product of this with the factor.

Parameters

Name Description
factor: Double

ReturnValue

Name Description
Vector2D

scalarDivide

fun scalarDivide(divisor: Double): Vector2D

Returns the scalar division of this with the divisor.

Parameters

Name Description
divisor: Double

ReturnValue

Name Description
Vector2D

dotProduct

fun dotProduct(other: Vector2D): Double

Returns the dot product of this with the other.

Parameters

Name Description
other: Vector2D

ReturnValue

Name Description
Double

normalized

fun normalized(): Vector2D

Returns the normalized vector.

ReturnValue

Name Description
Vector2D

angle

fun angle(other: Vector2D): Rotation2D

Returns the angle between the other vector and this vector.

Parameters

Name Description
other: Vector2D

ReturnValue

Name Description
Rotation2D

distance

fun distance(other: Vector2D): Double

Returns the distance between the other vector and this vector.

Parameters

Name Description
other: Vector2D

ReturnValue

Name Description
Double

toVector3D

fun toVector3D(z: Double): Vector3D

Parameters

Name Description
z: Double

ReturnValue

Name Description
Vector3D

toVector2DCm

fun toVector2DCm(): this._vector2D

ReturnValue

Name Description
this._vector2D

toVector2DJOML

fun toVector2DJOML(): JOMLVector2D(this.x, this.y)

ReturnValue

Name Description
JOMLVector2D(this.x, this.y)

CompanionObject

Vector2D

data class Vector2D: AbstractPoint2D

Represents a vector in two-dimensional space.

Fields

Name Description
val ZERO: Vector2D
val X_AXIS: Vector2D
val Y_AXIS: Vector2D