33TEST_CASE(
"Verify compilation and calculations of math::angleMod",
"[math::angleMod]" )
35 GIVEN(
"angles in degrees" )
37 WHEN(
"positive angle, no changes" )
41 REQUIRE_THAT( q, Catch::Matchers::WithinRel( 43.2 ) );
44 WHEN(
"positive angle, no changes" )
48 REQUIRE_THAT( q, Catch::Matchers::WithinRel( 353.2 ) );
51 WHEN(
"positive angle, exactly 360" )
55 REQUIRE_THAT( q, Catch::Matchers::WithinRel( 0.0 ) );
58 WHEN(
"positive angle, mod needed" )
62 REQUIRE_THAT( q, Catch::Matchers::WithinRel( 2.0 ) );
65 WHEN(
"negative angle, mod needed" )
69 REQUIRE_THAT( q, Catch::Matchers::WithinRel( 358.0 ) );
73 GIVEN(
"angles in radians" )
75 WHEN(
"positive angle, no changes" )
79 REQUIRE_THAT( q, Catch::Matchers::WithinRel(
mx::math::dtor( 43.2 ) ) );
82 WHEN(
"positive angle, no changes" )
86 REQUIRE_THAT( q, Catch::Matchers::WithinRel(
mx::math::dtor( 353.2 ) ) );
89 WHEN(
"positive angle, exactly 2pi" )
93 REQUIRE_THAT( q, Catch::Matchers::WithinRel(
mx::math::dtor( 0.0 ) ) );
96 WHEN(
"positive angle, mod needed" )
100 REQUIRE_THAT( q, Catch::Matchers::WithinRel(
mx::math::dtor( 2.0 ) ) );
112TEST_CASE(
"Verify compilation and calculations of math::angleDiff",
"[math::angleDiff]" )
114 GIVEN(
"angles in degrees" )
116 WHEN(
"positive, first angle is 0, not crossing 180/360" )
120 REQUIRE_THAT( q, Catch::Matchers::WithinRel( 43.2 ) );
123 WHEN(
"negative, second angle is 0, not crossing 180/360" )
127 REQUIRE_THAT( q, Catch::Matchers::WithinRel( -43.2 ) );
130 WHEN(
"positive, first angle is 360, not crossing 180/360" )
134 REQUIRE_THAT( q, Catch::Matchers::WithinRel( 43.2 ) );
137 WHEN(
"negative, second angle is 3600, not crossing 180/360" )
141 REQUIRE_THAT( q, Catch::Matchers::WithinRel( -43.2 ) );
144 WHEN(
"positive, crossing 360" )
148 REQUIRE_THAT( q, Catch::Matchers::WithinRel( 43.2 ) );
151 WHEN(
"negative, crossing 180/360" )
155 REQUIRE_THAT( q, Catch::Matchers::WithinRel( -43.2 ) );
158 WHEN(
"positive, crossing 180" )
162 REQUIRE_THAT( q, Catch::Matchers::WithinRel( 46.2 ) );
165 WHEN(
"negative, crossing 180" )
169 REQUIRE_THAT( q, Catch::Matchers::WithinRel( -46.2 ) );
173 GIVEN(
"angles in radians" )
175 WHEN(
"positive, first angle is 0, not crossing pi/2pi" )
183 WHEN(
"negative, second angle is 0, not crossing pi/2pi" )
191 WHEN(
"positive, first angle is 360, not crossing pi/2pi" )
199 WHEN(
"negative, second angle is 3600, not crossing pi/2pi" )
207 WHEN(
"positive, crossing 2pi" )
215 WHEN(
"negative, crossing 2pi" )
223 WHEN(
"positive, crossing pi" )
231 WHEN(
"negative, crossing pi" )
TEST_CASE("math::dtor converts float degrees to radians", "[math::dtor]")
Verifies the float specialization of mx::math::dtor converts degrees to radians.
angleT::realT angleDiff(typename angleT::realT q1, typename angleT::realT q2)
Calculate the difference between two angles, correctly across 0/360.