diff options
author | Jakob Odersky <jodersky@gmail.com> | 2011-05-11 14:59:00 +0000 |
---|---|---|
committer | Jakob Odersky <jodersky@gmail.com> | 2011-05-11 14:59:00 +0000 |
commit | 64d6cd8a7ed46be4a34b4818705186f8e0998ab1 (patch) | |
tree | 0a889a5ff9bdb7a010bb9e028a5dc2ca0d05be65 /src/main/Particle.cc | |
parent | ff64cec5fdf5b18e6aee31e8b3148a0305e1d1de (diff) | |
download | vhc-64d6cd8a7ed46be4a34b4818705186f8e0998ab1.tar.gz vhc-64d6cd8a7ed46be4a34b4818705186f8e0998ab1.tar.bz2 vhc-64d6cd8a7ed46be4a34b4818705186f8e0998ab1.zip |
Rajoute getHorizontalAt() pour tous les elements, en vue des faisceaux
Diffstat (limited to 'src/main/Particle.cc')
-rw-r--r-- | src/main/Particle.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/Particle.cc b/src/main/Particle.cc index 5784625..6e5eb0b 100644 --- a/src/main/Particle.cc +++ b/src/main/Particle.cc @@ -44,7 +44,7 @@ void Particle::applyForce(const Vector3D& f) {force += f;} void Particle::applyMagneticForce(const Vector3D& b, double dt) { if (dt != 0 && b != Vector3D::Null) { Vector3D f = charge * velocity.cross(b); - applyForce(f.rotate(velocity.cross(f), asin((dt * f.norm()) / (2 * gamma * mass * velocity.norm())))); + applyForce(f.rotate(velocity.cross(f), asin(1.0 * (dt * f.norm()) / (2 * gamma * mass * velocity.norm())))); } } @@ -70,6 +70,7 @@ std::string Particle::toString() const { s << "\tposition: " << position << "\n"; s << "\tvelocity: " << velocity; s << "\tnorm: " << velocity.norm() << "\n"; + s << "\tenergy: " << getEnergy() << "\n"; s << "\tforce: " << force << "\n"; s << "\tgamma: " << gamma << "\n"; s << "\tmass: " << mass << "\n"; |