alchemist-interfaces / it.unibo.alchemist.model.interfaces / Environment2DWithObstacles / next

next

abstract fun next(ox: Double, oy: Double, nx: Double, ny: Double): P

This method must calculate the RELATIVE 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 [0.5,0.5], so it's the relative movement considering the starting position as origin.

Parameters

ox - Double: The current X position

oy - Double: The current Y position

nx - Double: The requested X position

ny - Double: The requested Y position

Return
P: the next allowed position, where the node can actually move. This position MUST be considered as a vector whose start point is in [ox, oy].