diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2021-09-17 12:40:44 +0200 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2021-09-17 12:40:44 +0200 |
commit | 3140c22dc32ae525b491bcb9653ec755762321d2 (patch) | |
tree | e8f5b54298da0b2fa300c71da5a0eadf4fdccf26 /animation.hpp | |
parent | db9b5ba4ac75b3d4a2151e1b577928cfbb212bc1 (diff) | |
download | spheres-3140c22dc32ae525b491bcb9653ec755762321d2.tar.gz spheres-3140c22dc32ae525b491bcb9653ec755762321d2.tar.bz2 spheres-3140c22dc32ae525b491bcb9653ec755762321d2.zip |
Some refactoring.
Diffstat (limited to 'animation.hpp')
-rw-r--r-- | animation.hpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/animation.hpp b/animation.hpp index 26b3d55..b1ff815 100644 --- a/animation.hpp +++ b/animation.hpp @@ -28,10 +28,12 @@ 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) { - draw(p); - if (p.intersectsBoundary()) { + Sphere<2> pTmp = p; + pTmp.x = m.orientation.inverse().act(p.x); + draw(pTmp); + 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>)p.x + Δy, p.r}); + draw({(Vector<2>)pTmp.x + Δy, p.r}); } } } |