Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Bycob committed Dec 12, 2016
2 parents 2011cca + 30af252 commit 180d4ea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
6 changes: 3 additions & 3 deletions simulation/Simulation.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//
//
// Created by louis on 19/11/16.
//

Expand Down Expand Up @@ -458,8 +458,8 @@ void Simulation::update(double time, bool printInfos) {
if (_pause) return;

//Mise à jour du monde (précision ~ 1h) t*10e6
const double timeScale = _timeScale * time * (_reverse ? -1 : 1);
const double baseStep = _physicalStep;
const double timeScale = _timeScale * time;
const double baseStep = _physicalStep * (_reverse ? -1 : 1);
_world->step(baseStep, (int) fabs(timeScale / baseStep));

// Affichage
Expand Down
16 changes: 15 additions & 1 deletion simulation/utils.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//
//
// Created by louis on 13/11/16.
//

Expand Down Expand Up @@ -132,4 +132,18 @@ inline bool startsWith(const std::string & item, const std::string & prefix) {
return true;
}

inline bool endsWith(const std::string & item, const std::string & suffix) {
if (item.size() < suffix.size()) {
return false;
}

for (int i = item.size(), j = suffix.size(); j >= 0; i--, j--) {
if (item[i] != suffix[j]) {
return false;
}
}

return true;
}

#endif // SIMULATION_UTILS_H

0 comments on commit 180d4ea

Please sign in to comment.