Skip to content

Commit ecb07d7

Browse files
authored
Fix bugs in setAngleInRangeZeroTwoPi (#2011)
The function would compute the angle modulo 360, not 2pi as the function's name promises. Additionally, [fmod](https://en.cppreference.com/w/cpp/numeric/math/fmod) returns negative values if the argument is negative, which we also don't want. This can be fixed by adding 2pi to the argument - assuming the angle is not lower than -2pi.
1 parent b1cb2b6 commit ecb07d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/openpose/calibration/cameraParameterEstimation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ namespace op
196196
try
197197
{
198198
// Return angle in range [0,2pi)
199-
return std::fmod(angle, 360); // floating-point remainder
199+
return std::fmod(angle + 2 * PI, 2 * PI); // floating-point remainder
200200
// double result{angle};
201201

202202
// Return angle in range [0,2pi)

0 commit comments

Comments
 (0)