Vector2

interface Vector2<V : Vector2<V>> : Vector<V> (source)

This interface represents a vector in two-dimensional space.

Parameters

V

The type of the vector that implements this interface.

See also

Inheritors

Properties

Link copied to clipboard
abstract val x: Double

The x component of the vector.

Link copied to clipboard
abstract val y: Double

The y component of the vector.

Functions

Link copied to clipboard
open override fun angle(other: V, angleUnit: AngleUnit): Double

Calculate the angle between this vector and another vector.

Link copied to clipboard
open fun computeScaleFactor(other: Vector2<*>): Double

Calculates the scale factor to project this vector onto another vector.

Link copied to clipboard
open override fun dimensions(): Int

Returns the number of dimensions of the spatial object.

Link copied to clipboard
open infix override fun distance(other: V): Double

Compute the distance to another point.

Link copied to clipboard
open infix override fun dot(other: V): Double

Calculate the dot product of this vector with another vector.

Link copied to clipboard
open fun eq(other: Vector2<*>, equivalence: DoubleEquivalence = DEFAULT_DOUBLE_EQUIVALENCE): Boolean

Tests if two vectors are approximately equal.

Link copied to clipboard
open override fun isFinite(): Boolean

Returns true if all values in the spatial are finite.

Link copied to clipboard
open override fun isInfinite(): Boolean

Returns true if any value in the spatial is infinite.

Link copied to clipboard
open override fun isNaN(): Boolean

Returns true if any value in the spatial is NaN (Not a Number).

Link copied to clipboard
open fun lerp(other: Vector2<*>, t: Double): V

Performs linear interpolation between this vector and another vector.

Link copied to clipboard
abstract operator fun minus(other: V): V

Subtracts another vector from this vector.

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

Calculates the norm (magnitude) of the vector.

Link copied to clipboard
open override fun normalize(): V

Normalizes the vector.

Link copied to clipboard
abstract operator fun plus(other: V): V

Adds another vector to this vector.

Link copied to clipboard
open fun project(base: Vector2<*>): V

Calculate the projection of this vector onto another vector.

Link copied to clipboard
open fun reject(base: Vector2<*>): V

Calculates the rejection of this vector from another vector.

Link copied to clipboard
open fun signedArea(other: Vector2<*>): Double

Computes the signed area of the parallelogram formed by this vector and another vector.

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

Scale this vector by a scalar value.

Link copied to clipboard
abstract operator fun unaryMinus(): V

Negates the vector, flipping its direction.

Link copied to clipboard
abstract fun withComponents(x: Double, y: Double): V

Creates a vector with the specified components.

Link copied to clipboard
abstract fun zero(): V

Get Zero vector.