Open
Description
Resulting from a discussion about headings in the range [-180,180) being displayed by simulator component, I think that does not make any sense. Headings are always in [0,360) and this should be a class invariant. It would be done internally in CHeading
so that client code is not littered with lots of calls to normalize methods.
In the same step, pitch should be in [-90,90) and bank should be in [-180,180). This will involve some refactoring into a base class CRotation
, derived from CAngle
. Then CHeading
, CPitch
, and CBank
would derived from CRotation
.
Design considerations:
- The Liskov Substitution Principle advises that inheritance might be the wrong tool to use here, as
CRotation
can not be a true generalisation ofCAngle
. - The design should prevent accidental conversions between the three derived classes, which could happen via the base class if we are not careful.
- We already have
CEarthAngle
,CLatitude
, andCLongitude
which should be doing a similar thing. CTrack
should have similar semantics. (Is it still needed?)- Will
CAngle
still be needed as a standalone class?