From 3140c22dc32ae525b491bcb9653ec755762321d2 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Fri, 17 Sep 2021 12:40:44 +0200 Subject: Some refactoring. --- animation.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'animation.hpp') 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 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}); } } } -- cgit v1.2.3-54-g00ecf