@@ -20,13 +20,7 @@ function newCell(x, y)
20
20
for i = 1 ,13 do
21
21
cell .membrane [i ] = {x = x + 50 * math.cos (math.rad (15 * i )),y = y + 50 * math.sin (math.rad (15 * i )),vx = 0 ,vy = 0 ,ax = 0 ,ay = 0 ,spring = 0 }
22
22
cell .membrane [i ].spring = fNucSpringLength (cell )
23
- -- cell.membrane[i] = x+50*math.cos(math.rad(15*i))
24
- -- cell.membrane[i+1] = y+50*math.sin(math.rad(15*i))
25
23
end
26
- -- cell.mbsize = table.getn(cell.membrane)
27
-
28
- -- cell.springs = {}
29
- -- for i = 1,13 do cell.springs[i] = fNucSpringLength(cell) end
30
24
31
25
cell .genes = {}
32
26
cell .genes .growtime = 2 -- 1 --time to grow a new node, in seconds
@@ -74,10 +68,6 @@ function grow(c)
74
68
local noday = (c .membrane [idx2 ].ay + c .membrane [idx ].ay )/ 2 -- " " ay coords
75
69
76
70
table.insert (c .membrane ,idx ,{x = nx ,y = ny ,vx = nvx ,vy = nvy ,ax = nodax ,ay = noday ,spring = fNucSpringLength (c )})
77
-
78
- -- add spring to nucleus:
79
- -- table.insert(c.springs,idx,fNucSpringLength(c))
80
- -- c.mbsize = table.getn(c.membrane)
81
71
end
82
72
83
73
function mitosis (_n )
@@ -88,24 +78,20 @@ function mitosis(_n)
88
78
c = {}
89
79
c .membrane = {}
90
80
c .nucleus = {}
91
- -- c.springs = {}
92
81
93
82
local newcell = {}
94
83
newcell .membrane = {}
95
84
newcell .nucleus = {}
96
- -- newcell.springs = {}
97
85
98
86
for i = 1 ,split - 1 do
99
87
c .membrane [i ] = table .copy (oldc .membrane [i ])
100
- -- c.springs[i] = oldc.springs[i]
101
88
end
102
89
local nucCopy = table .copy (oldc .nucleus )
103
90
nucCopy .spring = fNucSpringLength (c )
104
91
table.insert (c .membrane ,nucCopy )
105
92
106
93
for i = split ,oldsize do
107
94
newcell .membrane [i + 1 - split ] = table .copy (oldc .membrane [i ])
108
- -- newcell.springs[i+1-split] = oldc.springs[i]
109
95
end
110
96
111
97
local nucCopy = table .copy (oldc .nucleus )
@@ -220,13 +206,7 @@ function updateCell(_n,dt)
220
206
221
207
table.remove (bullets ,j )
222
208
table.remove (c .membrane ,i )
223
- --[[ table.remove(c.membrane,i)
224
- table.remove(c.membraneVel,i)
225
- table.remove(c.membraneVel,i)
226
- table.remove(c.membraneAcc,i)
227
- table.remove(c.membraneAcc,i)
228
- table.remove(c.springs,(i+1)/2)
229
- c.mbsize = table.getn(c.membrane)]]
209
+
230
210
continue = true
231
211
break
232
212
else
@@ -235,7 +215,6 @@ function updateCell(_n,dt)
235
215
end
236
216
if not continue then
237
217
-- update position:
238
- -- print(i,c.mbsize)
239
218
c .membrane [i ].x = c .membrane [i ].x + c .membrane [i ].vx * dt + 0.5 * c .membrane [i ].ax * dt * dt -- update x
240
219
c .membrane [i ].y = c .membrane [i ].y + c .membrane [i ].vy * dt + 0.5 * c .membrane [i ].ay * dt * dt -- update y
241
220
-- boundaries:
@@ -249,12 +228,9 @@ function updateCell(_n,dt)
249
228
newax = newax + accn * math.cos (dir )
250
229
neway = neway + accn * math.sin (dir )
251
230
252
- -- print(c.springs[(i+1)/2])
253
-
254
231
-- Hooke's law for spring connecting c.membrane point to c.nucleus:
255
232
local distance = math.sqrt ((c .membrane [i ].x - c .nucleus .x )^ 2 + (c .membrane [i ].y - c .nucleus .y )^ 2 )
256
- local force = - kNucSpring * (distance - c .membrane [i ].spring ) -- -kNucSpring*(distance-nucSpringLength)
257
- -- if 1 == i or 13 == i then force = -kNucSpring*(distance-nucSpringLength*1.75) end
233
+ local force = - kNucSpring * (distance - c .membrane [i ].spring )
258
234
local theta = math.atan2 (c .membrane [i ].y - c .nucleus .y ,c .membrane [i ].x - c .nucleus .x )
259
235
newax = newax + (force / distance )* math.cos (theta )
260
236
neway = neway + (force / distance )* math.sin (theta )
@@ -265,7 +241,6 @@ function updateCell(_n,dt)
265
241
-- preceding:
266
242
local otherx = 0
267
243
local othery = 0
268
- -- print(i,c.mbsize)
269
244
if 1 == i then
270
245
otherx = c .membrane [table .getn (c .membrane )].x
271
246
othery = c .membrane [table .getn (c .membrane )].y
0 commit comments