[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?



On Fri, Sep 30, 2011 at 5:43 AM, Mac Ryan <quasipedia@xxxxxxxxx> wrote:
On Thu, 29 Sep 2011 18:18:48 -0400
Christopher Night <cosmologicon@xxxxxxxxx> wrote:

> If I have a 100x100 pixel window, and I want to put a dot at a
> position (x,x), it seems to me like the dot should appear in the
> window if 0 <= x < 100. You're saying it should appear in the window
> if -0.5 <= x < 99.5. So if I request to put a point at (-0.4, -0.4),
> it will appear in the window, but if I put one at (99.6, 99.6), it
> won't. I disagree that this is the correct behavior. Intuitively, the
> point (99.6, 99.6) should be within a 100x100 canvas.

I have a different take on this: if you have float rectangles, you are
effectively treating **your rectangle as part of your model, not part of
your representation** (see my previous mail). This means that a point,
which is a dimensionless entity, shouldn't be displayed regardless of
it's coordinates, given that your screen' pixels have a dimension (and
therefore are infinitely larger than a point.

I realise that this is absolutely counter-intuitive (you would be
obliged to draw points as circles or rectangles that scales to 1 px or
to internally convert the calls to draw pixels to calls to draw
rectangles), but I think that is the only mathematically correct
solution to the ambivalence.

Well pixels are just the simplest example. The ambiguity exists for all drawing functions, not just set_at. For instance, should a horizontal line extending from (10, 99.6) to (90, 99.6) appear on the 100x100 screen or not? So I don't think that forbidding set_at solves it.

If you're going to say that lines are 1-dimensional and thus infinitely smaller than pixels, and thus we're obliged to draw a thin rectangle whenever we want a line, then (a) I probably would not use the tool if it doesn't even support drawing lines, and (b) consider the filled, closed polygon from (10, 99.6) to (90, 99.6) to (50, 200). Would drawing that cause any pixels on the 100x100 screen to be lit up or not?

-Christopher