MCPcopy Create free account
hub / github.com/FastLED/FastLED / getLocalCoord

Method getLocalCoord

src/fl/stl/span.h:602–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

600 }
601
602 vec2<i32> getLocalCoord(i32 x_world, i32 y_world) const FL_NOEXCEPT {
603 // clamp to [mBottomLeft, mTopRight]
604 i32 x_clamped = fl::clamp(x_world, mBottomLeft.x, mTopRight.x);
605 i32 y_clamped = fl::clamp(y_world, mBottomLeft.y, mTopRight.y);
606 // convert to local
607 return {x_clamped - mBottomLeft.x, y_clamped - mBottomLeft.y};
608 }
609
610 // element access via (x,y)
611 T &operator()(i32 x, i32 y) FL_NOEXCEPT { return at(x, y); }

Callers 1

FL_TEST_FILEFunction · 0.80

Calls 1

clampFunction · 0.85

Tested by

no test coverage detected