Public Member Functions | Public Attributes

bl7::particles2::Particle Class Reference

#include <Particle.h>

List of all members.

Public Member Functions

 Particle (void)
 ~Particle (void)
 Particle (const Particle &rhs)
Particleoperator= (const Particle &rhs)
ml7::Vector2 get_position () const
void get_position (ml7::Vector2 *p) const
ml7::Vector2 get_velocity () const
void get_velocity (ml7::Vector2 *v) const
ml7::Vector2 get_acceleration () const
void get_acceleration (ml7::Vector2 *a) const
ml7::Vector2 get_force () const
void get_force (ml7::Vector2 *f) const
float get_damping () const
void get_damping (float *d) const
float get_inverse_mass () const
void get_inverse_mass (float *im) const
float get_mass () const
void get_mass (float *m) const
bool has_finite_mass () const
void * get_user_data () const
void set_position (const ml7::Vector2 &p)
void set_velocity (const ml7::Vector2 &v)
void set_acceleration (const ml7::Vector2 &a)
void reset_force ()
void add_force (const ml7::Vector2 &f)
void set_damping (const float d)
void set_inverse_mass (const float im)
void set_mass (const float m)
void set_user_data (void *user_data)

Public Attributes

ml7::Vector2 position
ml7::Vector2 velocity
ml7::Vector2 acceleration
ml7::Vector2 force
float damping
float inverse_mass
friend Dynamics

Detailed Description

Class for 2d particles. Holds vectors for position, velocity, acceleration and accumulated forces as well as floats for the damping value and the inverse mass (instead of the actual mass because zero mass makes no sense and infinity mass is easily represented by 0 -- moreover most of the computations use the inverse mass and not the actual mass so the needless division slips). The class provides functions to access and manipulate attributes and to integrate over time to update the position and velocity.


Constructor & Destructor Documentation

bl7::particles2::Particle::Particle ( void   )  [inline]

Default constructor.

bl7::particles2::Particle::~Particle ( void   )  [inline]

Destructor.

bl7::particles2::Particle::Particle ( const Particle rhs  )  [inline]

Copy constructor.


Member Function Documentation

void bl7::particles2::Particle::add_force ( const ml7::Vector2 f  )  [inline]

Adds a given force to this particle to be applied during next integration.

ml7::Vector2 bl7::particles2::Particle::get_acceleration (  )  const [inline]

Returns the linear acceleration of this particle.

void bl7::particles2::Particle::get_acceleration ( ml7::Vector2 a  )  const [inline]

Stores the linear acceleration of this paricle in the given vector.

float bl7::particles2::Particle::get_damping (  )  const [inline]

Returns the damping of this particle.

void bl7::particles2::Particle::get_damping ( float *  d  )  const [inline]

Stores the damping of this paricle in the given float.

void bl7::particles2::Particle::get_force ( ml7::Vector2 f  )  const [inline]

Stores the linear force of this paricle in the given vector.

ml7::Vector2 bl7::particles2::Particle::get_force (  )  const [inline]

Returns the linear force of this particle.

float bl7::particles2::Particle::get_inverse_mass (  )  const [inline]

Returns the inverse mass of this particle.

void bl7::particles2::Particle::get_inverse_mass ( float *  im  )  const [inline]

Stores the inverse mass of this paricle in the given float.

float bl7::particles2::Particle::get_mass (  )  const [inline]

Returns the mass of this particle.

void bl7::particles2::Particle::get_mass ( float *  m  )  const [inline]

Stores the mass of this paricle in the given float.

void bl7::particles2::Particle::get_position ( ml7::Vector2 p  )  const [inline]

Stores the linear position of this particle in the given vector.

ml7::Vector2 bl7::particles2::Particle::get_position (  )  const [inline]

Returns the linear position of this particle.

void* bl7::particles2::Particle::get_user_data (  )  const [inline]

Returns the pointer to any user data structure (or NULL).

ml7::Vector2 bl7::particles2::Particle::get_velocity (  )  const [inline]

Returns the linear velocity of this particle.

void bl7::particles2::Particle::get_velocity ( ml7::Vector2 v  )  const [inline]

Stores the linear velocity of this paricle in the given vector.

bool bl7::particles2::Particle::has_finite_mass (  )  const [inline]

Determines whether this particle has finite mass (inverse mass > 0).

Particle& bl7::particles2::Particle::operator= ( const Particle rhs  )  [inline]

Copy assignment operator.

void bl7::particles2::Particle::reset_force (  )  [inline]

Resets the accumulated force of this particle to zero.

void bl7::particles2::Particle::set_acceleration ( const ml7::Vector2 a  )  [inline]

Sets the linear acceleration of this particle.

void bl7::particles2::Particle::set_damping ( const float  d  )  [inline]

Sets the damping of this particle.

void bl7::particles2::Particle::set_inverse_mass ( const float  im  )  [inline]

Sets the inverse mass of this particle.

void bl7::particles2::Particle::set_mass ( const float  m  )  [inline]

Sets the mass of this particle.

void bl7::particles2::Particle::set_position ( const ml7::Vector2 p  )  [inline]

Sets the linear position of this particle.

void bl7::particles2::Particle::set_user_data ( void *  user_data  )  [inline]

Sets the pointer to any user data structure (or NULL).

void bl7::particles2::Particle::set_velocity ( const ml7::Vector2 v  )  [inline]

Sets the linear velocity of this particle.


Member Data Documentation

The linear acceleration of this particle. Can be set due to gravity (or the like).

The amount of damping applied to linear motion of this particle. It is required to remove energy added through numerical instability during integration.

The linear force (accumulated) to be applied at the next integration only.

The inverse of the mass of this particle. It is more useful than holding the actual mass because zero mass makes no sense (completely unstable in numerical simulation) and infinite mass (immovable) now is easily represented by 0. Moreover most of the computations use the inverse mass and not the actual mass so the needless division slips.

The linear position of this particle in world space.

The linear velocity of this particle in world space.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines