AbstractPosition

abstract class AbstractPosition<P : Position<P>> : Position<P>

N-dimensional 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

Functions

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
override fun distanceTo(other: P): Double

Computes the distance between this position and another compatible position.

Link copied to clipboard
operator override fun equals(other: Any?): Boolean
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
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 override fun toString(): String

Prints the coordinates.