summaryrefslogtreecommitdiff
path: root/animation.hpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2021-09-17 12:40:44 +0200
committerJaron Kent-Dobias <jaron@kent-dobias.com>2021-09-17 12:40:44 +0200
commit3140c22dc32ae525b491bcb9653ec755762321d2 (patch)
treee8f5b54298da0b2fa300c71da5a0eadf4fdccf26 /animation.hpp
parentdb9b5ba4ac75b3d4a2151e1b577928cfbb212bc1 (diff)
downloadspheres-3140c22dc32ae525b491bcb9653ec755762321d2.tar.gz
spheres-3140c22dc32ae525b491bcb9653ec755762321d2.tar.bz2
spheres-3140c22dc32ae525b491bcb9653ec755762321d2.zip
Some refactoring.
Diffstat (limited to 'animation.hpp')
-rw-r--r--animation.hpp8
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});
}
}
}