Developer's Guide: Coordinate Systems

General Remarks | Developer's Guide | Curve Objects

# Coordinate Systems

All coordinates used by the document and graphics objects are given in the document coordinate system. This coordinate system has its origin in the lower left corner of the page; x increases to the right, y increases to the top. The unit for these coordinates is the DTP-point (or PostScript-point), that is, 1/72 inch. Thus Sketch's document coordinate system is the same as the default coordinate system of a PostScript interpreter. Coordinates are stored as floats.

The page size is a user settable document property, usually `A4', `letter' or something similar. Sketch can display the outline of the page if desired to allow the user to position the drawing on the page.

When displaying the document in a window, the canvas widget (to be more precise, the graphics device object the canvas uses) converts document coordinates to window coordinates. These are the standard X-Window coordinates with the origin in the top left corner of the window and x increasing to the right and y increasing downwards. The unit is 1 pixel.

Sketch defines a few builtin objects to represent and manipulate coordinates: Points, Rects and Transformations. All of the related functions, objects and constants are exported by the `Sketch` package.

#### Point Objects

#### Rect Objects

#### Transformation Objects

General Remarks | Developer's Guide | Curve Objects