4 ms·
I've only read the first few sections and am already agreeing fully. In fact, I don't think he goes far enough: > Likewise, guessing the third argument of the
by thewebcount 6y ago
I've only read the first few sections and am already agreeing fully. In fact, I don't think he goes far enough:
> Likewise, guessing the third argument of the "ellipse" function isn't "learning programming". It's simply a barrier to learning.
It's even worse than that. The "ellipse" function should only take 2 arguments - a point and a size (or 2 points if that's your thing).
I see so much of this sort of terrible API design, especially in graphics where good API design makes things so much clearer and easier to use. Writing out a point and a size as 4 variables is madness.
- KMag 6y ago> The "ellipse" function should only take 2 arguments - a point and a size (or 2 points if that's your thing). How do you handle ellipses with different eccentricities? There are several equivalent representations of ellipses, one of which is the two foci and the sum of the distances from the edge to the two foci... so two points and a distance (or you could use two points and the major axis, etc., etc.) A pair of points don't uniquely define one ellipse. Likewise, a center and a "size" doesn't uniquely define an ellipse.
- drdeca 6y agoI think maybe they meant for an ellipse drawing function which, like the one depicted in the webpage, only allows ellipses with both axis either horizontal or vertical, and was suggesting that the "size" argument would have 2 numbers to it.
- thewebcount 6y agoYes, that's what I meant. Obviously there are other ways to represent other types of ellipses, but given the constraints of the example in the article, I thought that was clear.
- Izkata 6y ago> A pair of points don't uniquely define one ellipse. What if the two points were the corners of an enclosing rectangle? This is how, for example, Gimp does the ellipse selector tool.
- KMag 6y agoThere are multiple ellipses bounded by that rectangle, unless you limit yourself to ellipses with major axis either vertical or horizontal.