diff options
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}); } } } |