Hi, On 21.11.2018 16:24, Mark Roszko wrote:
> Shouldn't the "length" class be called "coordinate"?
> Otherwise reading point::point(length nx, length ny) as an constructor
> is pretty weird.
Then I'd have to replicate the entire logic of "number + length unit"
for coordinates and sizes, which I thought I'd avoid and only have
"point", "vector" and possibly "size" as distinct types. With the
distinction between real-world and screen measurements, we'd be getting
close to "we need a class template" territory, but one of the minor
goals is to keep error messages readable:
- "no operator+(point, screen_point)" is immediately understandable
- "no operator+(vector2d<coordinate>, vector2d<screen_coordinate>)" is
still graspable
- "no operator+(vector2d<coord<1,0>>, vector2d<coord<0,1>>)" borders on
confusing
The latter would allow representing the zoom factor as coord<1,-1>,
which would reduce the amount of code needed because we can have
template<int nm1, int px1, int nm2, int px2>
coord<nm1-nm2, px1-px2> operator/(coord<nm1, px1>, coord<nm2, px2>);
and have that check units on the zoom factor, but three classes written
out would probably not be that bad either, and give us better diagnostics.
Simon
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

