ImageEnvironmentWithGraph

class ImageEnvironmentWithGraph<T> @JvmOverloads constructor(incarnation: Incarnation<T, Euclidean2DPosition>, path: String, zoom: Double, dx: Double, dy: Double, obstaclesColor: Int, roomsColor: Int) : ImageEnvironment<T> , EuclideanPhysics2DEnvironmentWithGraph<RectObstacle2D<Euclidean2DPosition>, T, ConvexPolygon, Euclidean2DPassage>

An ImageEnvironment providing an Euclidean2DNavigationGraph. The NaviGator algorithm is used to produce such graph (see generateNavigationGraph). The positions where to plant initial seeds should be specified directly in the image, marking each area of the environment with one or more pixels of a given color (defaults to blue).

Constructors

Link copied to clipboard
fun <T> ImageEnvironmentWithGraph(incarnation: Incarnation<T, Euclidean2DPosition>, path: String, zoom: Double = 1.0, dx: Double = 0.0, dy: Double = 0.0, obstaclesColor: Int = Color.BLACK.rgb, roomsColor: Int = Color.BLUE.rgb)

Functions

Link copied to clipboard
abstract fun addLayer(p0: Molecule, p1: Layer<T, Euclidean2DPosition>)
Link copied to clipboard
abstract fun addNode(p0: Node<T>, p1: Euclidean2DPosition)
Link copied to clipboard
override fun addObstacle(@Nonnull obstacle: RectObstacle2D<Euclidean2DPosition>)
Link copied to clipboard
abstract fun addTerminator(p0: Predicate<Environment<T, Euclidean2DPosition>>)
Link copied to clipboard
open override fun computeActualInsertionPosition(p0: Node<T>, p1: Euclidean2DPosition): Euclidean2DPosition
Link copied to clipboard
open override fun farthestPositionReachable(node: NodeWithShape<T, *, *>, desiredPosition: Euclidean2DPosition, hitboxRadius: Double): Euclidean2DPosition

node.canFit must be true for the returned position. For a better understanding of how to compute collision points with circular hitboxes see this discussion.

Link copied to clipboard
open fun findMarkedRegions(color: Int, img: BufferedImage): MutableList<RectObstacle2D<Euclidean2DPosition>>
Link copied to clipboard
open fun forEach(p0: Consumer<in Node<T>>)
Link copied to clipboard
abstract fun getDimensions(): Int
Link copied to clipboard
abstract fun getDistanceBetweenNodes(p0: Node<T>, p1: Node<T>): Double
Link copied to clipboard
open override fun getHeading(node: Node<T>): Euclidean2DPosition

Gets the heading of a node as a direction vector.

Link copied to clipboard
abstract fun getIncarnation(): Optional<Incarnation<T, Euclidean2DPosition>>
Link copied to clipboard
abstract fun getLayer(p0: Molecule): Optional<Layer<T, Euclidean2DPosition>>
Link copied to clipboard
abstract fun getLayers(): ListSet<Layer<T, Euclidean2DPosition>>
Link copied to clipboard
abstract fun getLinkingRule(): LinkingRule<T, Euclidean2DPosition>
Link copied to clipboard
abstract fun getNeighborhood(p0: Node<T>): Neighborhood<T>
Link copied to clipboard
abstract fun getNodeByID(p0: Int): Node<T>
Link copied to clipboard
abstract fun getNodeCount(): Int
Link copied to clipboard
abstract fun getNodes(): ListSet<Node<T>>
Link copied to clipboard
open override fun getNodesWithin(shape: Euclidean2DShape): List<Node<T>>

Gets all nodes whose shape.intersect is true for the given shape.

Link copied to clipboard
abstract fun getNodesWithinRange(p0: Euclidean2DPosition, p1: Double): ListSet<Node<T>>
abstract fun getNodesWithinRange(p0: Node<T>, p1: Double): ListSet<Node<T>>
Link copied to clipboard
override fun getObstaclesInRange(@Nonnull center: Euclidean2DPosition, range: Double): List<RectObstacle2D<Euclidean2DPosition>>
override fun getObstaclesInRange(centerx: Double, centery: Double, range: Double): List<RectObstacle2D<Euclidean2DPosition>>

Given a point and a range, retrieves all the obstacles within.

Link copied to clipboard
abstract fun getOffset(): DoubleArray
Link copied to clipboard
abstract fun getPosition(p0: Node<T>): Euclidean2DPosition
Link copied to clipboard
open override fun getShape(node: Node<T>): Euclidean2DShape

Gets the shape of a node relatively to its position and heading in the environment.

Link copied to clipboard
abstract fun getSimulation(): Simulation<T, Euclidean2DPosition>
Link copied to clipboard
abstract fun getSize(): DoubleArray
Link copied to clipboard
abstract fun getSizeInDistanceUnits(): DoubleArray
Link copied to clipboard
open override fun hasMobileObstacles(): Boolean
Link copied to clipboard
fun ifEngineAvailable(p0: Consumer<Simulation<T, Euclidean2DPosition>>)
Link copied to clipboard
fun includeObject(p0: Euclidean2DPosition)
fun includeObject(p0: Double, p1: Double, p2: Double, p3: Double)
Link copied to clipboard
override fun intersectsObstacle(start: Euclidean2DPosition, end: Euclidean2DPosition): Boolean
Link copied to clipboard
override fun isAllowed(p: Euclidean2DPosition): Boolean

Checks whether a position is allowed to be occupied by a node in this environment.

Link copied to clipboard
abstract fun isTerminated(): Boolean
Link copied to clipboard
abstract operator override fun iterator(): MutableIterator<Node<T>>
Link copied to clipboard
open override fun makePosition(vararg coordinates: Number): Euclidean2DPosition

Creates an euclidean position from the given coordinates.

open override fun makePosition(vararg coordinates: Double): Euclidean2DPosition
open fun makePosition(x: Double, y: Double): Euclidean2DPosition

Creates a new Euclidean2DPosition.

Link copied to clipboard
open fun moveNode(node: Node<T>, direction: Euclidean2DPosition)
Link copied to clipboard
open override fun moveNodeToPosition(node: Node<T>, newPosition: Euclidean2DPosition)

Moves the node to the farthestPositionReachable towards the desired newPosition. If the node is shapeless, it is simply moved to newPosition.

Link copied to clipboard
override fun next(@Nonnull current: Euclidean2DPosition, @Nonnull desired: Euclidean2DPosition): Euclidean2DPosition

override fun next(ox: Double, oy: Double, nx: Double, ny: Double): Euclidean2DPosition

This method must calculate the ABSOLUTE next allowed position given the current position and the position in which the node wants to move. For example, if your node is in position [2,3], wants to move to [3,4] but the next allowed position (because, e.g., of physical obstacles) is [2.5,3.5], the result must be a Position containing coordinates [2.5,3.5].

Link copied to clipboard
open override fun nodeShouldBeAdded(node: Node<T>, position: Euclidean2DPosition): Boolean

A node should be added only if it doesn't collide with already existing nodes and fits in the environment's limits.

Link copied to clipboard
abstract fun removeNode(p0: Node<T>)
Link copied to clipboard
override fun removeObstacle(@Nonnull obstacle: RectObstacle2D<Euclidean2DPosition>): Boolean
Link copied to clipboard
open override fun setHeading(node: Node<T>, direction: Euclidean2DPosition)

Sets the heading of a node.

Link copied to clipboard
abstract fun setLinkingRule(p0: LinkingRule<T, Euclidean2DPosition>)
Link copied to clipboard
fun setPosition(p0: Node<T>, p1: Euclidean2DPosition)
Link copied to clipboard
abstract fun setSimulation(p0: Simulation<T, Euclidean2DPosition>)
Link copied to clipboard
open fun spliterator(): Spliterator<Node<T>>
Link copied to clipboard
fun updateNeighborhood(p0: Node<T>, p1: Boolean)

Properties

Link copied to clipboard
open override val graph: Euclidean2DNavigationGraph
Link copied to clipboard
@get:Nonnull
override val obstacles: List<RectObstacle2D<Euclidean2DPosition>>
Link copied to clipboard
open override val origin: Euclidean2DPosition
Link copied to clipboard
open override val shapeFactory: Euclidean2DShapeFactory

A factory of shapes compatible with this environment.