alchemist-interfaces / it.unibo.alchemist.model.interfaces / Position

Position

interface Position<P : Position<P>> : Serializable

An interface to represent a generic coordinates system.

Parameters

Properties

cartesianCoordinates

Allows to get the position as a Number array.

abstract val cartesianCoordinates: DoubleArray

dimensions

abstract val dimensions: Int

Functions

boundingBox

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 two dimensional coordinates, it must return the opposite vertices of the square circumscribing the circle with center in this position and radius range.

abstract fun boundingBox(range: Double): MutableList<out P>

getCoordinate

Allows to access the value of a coordinate.

abstract fun getCoordinate(dim: Int): Double

getDistanceTo

Computes the distance between this position and another compatible position.

abstract fun getDistanceTo(p: P): Double

minus

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

abstract operator fun minus(other: P): P

plus

Considers both positions as vectors, and sums them.

abstract operator fun plus(other: P): P

Inheritors

Position2D

A bidimensional position.

interface Position2D<P : Position2D<P>> : Position<P>