#ifndef IFS_HPP
#define IFS_HPP

#include <vector>
#include "mathfunction.hpp"
#include "point.hpp"

struct TAffineTransformation {
double a, b, c, d, e, f;
};

struct TMathFunctionRawInput {
int Type; //1: Affine Transformation, 2: Custom String.
union {
TAffineTransformation t;
struct {
const char *sx;
const char *sy;
};
};
};

struct TMathFunctionInfo {
int Enabled;
TMathFunction *fx;
TMathFunction *fy;
TMathFunctionRawInput RawInput;
float p;
};

class TIFS {
private:
std::vector<TMathFunctionInfo> v;
int EnabledIFSs;
public:
TIFS();
~TIFS();
void Add(const char *sx, const char *sy, float p);
void Add(TAffineTransformation t, float p);
void Delete(int i);
TPoint operator()(TPoint p);
};

class TReadOnlyIFS {
private:
TIFS *IFSPtr;
public:
TReadOnlyIFS(TIFS *xIFSPtr);
~TReadOnlyIFS();
TPoint operator()(TPoint p);
};

#endif
