diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2021-11-12 11:51:54 +0100 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2021-11-12 11:51:54 +0100 |
commit | c616bc12f23162b6b1714ea936f4a2dafd0780a3 (patch) | |
tree | 890d7547ea67fd79d85285def8b00294300eac5d /animation.hpp | |
parent | 4beb0e8597060852dc82a2e2da43eaa5926d24a2 (diff) | |
download | spheres-c616bc12f23162b6b1714ea936f4a2dafd0780a3.tar.gz spheres-c616bc12f23162b6b1714ea936f4a2dafd0780a3.tar.bz2 spheres-c616bc12f23162b6b1714ea936f4a2dafd0780a3.zip |
Starting implementing collective moves.
Diffstat (limited to 'animation.hpp')
-rw-r--r-- | animation.hpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/animation.hpp b/animation.hpp index b1ff815..31a466e 100644 --- a/animation.hpp +++ b/animation.hpp @@ -28,12 +28,16 @@ void initializeAnimation(int argc, char** argv, unsigned window_size = 1000) { template <Particle<2> T> void draw(const Model<2, T>& m) { glClear(GL_COLOR_BUFFER_BIT); for (const Sphere<2>& p : m.particles) { + std::array<double, 3> color = {0, 0, 0}; + if (p.m) { + color = {0, 1, 0}; + } Sphere<2> pTmp = p; pTmp.x = m.orientation.inverse().act(p.x); - draw(pTmp); + draw(pTmp, color); if (pTmp.intersectsBoundary()) { for (Vector<2> Δy : {(Vector<2>){1,0}, {-1,0}, {0,1}, {0,-1}, {-1,1}, {1,1}, {1,-1},{-1,-1}}) { - draw({(Vector<2>)pTmp.x + Δy, p.r}); + draw({(Vector<2>)pTmp.x + Δy, p.r}, color); } } } |