Logo FS-Skia-UI

Wrap Module

Functions and values

Function or value Description

wrapDeltaX worldWidth fromX toX

Full Usage: wrapDeltaX worldWidth fromX toX

Parameters:
    worldWidth : float
    fromX : float
    toX : float

Returns: float

Shortest wrap-aware delta from `fromX` to `toX` on a toroidal axis of width `worldWidth` (> 0). Result is the signed distance of least magnitude in (-worldWidth/2, worldWidth/2]. Pure and deterministic; identity `wrapDeltaX w a a = 0`; e.g. `wrapDeltaX 100 90 10 = 20`, `wrapDeltaX 100 10 90 = -20`.

worldWidth : float
fromX : float
toX : float
Returns: float

Type something to start searching.