Blue Project
Kyle,Nigel,Jamie
 All Classes Files Functions Variables Pages
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Expr Class Reference

An abstract representation of a mathematical function. More...

#include <Expr.h>

Public Member Functions

float eval (float x, float y, float step)
 Recursive method, calls eval on its nested expressions. More...
 
 Expr (Expr *otherE1, Expr *otherE2, std::string otherExprType, bool dubInput)
 Constructor takes in other expressions for the nested expression case. More...
 
 Expr (Expr *otherE1, std::string otherExprType, bool dubInput)
 
 Expr (std::string otherExprType)
 
string * toString (string *theString)
 

Public Attributes

bool doubleInput
 
shared_ptr< Expre1
 An expression might have a nested expression, for example this expression could be cos ( expr1 ) where expr1 would be another expression with other nested expression etc. More...
 
shared_ptr< Expre2
 Some expressions take two inputs like Average or Circle. More...
 
std::string exprType
 Stores the type of expression this Expr is. More...
 

Static Public Attributes

static const string ASin = "ASin"
 
static const string Average = "Average"
 
static const string Circle = "Circle"
 
static const string Cos = "Cos"
 
static const string Sin = "Sin"
 
static const string Times = "Time"
 
static const string VarX = "VarX"
 
static const string VarY = "VarY"
 

Detailed Description

An abstract representation of a mathematical function.

This class represents a math function that can then be evaluated over some interval.

Note that the static const string variables are used to set an Expression to be a certain type.

Constructor & Destructor Documentation

Expr::Expr ( Expr otherE1,
Expr otherE2,
std::string  otherExprType,
bool  dubInput 
)

Constructor takes in other expressions for the nested expression case.

The third constructor is for "terminal" expressions, ie when the Art::build() method's depth input is 0 and terminates expression expansion. doubleInput to distinguish between single and double input math functions. The otherExprType parameter is most important as it is what sets the type of math function this newly created Expr is.

Expr::Expr ( Expr otherE1,
std::string  otherExprType,
bool  dubInput 
)
Expr::Expr ( std::string  otherExprType)

Member Function Documentation

float Expr::eval ( float  x,
float  y,
float  step 
)

Recursive method, calls eval on its nested expressions.

step is an important variable, it sets the constant that is multiplied by the input in the case of a trigonometric function, by increasing the step value over time, we get the cool changes in our 2d art animation. See the 2d art animation for an example of what eval over slowly incrementing step parameters looks like.

3.0f;

string * Expr::toString ( string *  theString)

Member Data Documentation

const string Expr::ASin = "ASin"
static
const string Expr::Average = "Average"
static
const string Expr::Circle = "Circle"
static
const string Expr::Cos = "Cos"
static
bool Expr::doubleInput
shared_ptr<Expr> Expr::e1

An expression might have a nested expression, for example this expression could be cos ( expr1 ) where expr1 would be another expression with other nested expression etc.

shared_ptr<Expr> Expr::e2

Some expressions take two inputs like Average or Circle.

std::string Expr::exprType

Stores the type of expression this Expr is.

This string must be one of the static string variables defined for an Expr

const string Expr::Sin = "Sin"
static
const string Expr::Times = "Time"
static
const string Expr::VarX = "VarX"
static
const string Expr::VarY = "VarY"
static

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