wilson@csli.STANFORD.EDU (Nathan Wilson) (12/29/88)
I am attempting to write code for splitting and merging polygon handles for an object oriented graphics editor. In order to do this it is necessary to go mucking about in the PolyHandle data structure. From reading IM-I, I am told that the polygon is defined as a size, a rect (the polyBBox), and set of points. My question is what are the semantics of the set of points, are they absolute window coordinate or relative coordinates and if relative, relative to what? As far as I can tell this information is not clearly laid out anywhere in anything referenced by IM-X-Ref. The information available is somewhat confused as far as I can tell. In IM-I it says: "QuickDraw draws a polygon by moving to the starting point and then drawing lines to the remaining points in succession, just as when the routines were called to define the polygon." In addition there is a note included in the description of OffsetPoly that says: "OffsetPoly is an especially efficient operation, because the data defining a polygon is stored relative to the first point of the polygon and so isn't actually changed by OffsetPoly." In addition, there is a comment in Tech Notes 91: "Unlike QuickDraw polygons, comment polygons do not require an initial MoveTo call within the scope of the polygon comment." All of this implies to me that some sort relative storage. My naive guess was that the first point was either a relative move from the upperleft corner of the polyBBox or a point in the same coordinates as the polyBBox, ie absolute window coordinates; the rest of the points would then be relative moves. After a bit of testing and examining the data structures neither of these turned out to be the case. Instead, in all the cases I could generate, the points are all in *absolute* window coordinates! The cases included polygons made with OpenPoly, a set of LineTo or Line calls, and ClosePoly; these polygon offset with OffsetPoly; and resized with MapPoly. I didn't try any really big polygons but for ones with between five and twenty one points all points end up in absolute coordinates. At the very least the note in the definition of OffsetPoly is wrong for small polygons. Is this an error in Inside Mac or could my program at some point be thrown some polygon with points not in absolute coordinates? Does anyone at Apple have any info on this? Does this maybe warrant a greatly delayed Tech Note? Nathan Wilson Teleos Research nathan@teleos.com (failing that try nathan@ai.sri.com)