Skip to content
Snippets Groups Projects
Verified Commit 4172304d authored by Josch Morgenstern's avatar Josch Morgenstern
Browse files

[#111] change location constraints

parent 40e680ee
Branches
Tags
1 merge request!95Resolve "Wassersimulation mit Interaktion"
...@@ -41,44 +41,44 @@ void main() { ...@@ -41,44 +41,44 @@ void main() {
} }
vec3 accel = inParticle[id].force / inParticle[id].density; vec3 accel = inParticle[id].force / inParticle[id].density;
vec3 vel_new = inParticle[id].velocity + dt * accel; vec3 vel_new = inParticle[id].velocity + (dt * accel);
vec3 pos_new = inParticle[id].position + dt * vel_new; vec3 pos_new = inParticle[id].position + (dt * vel_new);
// Überprüfe Randbedingungen x // Überprüfe Randbedingungen x
if (inParticle[id].position.x < 0.2) if (inParticle[id].position.x < -1.0)
{ {
vel_new.x *= -ABSORBTION; vel_new.x *= -ABSORBTION;
pos_new.x = 0.2; pos_new.x = -1.0;
} }
else if (inParticle[id].position.x > 0.6) else if (inParticle[id].position.x > 1.0)
{ {
vel_new.x *= -ABSORBTION; vel_new.x *= -ABSORBTION;
pos_new.x = 0.6; pos_new.x = 1.0;
} }
// Überprüfe Randbedingungen y // Überprüfe Randbedingungen y
if (inParticle[id].position.y < 0.2) if (inParticle[id].position.y < -1.0)
{ {
vel_new.y *= -ABSORBTION; vel_new.y *= -ABSORBTION;
pos_new.y = 0.2; pos_new.y = -1.0;
} }
else if (inParticle[id].position.y > 0.6) else if (inParticle[id].position.y > 1.0)
{ {
vel_new.y *= -ABSORBTION; vel_new.y *= -ABSORBTION;
pos_new.y = 0.6; pos_new.y = 1.0;
} }
// Überprüfe Randbedingungen z // Überprüfe Randbedingungen z
if (inParticle[id].position.z < 0.2 ) if (inParticle[id].position.z < -1.0 )
{ {
vel_new.z *= -ABSORBTION; vel_new.z *= -ABSORBTION;
pos_new.z = 0.2; pos_new.z = -1.0;
} }
else if (inParticle[id].position.z > 0.6 ) else if (inParticle[id].position.z > 1.0 )
{ {
vel_new.z *= -ABSORBTION; vel_new.z *= -ABSORBTION;
pos_new.z = 0.6; pos_new.z = 1.0;
} }
outParticle[id].force = inParticle[id].force; outParticle[id].force = inParticle[id].force;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment