1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-26 03:29:40 +00:00

Try a rolling average of 250 frames, subject to thresholding.

This commit is contained in:
Thomas Harte
2025-10-09 13:51:19 -04:00
parent 6c3048ffbf
commit 56f092a0c3
3 changed files with 38 additions and 29 deletions
+15
View File
@@ -88,6 +88,7 @@ struct Rect {
);
}
/// Scale towards the origin.
Rect operator /(const float multiplier) const {
return Rect(
origin.x / multiplier,
@@ -97,6 +98,7 @@ struct Rect {
);
}
/// Perform the union.
Rect operator |(const Rect &rhs) const {
const auto left = std::min(origin.x, rhs.origin.x);
const auto top = std::min(origin.y, rhs.origin.y);
@@ -108,6 +110,19 @@ struct Rect {
std::max(origin.y + size.height - top, rhs.origin.y + rhs.size.height - top)
);
}
/// Perform the intersection.
Rect operator &(const Rect &rhs) const {
const auto left = std::max(origin.x, rhs.origin.x);
const auto top = std::max(origin.y, rhs.origin.y);
return Rect(
left,
top,
std::min(origin.x + size.width - left, rhs.origin.x + rhs.size.width - left),
std::min(origin.y + size.height - top, rhs.origin.y + rhs.size.height - top)
);
}
};
enum class ColourSpace {