emailconfirmed
174
edits
No edit summary |
|||
Line 51: | Line 51: | ||
euglenaList.add(new Euglena(r.x, r.y)); | euglenaList.add(new Euglena(r.x, r.y)); | ||
} | } | ||
} | |||
void deleteEuglena() { | |||
ListIterator<Euglena> iter = euglenaList.listIterator(); | |||
float newmdx = 0; | |||
float newmdy = 0; | |||
while (iter.hasNext()) { | |||
Euglena e = iter.next(); | |||
if (e.found==false) iter.remove(); | |||
else { | |||
e.found = false; | |||
newmdx = newmdx + e.dx; | |||
newmdy = newmdy + e.dy; | |||
} | |||
} | |||
if (euglenaList.size() > 0) { | |||
newmdx = newmdx / euglenaList.size(); | |||
newmdy = newmdy / euglenaList.size(); | |||
} else { | |||
newmdx = 0; | |||
newmdy = 0; | |||
} | |||
mdx += (newmdx - mdx)*0.01; | |||
mdy += (newmdy - mdy)*0.01; | |||
} | } | ||
</source> | </source> |