cloth

diff src/particle.h @ 0:92983e143a03

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 11 Feb 2013 19:40:36 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/particle.h	Mon Feb 11 19:40:36 2013 +0200
     1.3 @@ -0,0 +1,57 @@
     1.4 +#ifndef PARTICLE_H_
     1.5 +#define PARTICLE_H_
     1.6 +
     1.7 +#include <set>
     1.8 +#include "vmath/vmath.h"
     1.9 +
    1.10 +class SimWorld;
    1.11 +struct Collision;
    1.12 +
    1.13 +class Particle {
    1.14 +private:
    1.15 +	Vector3 forces;
    1.16 +	Vector3 pos, velocity;
    1.17 +	float rad;
    1.18 +	float elast;
    1.19 +	float mass;
    1.20 +	float friction;
    1.21 +
    1.22 +	std::set<const Particle*> ignorelist;
    1.23 +
    1.24 +public:
    1.25 +	Particle();
    1.26 +
    1.27 +	void add_ignore(const Particle *p);
    1.28 +
    1.29 +	void set_radius(float rad);
    1.30 +	float get_radius() const;
    1.31 +
    1.32 +	void set_mass(float m);
    1.33 +	float get_mass() const;
    1.34 +
    1.35 +	void set_elasticity(float e);
    1.36 +	float get_elasticity() const;
    1.37 +
    1.38 +	void set_position(const Vector3 &pos);
    1.39 +	void set_velocity(const Vector3 &vel);
    1.40 +
    1.41 +	Vector3 &get_position();
    1.42 +	const Vector3 &get_position() const;
    1.43 +	Vector3 &get_velocity();
    1.44 +	const Vector3 &get_velocity() const;
    1.45 +
    1.46 +	void set_friction(float frict);
    1.47 +	float get_friction() const;
    1.48 +
    1.49 +	void add_force(const Vector3 &fvec);
    1.50 +
    1.51 +	void step(SimWorld *world, float dt);
    1.52 +
    1.53 +	bool collision(const Particle *p2, Collision *col) const;
    1.54 +
    1.55 +	void draw() const;
    1.56 +
    1.57 +	friend class SimWorld;
    1.58 +};
    1.59 +
    1.60 +#endif	// PARTICLE_H_