summaryrefslogtreecommitdiffhomepage
path: root/tracker-wii/wii_point_extractor.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-04-14 05:43:05 +0200
committerStanislaw Halik <sthalik@misaki.pl>2019-04-14 06:30:05 +0200
commit30378f88294c81bfc00b23cadfd7e292f29d8fe6 (patch)
tree0ef6946ee1b00b46c8f83d0702682b67eda02642 /tracker-wii/wii_point_extractor.cpp
parentfd8df2acc588fabc6022664f292b6353b2b7bf07 (diff)
tracker/wii: appease clang-tidy
Diffstat (limited to 'tracker-wii/wii_point_extractor.cpp')
-rw-r--r--tracker-wii/wii_point_extractor.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/tracker-wii/wii_point_extractor.cpp b/tracker-wii/wii_point_extractor.cpp
index 553abdab..393dc1c9 100644
--- a/tracker-wii/wii_point_extractor.cpp
+++ b/tracker-wii/wii_point_extractor.cpp
@@ -35,8 +35,8 @@ void WIIPointExtractor::draw_point(cv::Mat& preview_frame, const vec2& p, const
{
static constexpr int len = 9;
- cv::Point p2(iround(p[0] * preview_frame.cols + preview_frame.cols / 2),
- iround(-p[1] * preview_frame.cols + preview_frame.rows / 2));
+ cv::Point p2(iround(p[0] * preview_frame.cols + preview_frame.cols / 2.f),
+ iround(-p[1] * preview_frame.cols + preview_frame.rows / 2.f));
cv::line(preview_frame,
cv::Point(p2.x - len, p2.y),
@@ -52,12 +52,12 @@ void WIIPointExtractor::draw_point(cv::Mat& preview_frame, const vec2& p, const
bool WIIPointExtractor::draw_points(cv::Mat& preview_frame, const struct wii_info& wii, std::vector<vec2>& points)
{
- const float W = 1024.0f;
- const float H = 768.0f;
+ constexpr int W = 1024;
+ constexpr int H = 768;
points.reserve(4);
points.clear();
- for (unsigned index = 0; index < 4; index++)
+ for (unsigned index = 0; index < 4; index++) // NOLINT(modernize-loop-convert)
{
const struct wii_info_points &dot = wii.Points[index];
if (dot.bvis) {
@@ -80,18 +80,18 @@ bool WIIPointExtractor::draw_points(cv::Mat& preview_frame, const struct wii_inf
return success;
}
-void WIIPointExtractor::_draw_bg(cv::Mat& preview_frame, const struct wii_info &wii)
+void WIIPointExtractor::draw_bg(cv::Mat& preview_frame, const struct wii_info& wii)
{
//draw battery status
- cv::line(preview_frame,
- cv::Point(0, 0),
- cv::Point(preview_frame.cols*wii.BatteryPercent / 100, 0),
- (wii.bBatteryDrained ? cv::Scalar(255, 0, 0) : cv::Scalar(0, 140, 0)),
- 2);
+ cv::line(preview_frame,
+ cv::Point(0, 0),
+ cv::Point(preview_frame.cols*wii.BatteryPercent / 100, 0),
+ (wii.bBatteryDrained ? cv::Scalar(255, 0, 0) : cv::Scalar(0, 140, 0)),
+ 2);
//draw horizon
- int pdelta = iround((preview_frame.rows / 4) * tan((wii.Pitch)* M_PI / 180.0f));
- int rdelta = iround((preview_frame.cols / 4) * tan((wii.Roll)* M_PI / 180.0f));
+ int pdelta = iround(preview_frame.rows / 4.f * tan(wii.Pitch * pi / 180.f));
+ int rdelta = iround(preview_frame.cols / 4.f * tan(wii.Roll* pi / 180.f));
cv::line(preview_frame,
cv::Point(0, preview_frame.rows / 2 + rdelta - pdelta),