|
From: <br...@ph...> - 2006-06-23 22:40:50
|
Ethan Merritt wrote:
> Do we have a utility routine somewhere that would convert
> plot coordinates to graph or screen coordinates?
No. axis.h:AXIS_MAP() and AXIS_MAPBACK transform from data
('first'/'second') coordinates to terminal coordinates and back.
Going from terminal to 'screen' is trivial (just divide by term->xmax).
Transforming to 'graph' from data coordinates is quite easy: it's a
direct linear transformation using the axis_array[].min and .max
values.
The X11-specific one you would want to look at is mouse_to_axis.
But the real key to this is in mouse.c:MousePosToGraphPosReal().
It's based on macros from axis.h
|