math on widths doesn't add up

Dar Scott Consulting dsc at swcp.com
Fri Jun 14 18:13:20 EDT 2019


When we apply math, we must map what we see to our mathematical models.  What we see is LiveCode.  The application of math is thus an interpretation. (The interpretation of calendar year or how-old-are-you might not apply.)

I do agree with you, except for the part that one has to redefine width and height. A delta does not depend on the offset.

If I create a line from 0,0 to 100,0; I get a line visible on the card, not a line just off the card. The LiveCode line is between the coordinates we are talking about, that is, a half pixel moved in from those, creating pixel coordinates off from what we are saying.

I can get the same thing with a rectangle of rect 0, 0, 101, 1. Well, if the border width is zero and the fill color is set.  This uses the coordinates we are talking about. The rectangle is filled.  

The one-pixel width of the line causes it to fill that space. If there is a 1-pixel square as a brush and it went from 0.5 to 100.5, it would sweep out the same space as the rectangle

However, others might have a view, an interpretation, that also works. 



> On Jun 14, 2019, at 3:04 PM, hh via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> 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.
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list