nanogui: nanoX coordinate system
Subject:
Re: nanoX coordinate system
From:
Ben Pfaff ####@####.####
Date:
10 May 1999 17:31:32 -0000
Message-Id: <876760q137.fsf@pfaffben.user.msu.edu>
Greg Haerr ####@####.#### writes:
Graphics coordinate systems typically come in one of two flavors:
DrawLine(x1, y1, x2, y2); - draw a line from (x1, y1) to (x2, y2)
Type 1 systems draw a line *including* (x2, y2)
Type 2 systems draw a line *not including* the last point (x2, y2)
In my experience, Type 2 systems are usually more convenient for
geometric arithmetic; i.e., you only need to say `x2 - x1' to find a
dimension, which results in fewer off-by-one adjustments.
One way to think of a type 2 system is that the points are between the
gridlines rather than centered on the grid intersections.
For upper level api's there is a third type, that has width and height passed
rather than using x2, y2. NanoX uses this, but I plan to change it. this goes
for Ellipse specification as well.
That's the way that X specifies rectangles, actually (width, height).
My feeling is that type 2 systems are the way to go, because rectangles
are described by two points in a bounding box, rather than width and height. Also,
in 0-based coordinate systems, x2,y2 is the width and height, rather than having to
calculate it. Ms-Windows gdi programming is easy because of this.
Currently, nanoX uses the type 1 specification, and we need the flexibility of using
drivers that are written to type 2.
Ben: bogl currently aborts() when I try this. Check out BOGL_fillrect for details.
When you try what? Do you mean I should look at a wrapper routine to
see something you worked around?