XADcanvasmap


Purpose
Map the coordinate space of a canvas.
Synopsis
procedure XADcanvasmap(id:integer, x1:real, y1:real, x2:real, y2:real, x1new:real, y1new:real, x2new:real, y2new:real)
Arguments
id 
Canvas identifier
x1 
x start coordinate
y1 
y start coordinate
x2 
x end coordinate
y2 
y end coordinate
x1new 
New x start coordinate
y1new 
New y start coordinate
x2new 
New x end coordinate
y2new 
New y end coordinate
Further information
Transforms the coordinate space of the canvas. Normally, (0,0) represents the upper left corner of the canvas and widths and heights are measured in pixels. By remapping the coordinate space, transformations no longer need to be applied to coordinates when drawing. For example, if the canvas has a width of 300 and a height of 200 and if we want to draw a graph from -1 to +1 on the x axis and -2 to +2 on the y axis in a region of the original canvas, we could write, say:
XADcanvasmap(id_canvas, 50, 150, 250, 50, -1, -2, 1, 2)
before plotting the points on the graph. Note that this transformation reverts the direction of the y axis and plots everything between (-1,1) and (-2,2) in the portion of the canvas between pixel coordinates (50,50) and (250,150). The following figure clarifies the effect of the XADcanvasmap call:
XAD/mapping.png
After calling this procedure, coordinates should be given in the red intervals. XAD will map them correctly onto the canvas, based on the black intervals.
Related topics
XADcanvasunmap


If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.