| License | BSD-3-Clause |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Swarm.Game.Scenario.Topography.Navigation.Util
Description
Documentation
orientationBasedRelativePosition :: Robot -> Cosmic Location -> Maybe (V2 Int32) Source #
Computes the relative offset vector between a Robot and a Location
(presumed to be in the same subworld, though the contrary will
not result in failure), then re-interpret that vector based on the
Robot's current orientation.
If the robot is not oriented in a cardinal direction, returns Nothing.
Re-orientation semantics
Given a displacement vector (x, y) where:
- positive
x-coordinate representseast - negative
x-coordinate representswest - positive
y-coordinate representsnorth - negative
y-coordinate representssouth
the re-interpreted vector (x', y') becomes:
- positive
x'-coordinate representsright - negative
x'-coordinate representsleft - positive
y'-coordinate representsforward - negative
y'-coordinate representsback