Algorithmic Solutions > LEDA > LEDA Guide > Windows and Panels > Pixel and User Coordinates

Pixel and User Coordinates

The underlying graphics system (X11 or Microsoft Windows) maps windows to rectangular regions of the display screen using a pixel based coordinate system.

The Pixel Coordinate System

  • point (0,0) is in the upper left corner
  • x-coordinates increase from left to right
  • y-coordinates increase from top to bottom
  • pixel coordinate system is defined in the constructor of the window

The User Coordinate System

All drawing and input operations in the drawing section of a window use the user coordinate system.
  • (0,0) in bottom left corner
  • x-coordinates increase from left to right
  • y-coordinates increase from bottom to top
  • defined by three doubles: xmin, xmax, ymin
  • scaling factor: w/(xmax-xmin) where w is the width of the window in pixels
  • ymax=ymin+h*scaling where h is the height of the window in pixels
  • user coordinate system can be set by W.init(), the default values are xmin=0, xmax=100, ymin=0

The window type provides operations for translating user coordinates into pixel coordinates and vice versa. See Manual Page Windows for details.

The Basic Example of How to Use window defines a window with pixel x-coordinates between 0 and 500, pixel y-coordinates between 0 and 600, and user x- and y-coordinates between -1000 and 1000.

Example of Convex Hull

See also:

Windows and Panels


Manual Page:

Manual Page Windows




Please send any suggestions, comments or questions to leda@algorithmic-solutions.com
© Copyright 2001-2003, Algorithmic Solutions Software GmbH