ossama-othman / MaRC

MaRC - Map Reprojections and Conversions
GNU Lesser General Public License v2.1
1 stars 0 forks source link

Clockwise position angle is not converted to counter-clockwise angle. #87

Closed ossama-othman closed 6 years ago

ossama-othman commented 6 years ago

MaRC measures position angles as counter-clockwise positive from the vertical "up" direction in the image. However, MaRC's parser does not convert clockwise position angles to their counter-clockwise equivalent, i.e. CCW position angle = 360 - CW position angle. Here's the relevant grammar in the parser:

position_angle:
        POSITION_ANGLE ':' expr    { $$ = $3; }
        | POSITION_ANGLE ':' expr CW   {
            if ($3 >= 0)
                $$ = $3;   // BUG!  This should be $$ = 360 - $3.
            else {
                MaRC::error("position (North) angle {} CW is negative",
                            $3);
                YYERROR;
            }
        }
        | POSITION_ANGLE ':' expr CCW {
            if ($3 >= 0)
                $$ = $3;
            else {
                MaRC::error("position (North) angle {} CCW is negative",
                            $3);
                YYERROR;
            }
        }
;

The parser should be corrected, accordingly.