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

Method getBounds

src/fl/math/screenmap.cpp.hpp:527–554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525float ScreenMap::getDiameter() const { return mDiameter; }
526
527vec2f ScreenMap::getBounds() const {
528
529 if (length == 0 || !mLookUpTable) {
530 return {0, 0};
531 }
532
533 LUTXYFLOAT &lut = *mLookUpTable.get();
534
535 fl::vec2f *data = lut.getDataMutable();
536 // float minX = lut[0].x;
537 // float maxX = lut[0].x;
538 // float minY = lut[0].y;
539 // float maxY = lut[0].y;
540 float minX = data[0].x;
541 float maxX = data[0].x;
542 float minY = data[0].y;
543 float maxY = data[0].y;
544
545 for (u32 i = 1; i < length; i++) {
546 const vec2f &p = lut[i];
547 minX = fl::min(minX, p.x);
548 maxX = fl::max(maxX, p.x);
549 minY = fl::min(minY, p.y);
550 maxY = fl::max(maxY, p.y);
551 }
552
553 return {maxX - minX, maxY - minY};
554}
555
556const vec2f &ScreenMap::empty() {
557 static const vec2f s_empty = vec2f(0, 0); // okay static in header

Callers 2

FL_TEST_FILEFunction · 0.80
screenmap.cppFile · 0.80

Calls 3

maxFunction · 0.85
getDataMutableMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected