-
Notifications
You must be signed in to change notification settings - Fork 0
/
Microtubule.hpp
152 lines (137 loc) · 3.63 KB
/
Microtubule.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#ifndef MICROTUBLE_HPP
#define MICROTUBLE_HPP
#include "Bitmap.hpp"
#include "Phragmoplast.hpp"
#include "php_const.hpp"
class Phragmoplast;
// A single microtubule
/**
* @brief A class representing a single microtubule.
*
*/
class Microtubule
{
protected:
double xInit; // Initial X location
double yInit; // Initial Y location
double x1; // Position of the seed
double x2; // End of growing MT
double y1; // Position of the seed
double y2; // End of growing MT
double deltaX; // X increment
double deltaY; // Y increment
double theta; // Orientation
double bleachedx1; // Left coordinate bleached region
double bleachedx2; // Right coordinate bleached region
double time; // time
int typeMT; // TREADMILL, SEEDED (GROWING_OUTSIDE, GROWING_INSIDE)
bool towardsDistalZone; // true -> +end away from CP
int statePlusEnd; // +end : EMPTY, GROWING, SHRINKING, MATURE
int stateMinusEnd; // -end : EMPTY, GROWING, SHRINKING, MATURE
int minEvent; // Event for this microtubule
Phragmoplast *phragmoplast; // Pointer to phragmoplast
public:
Microtubule() : bleachedx1(-1), bleachedx2(-1), typeMT(PHP_TYPE_NONE), minEvent(0), phragmoplast(0) {};
~Microtubule(){
};
bool IsInsideFRAP(double x, double y);
void Init(double x1, double y1, double L, double theta, int type, Phragmoplast *php);
void Draw(Bitmap &bm);
void Bleach();
void TextSave(std::ofstream &ofs);
void CheckMTPosition();
void UpdateBleach();
void SizeAdjust(bool plus = true, bool grow = true);
void RunUntil(double t_max);
double CrossLeftFRAP();
double CrossRightFRAP();
double CrossBottomFRAP();
double CrossTopFrap();
int DoEvent(int event);
double SelectNextEvent();
inline int GetMinEvent() { return minEvent; };
/**
* @brief Get the length of the microtubule.
*
* @return double the length
*/
inline double Length()
{
return ((this->statePlusEnd == PHP_STATE_EMPTY) ? 0 : sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)));
};
// corrdinate of the MT
inline double LineX(double y)
{
return (((x2 - x1) * y + x1 * y2 - x2 * y1) / (y2 - y1));
}
inline double LineY(double x)
{
return (((y2 - y1) * x + y1 * x2 - y2 * x1) / (x2 - x1));
}
inline double GetInitX()
{
return xInit;
};
inline double GetInitY()
{
return yInit;
};
inline double GetBleachedX1()
{
return bleachedx1;
};
inline double GetBleachedX2()
{
return bleachedx2;
};
inline double GetX1()
{
return (x1);
};
inline double GetX2()
{
return (x2);
};
inline double GetY1()
{
return (y1);
};
inline double GetY2()
{
return (y2);
};
inline double GetTime()
{
return (time);
}
inline int GetType()
{
return (typeMT);
}
inline int GetPlusState()
{
return (statePlusEnd);
}
inline int GetMinusState()
{
return (stateMinusEnd);
}
inline Microtubule &SetTime(double t)
{
time = t;
return *this;
}
inline void SetType(int type)
{
typeMT = type;
}
inline void SetPlusState(int state)
{
statePlusEnd = state;
}
inline void SetMinusState(int state)
{
stateMinusEnd = state;
}
};
#endif