Given an angle in radian, this method returns the corresponding angle in the range [-pi; pi]
| 717 | |
| 718 | // Given an angle in radian, this method returns the corresponding angle in the range [-pi; pi] |
| 719 | decimal SolveHingeJointSystem::computeNormalizedAngle(decimal angle) const { |
| 720 | |
| 721 | // Convert it into the range [-2*pi; 2*pi] |
| 722 | angle = std::fmod(angle, PI_TIMES_2); |
| 723 | |
| 724 | // Convert it into the range [-pi; pi] |
| 725 | if (angle < -PI_RP3D) { |
| 726 | return angle + PI_TIMES_2; |
| 727 | } |
| 728 | else if (angle > PI_RP3D) { |
| 729 | return angle - PI_TIMES_2; |
| 730 | } |
| 731 | else { |
| 732 | return angle; |
| 733 | } |
| 734 | } |
| 735 | |
| 736 | // Given an "inputAngle" in the range [-pi, pi], this method returns an |
| 737 | // angle (modulo 2*pi) in the range [-2*pi; 2*pi] that is closest to one of the |
nothing calls this directly
no outgoing calls
no test coverage detected