This commit is contained in:
Philip Rosedale 2013-10-10 10:14:35 -07:00
parent dd09d686fc
commit 72273d1469

View file

@ -19,28 +19,28 @@ const int FIELD_ELEMENTS = 1000;
/// Field is a lattice of vectors uniformly distributed in 3D with FIELD_ELEMENTS^(1/3) per side
class Field {
public:
struct FieldElement {
glm::vec3 val;
glm::vec3 center;
glm::vec3 fld;
} _field[FIELD_ELEMENTS];
Field(float worldSize, float coupling);
/// The field value at a position in space, given simply as the value of the enclosing cell
int value(float *ret, float *pos);
/// Visualize the field as vector lines drawn at each center
void render();
/// Add to the field value cell enclosing a location
void add(float* add, float *loc);
/// A particle with a position and velocity interacts with the field given the coupling
/// constant passed when creating the field.
void interact(float deltaTime, const glm::vec3& pos, glm::vec3& vel);
/// Field evolves over timestep
void simulate(float deltaTime);
private:
float _worldSize;
float _coupling;
public:
struct FieldElement {
glm::vec3 val;
glm::vec3 center;
glm::vec3 fld;
} _field[FIELD_ELEMENTS];
Field(float worldSize, float coupling);
/// The field value at a position in space, given simply as the value of the enclosing cell
int value(float *ret, float *pos);
/// Visualize the field as vector lines drawn at each center
void render();
/// Add to the field value cell enclosing a location
void add(float* add, float *loc);
/// A particle with a position and velocity interacts with the field given the coupling
/// constant passed when creating the field.
void interact(float deltaTime, const glm::vec3& pos, glm::vec3& vel);
/// Field evolves over timestep
void simulate(float deltaTime);
private:
float _worldSize;
float _coupling;
};
#endif