MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / diffToNearestCoordInBox

Method diffToNearestCoordInBox

source/base/StarWorldGeometry.cpp:349–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349Vec2F WorldGeometry::diffToNearestCoordInBox(RectF const& box, Vec2F const& pos) const {
350 RectF t(box);
351 auto offset = t.center();
352 auto r = diff(pos, offset);
353 t.setCenter({});
354 auto coord = t.nearestCoordTo(r) + offset;
355 return diff(pos, coord);
356}
357
358}

Callers 2

interactiveEntityNearMethod · 0.80
getInteractiveInRangeFunction · 0.80

Calls 3

nearestCoordToMethod · 0.80
centerMethod · 0.45
setCenterMethod · 0.45

Tested by

no test coverage detected