Can't one just call it coordinate and child class length from it for
giggles? So at least you get both names and use the most fitting one
depending on application? Like in the case of points, you use coordinates.
> - "no operator+(point, screen_point)" is immediately understandable
I agree
>- "no operator+(vector2d<coordinate>, vector2d<screen_coordinate>)" is
>still graspable
>- "no operator+(vector2d<coord<1,0>>, vector2d<coord<0,1>>)" borders on
>confusing
That's reasonable but not what I'm arguing for?
>The latter would allow representing the zoom factor as coord<1,-1>,
This is where you lose me.
"Coordinate' means number on a single axis, this is the same as your
"length".
But your use of coord<1,-1> is a "ordered pair" and not a coordinate.
I think the issue here is semantics ;)
On Wed, Nov 21, 2018 at 11:12 AM Simon Richter <Simon.Richter@xxxxxxxxxx
<mailto:Simon.Richter@xxxxxxxxxx>> wrote:
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
--
Mark
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp