glot::grapher Class Reference

grapher: an interactive plotter display More...

#include <grapher.h>

List of all members.

Public Types

typedef void(* keyboard_function )(unsigned char key, GLint x, GLint y)
 Keyboard event handler typedef.
typedef void(* click_function )(GLint button, GLint x, GLint y)
 Click even handler typedef.
typedef void(* idle_function )(void)
 The idle function typedef.

Static Public Member Functions

static int initialize (int argc, char **argv, short int options=AXES_ON|GRID_ON|X_LIN|Y_LIN, short int k_options=ZOOM_KEYS_ON|AXES_KEYS_ON|GRID_KEYS_ON|QUIT_KEYS_ON)
 Initialize the grapher.
static void run ()
 Enter the OpenGL main loop after initialization.
static void redraw ()
 User-requested redraw.
static void add (primitive &p)
 Add a primitive to the plot.
static void remove (primitive &p)
 Remove a primitive from the plot.
static void add (point &p)
 Add a point to the plot.
static void remove (point &p)
 Remove a point from the plot.
static void set_keyboard_function (keyboard_function k)
 Set up a keyboard event handler.
static void set_click_function (click_function c)
 Set up a click event handler.
static void set_idle_function (idle_function i)
 Set the idle function handler.
static void zoom (double scale)
 Zoom in / out by a scale.
static double get_x_coord (GLint x)
 Transform a screen x coordinate to a world one.
static double get_y_coord (GLint y)
 Transform a screen y coordinate to a world one.
static point get_point (GLint x, GLint y)
 Returns the x, y point clicked on, in plot-space.


Detailed Description

grapher: an interactive plotter display

You might think of this class as a container for all the graphing primitives you plan to plot

See also:
p_curve

point

curve


Member Typedef Documentation

typedef void(* glot::grapher::click_function)(GLint button, GLint x, GLint y)

Click even handler typedef.

Parameters:
button - GLint button pressed
x - GLint x coordinate
y - GLint y coordinate
See set_click_function(...) for more details

typedef void(* glot::grapher::idle_function)(void)

The idle function typedef.

See set_idle_funciton(...) for more details

typedef void(* glot::grapher::keyboard_function)(unsigned char key, GLint x, GLint y)

Keyboard event handler typedef.

Parameters:
key - unsigned char
x - GLint x coordinate
y - GLint y coordinate
A keyboard event handler accepts a key and x, y coordinates


Member Function Documentation

static void glot::grapher::add ( point p  )  [static]

Add a point to the plot.

Parameters:
p - The Point you wish to add to the plot
Instantiate a point and then add it to the plot with this function. NOTE: Does not automatically request a redisplay

static void glot::grapher::add ( primitive p  )  [static]

Add a primitive to the plot.

Parameters:
p - the primitive to add
Add any primitive that inherits from the primitive class to the plot. The only requirement is that dl_gen makes the required OpenGL calls to render the geometry.

static point glot::grapher::get_point ( GLint  x,
GLint  y 
) [static]

Returns the x, y point clicked on, in plot-space.

Deprecation likely

static double glot::grapher::get_x_coord ( GLint  x  )  [static]

Transform a screen x coordinate to a world one.

Parameters:
x - the screen x coordinate to transform
It's the grapher's responsibility to know how to transform a screen coordinate into a world coordinate with this function.

static double glot::grapher::get_y_coord ( GLint  y  )  [static]

Transform a screen y coordinate to a world one.

Parameters:
y - the screen y coordinate to transform
It's the grapher's repsonsibility to know how to transform a screen coordinate into a world coordinate with this function.

static int glot::grapher::initialize ( int  argc,
char **  argv,
short int  options = AXES_ON|GRID_ON|X_LIN|Y_LIN,
short int  k_options = ZOOM_KEYS_ON|AXES_KEYS_ON|GRID_KEYS_ON|QUIT_KEYS_ON 
) [static]

Initialize the grapher.

Parameters:
argc - same as argc used for OpenGL initialization
argv - same as argv used for OpenGL initialization
options - startup options
k_options - the default keyboard actions options
Use a bitwise or to select startup options: AXES_ON, AXES_OFF GRID_ON, GRID_OFF X_LIN, X_LOG (linear x scale or logarithmic) Y_LIN, Y_LOG (linear y scale or logarithmic)

static void glot::grapher::redraw (  )  [static]

User-requested redraw.

If you create an event handler that will make some changes to the graph, you can make those changes and then request a redraw with this function.

static void glot::grapher::remove ( point p  )  [static]

Remove a point from the plot.

Parameters:
p - The point you wish to remove from the plot
If you've plotted a point, you can remove it from the plot with this function. NOTE: Does not automatically request a redisplay.

static void glot::grapher::remove ( primitive p  )  [static]

Remove a primitive from the plot.

Parameters:
p - the primitive to remove
Remove a previously-added primitive from the plot

static void glot::grapher::run (  )  [static]

Enter the OpenGL main loop after initialization.

In general, you will set up your event handlers, main code, etc., and then when you've gotten everything in place, you call grapher::run() to start the program's OpenGL portion.

static void glot::grapher::set_click_function ( click_function  c  )  [static]

Set up a click event handler.

Parameters:
c - the function you'd like to handle click events
If you'd like to set up a function to handle click events (which are when a user presses down and then releases a button at the same spot), you can register it with this function. NOTE: this is different from a motion function.

static void glot::grapher::set_idle_function ( idle_function  i  )  [static]

Set the idle function handler.

Animation is done by setting the idle_function handler, and this provides the interface. This might be deprecated in favor of an option that just allows the user to turn on animation, which would consist of simply setting OpenGL's idle function to grapher's display function.

static void glot::grapher::set_keyboard_function ( keyboard_function  k  )  [static]

Set up a keyboard event handler.

Parameters:
k - the function you'd like to handle key events
If you'd like to set up a function to handle key events, you can register them with this function. NOTE: there are default behaviors for certain keys that are not overridden here. For example, '+' zooms in, but if you use that key as well, both a zoom and your operation will take place.

The idea behind this is that these default behaviors are not the programmer's responsibility to code up as well. They are interface freebies.

Bitwise or options together from the set: ZOOM_KEYS_ON / ZOOM_KEYS_OFF AXES_KEYS_ON / AXES_KEYS_OFF GRID_KEYS_ON / GRID_KEYS_OFF

static void glot::grapher::zoom ( double  scale  )  [static]

Zoom in / out by a scale.

Parameters:
scale - the scale by which to zoom
This determines the center of the plot as it is now, and scales in / out by a factor of scale outward / inward from that center point.


The documentation for this class was generated from the following file:

Generated on Fri Nov 20 18:09:06 2009 for OpenGLot by  doxygen 1.5.8