geometry changes/fixes/new features
new grid walkers + fixes new test-cases worked on step/and turn detection android offline-data-reader worked on vap-grouping
This commit is contained in:
11
geo/Angle.h
11
geo/Angle.h
@@ -46,10 +46,13 @@ public:
|
||||
* - as a change-in-direction between [-PI:+PI]
|
||||
*/
|
||||
static float getSignedDiffRAD_2PI(const float r1, const float r2) {
|
||||
Assert::isBetween(r1, 0.0f, (float)(2*M_PI), "r1 out of bounds");
|
||||
Assert::isBetween(r2, 0.0f, (float)(2*M_PI), "r2 out of bounds");
|
||||
const float a1 = (r2-r1);
|
||||
if (std::abs(a1) < M_PI) {return a1;} else {return (M_PI-a1);}
|
||||
Assert::isBetween(r1, 0.0f, (float)(2*M_PI), "r1 out of bounds"); // [0:360] deg
|
||||
Assert::isBetween(r2, 0.0f, (float)(2*M_PI), "r2 out of bounds"); // [0:360] deg
|
||||
float diff = r1-r2;
|
||||
if (diff > +M_PI) {diff = -(2*M_PI - diff);}
|
||||
else if (diff < -M_PI) {diff = +(2*M_PI + diff);}
|
||||
Assert::isBetween(diff, (float)-M_PI, (float)(+M_PI), "result out of bounds"); // [-180:+180] deg
|
||||
return diff;
|
||||
}
|
||||
|
||||
/** convert degrees to radians */
|
||||
|
||||
Reference in New Issue
Block a user