Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members Related Pages Search
MathFunction Class ReferenceAn abstract class which is used by a BasicGraph to execute math functions such as definite integral, arc length, etc. In order to create your own math function, you must create a subclass of this which reimplements calculate_and_draw(QPainter *, QString *), and as the name implies, calculates the result of the function and writes what you wish to display as the result in the given QString pointer. An example of this could be "Distance = 1.44" when calculating distance. Also, a pointer to a QPainter is given which allows you to draw a visual of the function calculated. This could shade the area underneath a curve for definite integral, for example.
More...
#include <mathfunction.h>
Inheritance diagram for MathFunction:
[legend]Collaboration diagram for MathFunction:
[legend]List of all members.
|
Public Methods |
| MathFunction (BasicGraph *=0, int expressions=0) |
virtual | ~MathFunction () |
virtual void | calculate_and_draw (QPainter *) |
| When creating a math function subclass, overwrite this function to calculate and then draw whatever visual you wish using the given QPainter.
|
virtual void | draw_stored (QPainter *p) |
| When creating a math function subclass, overwrite this function with a function to more quickly draw the result of the function.
|
int | expressionsRequired () |
| Call this function to begin determining function.
|
void | exec (FungParser *fp=0, FungParser *fp2=0) |
void | drawFunction (QPainter *) |
bool | active () |
void | sendClick (QMouseEvent *e, double arg=0, double arg2=0) |
void | cancel () |
Protected Methods |
void | setResult (QString &s) |
| Sets the string that will be displayed as the result of the function.
|
int | toPixelXCoord (double x_coordinate) |
int | toPixelYCoord (double y_coordinate) |
double | toGraphXCoord (double x_coordinate) |
double | toGraphYCoord (double y_coordinate) |
double | animatorValue () |
void | drawSelectedPoint (double x, double y, QPainter *painter) |
| Draws a horizontal and vertical line going through the point (x,y) as well as a small box at this point.
|
Protected Attributes |
QPoint | lowerBounds |
QPoint | upperBounds |
double | arg1 |
double | arg2 |
double | beta |
double | arg1x |
double | arg2x |
double | arg1y |
double | arg2y |
double | beta2 |
int | expression_count |
FungParser * | expression |
| This variable is available to subclasses to use for calculating the value of a function with.
|
FungParser * | expression2 |
BasicGraph * | basicgraph |
| This is provided in the case that you will need information from the BasicGraph such as its height/width or something else it provides.
|
Detailed Description
An abstract class which is used by a BasicGraph to execute math functions such as definite integral, arc length, etc. In order to create your own math function, you must create a subclass of this which reimplements calculate_and_draw(QPainter *, QString *), and as the name implies, calculates the result of the function and writes what you wish to display as the result in the given QString pointer. An example of this could be "Distance = 1.44" when calculating distance. Also, a pointer to a QPainter is given which allows you to draw a visual of the function calculated. This could shade the area underneath a curve for definite integral, for example.
- Author:
-
Fungmeista
Definition at line 42 of file mathfunction.h.
Member Function Documentation
virtual void MathFunction::calculate_and_draw |
( |
QPainter * |
|
) |
[inline, virtual] |
|
virtual void MathFunction::draw_stored |
( |
QPainter * |
p |
) |
[inline, virtual] |
|
int MathFunction::expressionsRequired |
( |
|
) |
[inline] |
|
|
Call this function to begin determining function.
After calling this function you will be asked to enter a lower bounds, then an upper bounds, and then the result will be displayed which is determined by your calculate_and_draw() function. You may passed a pointer to a parsed expression which will be stored in the "expression" variable and can be used in determining the value of the function.
Definition at line 68 of file mathfunction.h.
Referenced by FunctionGraph::execMathFunction(). |
double MathFunction::toGraphXCoord |
( |
double |
x_coordinate |
) |
[protected] |
|
double MathFunction::toGraphYCoord |
( |
double |
y_coordinate |
) |
[protected] |
|
|
- Parameters:
-
x_coordinate |
A x-direction coordinate in the coordinate system of the underlying QWidget. |
- Returns :
-
A number that is in the coordinate system of the graph in the x direction.
- Note:
-
When drawing onto the given QPainter it takes actual pixel coordinates where the bottom left is the x-y coordinate (0,0).
Definition at line 63 of file mathfunction.cpp.
References basicgraph, and BasicGraph::toGraphYCoord().
Referenced by MeanValueFunction::calculate_and_draw(). |
int MathFunction::toPixelXCoord |
( |
double |
x_coordinate |
) |
[protected] |
|
int MathFunction::toPixelYCoord |
( |
double |
y_coordinate |
) |
[protected] |
|
Member Data Documentation
The documentation for this class was generated from the following files:
|