Coordinate System

« Getting Started | UserGuide | Lines and Rectangles »

Geometric shapes and text are drawn on the canvas by specifying points in the two-dimensional discrete Cartesian coordinate system. The points on the canvas correspond to pixels on the screen. Thus, the actual size of the canvas and the geometric shapes depends on the resolution of your screen.

While points on the canvas are specified as discrete Cartesian coordinates, the canvas coordinate system is different from the one used in mathematics. Specifically, the canvas is configured such that the origin (0, 0) is at the upper-left corner and the y-coordinate grows downward.

Thus, the positive x-coordinate indicates a horizontal offset from the left-side of the canvas and the positive y-coordinate indicates a vertical offset from the top of the canvas. For example, suppose we want to specify two points on a canvas with one point at position (10, 20) and the other at position (40, 9). The location of the two points on the canvas are illustrated below

NoteNote

Coordinates can be specified that fall outside the canvas, but only the part of the shape or text that fits on the canvas will be drawn.



« Getting Started | UserGuide | Lines and Rectangles »

Last modified: August 17, 2013, at 08:30 AM.