|
GClasses
|
This class makes it easy to plot points and functions on 2D cartesian coordinates.
#include <GPlot.h>
Public Member Functions | |
| GPlotWindow (GImage *pImage, double xmin, double ymin, double xmax, double ymax) | |
| pImage is the image onto which you wish to plot More... | |
| ~GPlotWindow () | |
| void | arrow (double x1, double y1, double x2, double y2, unsigned int col, int headSize) |
| Draws an arrow from (x1, y1) to (x2, y2). headSize is specified in pixels. More... | |
| void | dot (double x, double y, float radius, unsigned int colFore, unsigned int colBack) |
| Plots a dot at the specified location. You must specify both the foreground and background color so that it can make the dot appear to be centered at the precise sub-pixel location specified. radius is specified in pixels. More... | |
| void | fatLine (double x1, double y1, double x2, double y2, float thickness, unsigned int col) |
| Plots a fat line. More... | |
| void | function (MathFunc pFunc, unsigned int col, void *pThis) |
| Plots a function. More... | |
| void | gridLines (int maxHorizAxisLabels, int maxVertAxisLabels, unsigned int col) |
| Draw grid lines If maxHorizAxisLabels is 0, no grid lines will be drawn for the horizontal axis. If maxHorizAxisLabels is -1, a logarithmic scale will be used for the horizontal axis. Same with maxVertAxisLabels. More... | |
| GImage * | image () |
| Returns the image that was passed in to the constructor. More... | |
| void | label (double x, double y, const char *szLabel, float size, unsigned int col) |
| Draws a label at the specified location. (A size of 1.0f will be small but legible.) More... | |
| GImage * | labelAxes (int maxHorizAxisLabels, int maxVertAxisLabels, int precision, float size, unsigned int color, double angle) |
| Copy the image onto a larger image, and label the axes on the larger image. If maxHorizAxisLabels is 0, no labels will be drawn for the horizontal axis. If maxHorizAxisLabels is -1, a logarithmic scale will be used for the horizontal axis. Same with maxVertAxisLabels. More... | |
| void | line (double x1, double y1, double x2, double y2, unsigned int col) |
| Plots a line. More... | |
| double | pixelHeight () const |
| Returns the height represented by each pixel. More... | |
| double | pixelWidth () const |
| Returns the width represented by each pixel. More... | |
| void | point (double x, double y, unsigned int col) |
| Plots a single pixel. (Note that for most applications, PlotDot is a better choice because it draws a larger dot centered at the sub-pixel location that you specify.) More... | |
| void | viewToWindow (int x, int y, double *pX, double *pY) |
| Convert from view (image) coordinates to window (Euclidean space) coordinates. More... | |
| GDoubleRect * | window () |
| Returns the rect of the Euclidean space that this image represents. More... | |
| void | windowToView (double x, double y, float *pX, float *pY) |
| Convert from window (Euclidean space) coordinates to view (image) coordinates. More... | |
| void | windowToView (double x, double y, int *pX, int *pY) |
| Convert from window (Euclidean space) coordinates to view (image) coordinates. More... | |
Static Protected Member Functions | |
| static void | numericLabel (GImage *pImage, double value, int x, int y, int precision, float size, unsigned int color, double angle) |
| static void | stringLabel (GImage *pImage, const char *szText, int x, int y, float size, unsigned int color, double angle) |
Protected Attributes | |
| int | m_h |
| GImage * | m_pImage |
| int | m_w |
| GDoubleRect | m_window |
| GClasses::GPlotWindow::GPlotWindow | ( | GImage * | pImage, |
| double | xmin, | ||
| double | ymin, | ||
| double | xmax, | ||
| double | ymax | ||
| ) |
pImage is the image onto which you wish to plot
| GClasses::GPlotWindow::~GPlotWindow | ( | ) |
| void GClasses::GPlotWindow::arrow | ( | double | x1, |
| double | y1, | ||
| double | x2, | ||
| double | y2, | ||
| unsigned int | col, | ||
| int | headSize | ||
| ) |
Draws an arrow from (x1, y1) to (x2, y2). headSize is specified in pixels.
| void GClasses::GPlotWindow::dot | ( | double | x, |
| double | y, | ||
| float | radius, | ||
| unsigned int | colFore, | ||
| unsigned int | colBack | ||
| ) |
Plots a dot at the specified location. You must specify both the foreground and background color so that it can make the dot appear to be centered at the precise sub-pixel location specified. radius is specified in pixels.
| void GClasses::GPlotWindow::fatLine | ( | double | x1, |
| double | y1, | ||
| double | x2, | ||
| double | y2, | ||
| float | thickness, | ||
| unsigned int | col | ||
| ) |
Plots a fat line.
| void GClasses::GPlotWindow::function | ( | MathFunc | pFunc, |
| unsigned int | col, | ||
| void * | pThis | ||
| ) |
Plots a function.
| void GClasses::GPlotWindow::gridLines | ( | int | maxHorizAxisLabels, |
| int | maxVertAxisLabels, | ||
| unsigned int | col | ||
| ) |
Draw grid lines If maxHorizAxisLabels is 0, no grid lines will be drawn for the horizontal axis. If maxHorizAxisLabels is -1, a logarithmic scale will be used for the horizontal axis. Same with maxVertAxisLabels.
|
inline |
Returns the image that was passed in to the constructor.
| void GClasses::GPlotWindow::label | ( | double | x, |
| double | y, | ||
| const char * | szLabel, | ||
| float | size, | ||
| unsigned int | col | ||
| ) |
Draws a label at the specified location. (A size of 1.0f will be small but legible.)
| GImage* GClasses::GPlotWindow::labelAxes | ( | int | maxHorizAxisLabels, |
| int | maxVertAxisLabels, | ||
| int | precision, | ||
| float | size, | ||
| unsigned int | color, | ||
| double | angle | ||
| ) |
Copy the image onto a larger image, and label the axes on the larger image. If maxHorizAxisLabels is 0, no labels will be drawn for the horizontal axis. If maxHorizAxisLabels is -1, a logarithmic scale will be used for the horizontal axis. Same with maxVertAxisLabels.
| void GClasses::GPlotWindow::line | ( | double | x1, |
| double | y1, | ||
| double | x2, | ||
| double | y2, | ||
| unsigned int | col | ||
| ) |
Plots a line.
|
staticprotected |
|
inline |
Returns the height represented by each pixel.
|
inline |
Returns the width represented by each pixel.
| void GClasses::GPlotWindow::point | ( | double | x, |
| double | y, | ||
| unsigned int | col | ||
| ) |
Plots a single pixel. (Note that for most applications, PlotDot is a better choice because it draws a larger dot centered at the sub-pixel location that you specify.)
|
staticprotected |
|
inline |
Convert from view (image) coordinates to window (Euclidean space) coordinates.
|
inline |
Returns the rect of the Euclidean space that this image represents.
|
inline |
Convert from window (Euclidean space) coordinates to view (image) coordinates.
|
inline |
Convert from window (Euclidean space) coordinates to view (image) coordinates.
|
protected |
|
protected |
|
protected |
|
protected |