Particle Simulation Documentation
|
#include <particle.h>
Public Member Functions | |
Particle (const std::array< double, 3 > &position, const std::array< double, 3 > &velocity, const std::array< double, 3 > &acceleration, const double radius, const double mass, const std::array< int, 3 > &color, const std::string &name="") | |
Initialize particle. | |
std::array< double, 3 > | getPosition () const |
Gets the position. | |
double | getX () const |
Gets the x coordinate of the posision. | |
double | getY () const |
Gets the y coordinate of the posision. | |
double | getZ () const |
Gets the y coordinate of the posision. | |
void | setPosition (const std::array< double, 3 > &position) |
Sets the position. | |
void | setX (double x) |
Sets the x coordinate of the position. | |
void | setY (double y) |
Sets the y coordinate of the position. | |
void | setZ (double z) |
Sets the z coordinate of the position. | |
std::array< double, 3 > | getVelocity () const |
Gets the velocity. | |
double | getVX () const |
Gets the x coordinate of the velocity. | |
double | getVY () const |
Gets the y coordinate of the velocity. | |
double | getVZ () const |
Gets the z coordinate of the velocity. | |
void | setVelocity (const std::array< double, 3 > &velocity) |
Sets the velocity. | |
void | setVX (double vx) |
Sets the x coordinate of the velocity. | |
void | setVY (double vy) |
Sets the y coordinate of the velocity. | |
void | setVZ (double vz) |
Sets the z coordinate of the velocity. | |
std::array< double, 3 > | getAcceleration () const |
Gets the acceleration. | |
void | setAcceleration (const std::array< double, 3 > &acceleration) |
Sets the acceleration. | |
void | setAX (double ax) |
Sets the x coordinate of the acceleration. | |
void | setAY (double ay) |
Sets the y coordinate of the acceleration. | |
void | setAZ (double az) |
Sets the z coordinate of the acceleration. | |
double | getRadius () const |
Gets the radius. | |
void | setRadius (double radius) |
Sets the radius. | |
double | getMass () const |
Gets the mass. | |
void | setMass (double mass) |
Sets the mass. | |
std::array< int, 3 > | getColor () const |
Gets the color. | |
void | update (double deltaTime) |
Updates the particle. | |
void | addTrailPoint (const std::array< double, 3 > &point) |
Adds a trail point. | |
const std::deque< std::array< double, 3 > > & | getTrail () const |
Gets the trail. | |
Public Attributes | |
const std::string | m_name |
particle name. | |
Private Attributes | |
std::array< double, 3 > | m_position |
Particle position (in m). | |
std::array< double, 3 > | m_velocity |
Particle velocity (in m/s). | |
std::array< double, 3 > | m_acceleration |
Particle acceleration (in m/s²). | |
double | m_radius |
Particle radius (in m). | |
double | m_mass |
Particle mass (in kg). | |
std::array< int, 3 > | m_color |
Particle colors. | |
std::deque< std::array< double, 3 > > | m_trail |
trail particle. | |
Static Private Attributes | |
static constexpr size_t | m_maxTrailLength = 5000 |
max trail particle length. | |
Particle::Particle | ( | const std::array< double, 3 > & | position, |
const std::array< double, 3 > & | velocity, | ||
const std::array< double, 3 > & | acceleration, | ||
const double | radius, | ||
const double | mass, | ||
const std::array< int, 3 > & | color, | ||
const std::string & | name = "" ) |
Initialize particle.
[in] | position | The position (m) |
[in] | velocity | The velocity (m/s) |
[in] | acceleration | The acceleration (m/s²) |
[in] | radius | The radius (m) |
[in] | mass | The mass (kg) |
[in] | color | The color |
[in] | name | The name |
void Particle::addTrailPoint | ( | const std::array< double, 3 > & | point | ) |
Adds a trail point.
[in] | point | The point |
std::array< double, 3 > Particle::getAcceleration | ( | ) | const |
Gets the acceleration.
std::array< int, 3 > Particle::getColor | ( | ) | const |
Gets the color.
double Particle::getMass | ( | ) | const |
Gets the mass.
std::array< double, 3 > Particle::getPosition | ( | ) | const |
Gets the position.
double Particle::getRadius | ( | ) | const |
Gets the radius.
const std::deque< std::array< double, 3 > > & Particle::getTrail | ( | ) | const |
Gets the trail.
std::array< double, 3 > Particle::getVelocity | ( | ) | const |
Gets the velocity.
double Particle::getVX | ( | ) | const |
Gets the x coordinate of the velocity.
double Particle::getVY | ( | ) | const |
Gets the y coordinate of the velocity.
double Particle::getVZ | ( | ) | const |
Gets the z coordinate of the velocity.
double Particle::getX | ( | ) | const |
Gets the x coordinate of the posision.
double Particle::getY | ( | ) | const |
Gets the y coordinate of the posision.
double Particle::getZ | ( | ) | const |
Gets the y coordinate of the posision.
void Particle::setAcceleration | ( | const std::array< double, 3 > & | acceleration | ) |
Sets the acceleration.
[in] | acceleration | The acceleration |
void Particle::setAX | ( | double | ax | ) |
Sets the x coordinate of the acceleration.
[in] | ax | The new value |
void Particle::setAY | ( | double | ay | ) |
Sets the y coordinate of the acceleration.
[in] | ay | The new value |
void Particle::setAZ | ( | double | az | ) |
Sets the z coordinate of the acceleration.
[in] | az | The new value |
void Particle::setMass | ( | double | mass | ) |
Sets the mass.
[in] | mass | The mass |
void Particle::setPosition | ( | const std::array< double, 3 > & | position | ) |
Sets the position.
[in] | position | The position |
void Particle::setRadius | ( | double | radius | ) |
Sets the radius.
[in] | radius | The radius |
void Particle::setVelocity | ( | const std::array< double, 3 > & | velocity | ) |
Sets the velocity.
[in] | velocity | The velocity |
void Particle::setVX | ( | double | vx | ) |
Sets the x coordinate of the velocity.
[in] | vx | The new value |
void Particle::setVY | ( | double | vy | ) |
Sets the y coordinate of the velocity.
[in] | vy | The new value |
void Particle::setVZ | ( | double | vz | ) |
Sets the z coordinate of the velocity.
[in] | vz | The new value |
void Particle::setX | ( | double | x | ) |
Sets the x coordinate of the position.
[in] | x | The new value |
void Particle::setY | ( | double | y | ) |
Sets the y coordinate of the position.
[in] | y | The new value |
void Particle::setZ | ( | double | z | ) |
Sets the z coordinate of the position.
[in] | z | The new value |
void Particle::update | ( | double | deltaTime | ) |
Updates the particle.
[in] | deltaTime | The delta time |
|
private |
Particle acceleration (in m/s²).
|
private |
Particle colors.
|
private |
Particle mass (in kg).
|
staticconstexprprivate |
max trail particle length.
const std::string Particle::m_name |
particle name.
|
private |
Particle position (in m).
|
private |
Particle radius (in m).
|
private |
trail particle.
|
private |
Particle velocity (in m/s).