API Reference › IVec2 › IVec2.distance2
method

IVec2.distance2

IVec2.distance2(a, b) -> int

dx*dx + dy*dy — compare it against a squared radius to avoid a square root.

Example

# doc-check: skip — illustrative
if IVec2.distance2(hero, foe) < 24 * 24 { … }
← All symbols