Changeset 10630
- Timestamp:
- Oct 10, 2015, 6:36:49 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/util/Math.cc
r10291 r10630 358 358 float discriminant = b*b - 4*a*c; 359 359 if (discriminant < 0) 360 return orxonox::Vector3::ZERO; 361 360 return orxonox::Vector3::ZERO; // solution is undefined (e.g. target faster than projectile) 361 362 if (a == 0.0f) 363 return orxonox::Vector3::ZERO; // avoid division by zero 362 364 float solution = (-b + sqrt(discriminant)) / (2 * a); 365 366 if (solution == 0.0f) 367 return orxonox::Vector3::ZERO; // avoid division by zero 363 368 float time = 1.0f / solution; 364 369
Note: See TracChangeset
for help on using the changeset viewer.