AbstractEuclideanPosition

N-dimensional Euclidean position.

Parameters

copy

true if it is unsafe to store the coordinates array as-is.

coordinates

the array of coordinates.

Type Parameters

P

actual type

Inheritors

Properties

Link copied to clipboard
override val coordinates: DoubleArray

Allows to get the position as a Number array.

Link copied to clipboard
override val dimensions: Int
Link copied to clipboard
open val magnitude: Double

Finds the magnitude of a vector.

Link copied to clipboard
open val zero: P

Origin.

Functions

Link copied to clipboard
open fun angleBetween(other: P): Double

Computes the angle in radians between two vectors.

Link copied to clipboard
override fun boundingBox(range: Double): List<P>

Given a range, produces N coordinates, representing the N opposite vertices of the hypercube having the current coordinate as center and circumscribing the N-sphere defined by the range. In the case of bidimensional coordinates, it must return the opposite vertices of the square circumscribing the circle with center in this position and radius range.

Link copied to clipboard
open fun coerceAtLeast(minimumMagnitude: Double): P
Link copied to clipboard
open fun coerceAtMost(maximumMagnitude: Double): P
Link copied to clipboard
open fun coerceIn(minimumMagnitude: Double, maximumMagnitude: Double): P

Performs a coercion at least and at most.

Link copied to clipboard
override fun distanceTo(other: P): Double

Computes the distance between this position and another compatible position.

Link copied to clipboard
open operator fun div(other: Double): P

Division by a Double.

Link copied to clipboard
open fun dot(other: P): Double

Computes the dot product between two vectors.

Link copied to clipboard
operator override fun equals(other: Any?): Boolean
Link copied to clipboard
abstract fun fromCoordinates(coordinates: DoubleArray): P

Builds a new Vector from the provided coordinates.

Link copied to clipboard
operator override fun get(dimension: Int): Double

Allows to access the value of a coordinate.

Link copied to clipboard
override fun hashCode(): Int
Link copied to clipboard
operator fun minus(other: P): P

Same as minus, with the internal representation of other.

operator override fun minus(other: DoubleArray): P

Considers both positions as vectors, and returns the difference between this position and the passed one.

Link copied to clipboard
abstract fun normal(): P

Find the normal of a vector.

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

Same as plus, with the internal representation of other.

operator override fun plus(other: DoubleArray): P

Considers both positions as vectors, and sums them.

Link copied to clipboard
open fun resized(newLen: Double): P
Link copied to clipboard
abstract operator fun times(other: Double): P

Multiplication by a Double.

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

Prints the coordinates.