cleanup repulsion force calculation

This commit is contained in:
2026-02-22 15:07:28 +01:00
parent 2580d6d527
commit 9726d5fecc
5 changed files with 76 additions and 57 deletions

View File

@ -37,7 +37,7 @@ constexpr float DAMPENING_CONSTANT = 1.0;
constexpr float REST_LENGTH = 2.0;
constexpr float REPULSION_FORCE = 0.1;
constexpr float REPULSION_RANGE = 5.0 * REST_LENGTH;
constexpr int REPULSION_GRID_REFRESH = 5; // Frames between grid rebuilds
constexpr int REPULSION_GRID_REFRESH = 5; // Updates between grid rebuilds
constexpr float VERLET_DAMPENING = 0.05; // [0, 1]
// Graph Drawing

View File

@ -86,8 +86,8 @@ public:
class MassSpringSystem {
private:
std::vector<Mass *> mass_vec;
std::vector<int> indices;
std::vector<Mass *> mass_pointers;
std::vector<int> mass_indices;
std::vector<int64_t> cell_ids;
int last_build;
int last_masses_count;
@ -110,7 +110,7 @@ public:
~MassSpringSystem() {};
private:
auto BuildGrid() -> void;
auto BuildUniformGrid() -> void;
public:
auto AddMass(float mass, bool fixed, const State &state) -> void;

View File

@ -2,9 +2,9 @@
#define __STATE_HPP_
#include "config.hpp"
#include "puzzle.hpp"
#include "physics.hpp"
#include "presets.hpp"
#include "puzzle.hpp"
#include <raymath.h>