On Thu, 13 Sep 2007 08:29:56 -0500, "Michael J. Forster" <mike@sharedlogic.ca> wrote:
I was thinking of lines on a graph as zero-based vectors. Thus, a vector of length (or axis of width or height) n is indexed from 0 to n-1. And, indeed, with the following...
(let ((height 100) (width 100) (x-axis-width (list width 1)) (y-axis-height (list 1 height)) (x-axis-width-1 (list (1- width) 1)) (y-axis-height-1 (list 1 (1- height)))) (cl-gd:with-image* (width height) (set-pixels x-axis-width) (set-pixels y-axis-height) (set-pixels x-axis-width-1) (set-pixels y-axis-height-1) ...))
... only the last two pixels are displayed on my 100x100 pixel image. The axes are indexed from 0 to n-1. If WIDTH and HEIGHT are 1, I only expect to see the pixel generated by...
(set-pixels '(0 0))
I think where CL-GD and you disagree is that currently the outermost "virtual" point (X2 or (+ X1 WIDTH)) is mapped to the first point which is /not/ on the real image (and similar for the other axis), i.e. the transformation arguments kind of describe a half-open interval. I can see how this is inconvenient and I wouldn't mind changing that unless someone else provides important reasons not to do it. Could you please check if the attached patch does what you want? As for your complaints about the x-axis transformation not being consistent with the y-axis transformation, are you sure you're not seeing rounding errors? Or maybe this happened because of the "one off" stuff plus the fact that the "virtual" y-axis usually points into the opposite direction? Cheers, Edi.