math on widths doesn't add up

hh hh at hyperhh.de
Fri Jun 14 17:04:28 EDT 2019


This is interestingly the same problem that made a lot of people believe
two thousand years were full at the end of 1999/ beginning of 2000.
Two thousand years were full at the END of 2000/ beginning of 2001:

Full year 1 has the left 0, the right 1 and the width = right-left = 1 year, ...,
full years 1 to 2000 have the left 0, the right 2000 and the width = right-left = 2000 years.

> Dar S. wrote:
> I like this interpretation. I don't think it is a popular view, but it makes sense to me.
> I would change the range wording, though, to something like this:
> Pixel 0 ranges from 0 to 1.
> For example, the rect of a card has zeros.
> Maybe it depends on whether one wants to draw pixels on the intersections of the lines
> on the graph paper, or in between.

No, this is math, not an interpretation. If you agree that counting pixels is one-based
then there is no pixel 0.

Rect (0,0,0,0) has left 0, right 0, top 0, bottom 0, width 0 and height 0, contains 0 pixels.
In fact it is degenerated to the point (0,0).

Rect (0,0,1,1) is one pixel, the first pixel on your coordinate system.
It has left 0, right 1, top 0, bottom 1 and width 1, height 1.

The width of a rect is the number of its pixel columns,
the height of a rect is the number of its pixel rows,
width*height of a rect is the number of its enclosed pixels.

If you wisth to count zero-based the you have to redefine width and height.



More information about the use-livecode mailing list