#include #include #include class Point { public: double x,y,z; Point() : x(0), y(0), z(0) {}; //function for rotate coordinates of point (x, y, z) //around axis given by vector (ax, ay, az) Rotate(double ax, double ay, double az, double fi) { double x1, y1, z1; double d = (ax*ax + az*az + ay*ay); x1 = x*( - cos(fi)*ax*ax + cos(fi)*d + ax*ax)/d + y*( sqrt(d)*sin(fi)*az - cos(fi)*ay*ax + ay*ax)/d + z*( - sqrt(d)*sin(fi)*ay - cos(fi)*az*ax + az*ax)/d; y1 = x*( - sqrt(d)*sin(fi)*az - cos(fi)*ay*ax + ay*ax)/d + y*( - cos(fi)*ay*ay + cos(fi)*d + ay*ay)/d + z*(sqrt(d)*sin(fi)*ax - cos(fi)*az*ay + az*ay)/d; z1 = x*(sqrt(d)*sin(fi)*ay - cos(fi)*az*ax + az*ax)/d + y*( - sqrt(d)*sin(fi)*ax - cos(fi)*az*ay + az*ay)/d + z*(cos(fi)*ay*ay + cos(fi)*ax*ax - ay*ay - ax*ax + d)/d; x = x1; y = y1; z = z1; return 0; } //function for translation coordinates of point (x, y, z) //given by vector (ax, ay, az) Translate(double ax, double ay, double az) { x = x + ax; y = y + ay; z = z + az; return 0; } Scale(double ax, double ay, double az) {x = x*ax; y = y*ay; z = z*az; return 0; } }; //---------------------------------------------------------- class Voltage { int hId; int vId; public: double u; Voltage() : hId(0), vId(0), u(0){}; }; //---------------------------------------------------------- class Electrode : public Point, public Voltage { public: Electrode() : Voltage(){}; }; //---------------------------------------------------------- class Charge : public Point { //protected: public: int Id; double q; Charge() : Point(), Id(0), q(0){}; void SetId(int Num) { Id = Num; } }; //---------------------------------------------------------- // linkable class //---------------------------------------------------------- class LPoint : public Link, public Point { public: LPoint( Link* pNext) : Link ( pNext ), Point() {} }; class LCharge : public Link, public Charge { public: LCharge( Link* pNext) : Link ( pNext ), Charge() {} }; class LVoltage : public Link, public Voltage { public: LVoltage( Link* pNext) : Link ( pNext ), Voltage() {} }; class LElectrode : public Link, public Electrode { public: LElectrode( Link* pNext) : Link ( pNext ), Electrode() {} }; /////////////////////////////////////////////////////////////////// class Surface : public TList { int meshx; int meshy; int size; public: Surface() : TList(), meshx(0), meshy(0), size(0) {} int Meshx() { return meshx; } int Meshy() { return meshy; } int Size() { return size; } Initialize(int mx, int my); Translate(double ax, double ay, double az); Scale(double ax, double ay, double az); Rotate(double ax, double ay, double az, double fi); }; /////////////////////////////////////////////////////////////////// class Sequence : public TList, public TList { private: int Id; int ChargesNum; int VoltagesNum; public: Sequence() : TList(), TList(), Id(0), ChargesNum(0), VoltagesNum(0) {} void SetId(int Num) { Id = Num; } InitializeVoltages(int Num); AddCharge(Charge qq); RenumCharges(); double Potential(double x, double y, double z); }; /////////////////////////////////////////////// class LSequence : public Link, public Sequence { public: LSequence( Link* pNext) : Link ( pNext ), Sequence() {} }; /////////////////////////////////////////////////////// class Mapping : public TList { public: int SequenceNum; Mapping() : SequenceNum(0) {} AddSequence(); }; /////////////////////////////////////////////////////// //////////////////////////////////////////////////////// /////////////////////////////////////////////////////// //---------------------------------------------------------- class Hart : public Surface { public: void SetInternalModel(); Hart() : Surface() {} //~Hart(); }; //---------------------------------------------------------- class Breast : public Surface { public: Breast() :Surface() {} //~Breast(); void SetInternalModel(); }; //---------------------------------------------------------- class ElectrodeSet : public TList { int size; public: int Size(){ return size; } void Initialize(int Size); void SetInternalModel(); ElectrodeSet() : TList() {} //~ElectrodeSet(); }; ///////////////////////////////////////////////////////////////// class Patient : public Hart , public Breast, public ElectrodeSet { public: Patient(){}; ~Patient(){}; void SetInternalModel(); void RotateHart(double ax, double ay, double az, double fi); void TranslateHart(double ax, double ay, double az); }; //---------------------------------------------------------------- class Manager { public: Manager(){}; ~Manager(){}; void Save(const Patient& patient, char *filename,char *format, int WhatToSave); };