bernedom / SI

A header only C++ library that provides type safety and user defined literals for physical units
https://si.dominikberner.ch/doc/
MIT License
485 stars 40 forks source link

Support for maritime units? #127

Open UPC-PaalDriveklepp opened 9 months ago

UPC-PaalDriveklepp commented 9 months ago

Would it be a good idea to implement nautical mile and knots? That is, nmi and kn or kt?

ypearson commented 9 months ago

why knot?

UPC-PaalDriveklepp commented 9 months ago

NMEA RMC messages contain the speed in knots, and knots are closely related to nautical miles. It is just a velocity and is easily convertible.

It would be nice to be able to do:

SI::knots_t parseNmeaSpeed() { /* implemenmtation */ }
void sendSpeed(const SI::metre_per_second_t& speed) { /* implemenmtation */ }

sendSpeed(parseNmeaSpeed(nmeaString));

Not sure exactly how it would look. Maybe it would also need a SI::unit_cast<>

Edit: @ypearson I think I got the joke... :walking: :house:

ypearson commented 9 months ago

I think you have a good idea =) More units!

bernedom commented 9 months ago

I'll consider adding them probably in their own header as a special unit of the length dimension