Particle​ Simulation Documentation
Loading...
Searching...
No Matches
Particle Class Reference

#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.
 

Constructor & Destructor Documentation

◆ Particle()

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.

Parameters
[in]positionThe position (m)
[in]velocityThe velocity (m/s)
[in]accelerationThe acceleration (m/s²)
[in]radiusThe radius (m)
[in]massThe mass (kg)
[in]colorThe color
[in]nameThe name

Member Function Documentation

◆ addTrailPoint()

void Particle::addTrailPoint ( const std::array< double, 3 > & point)

Adds a trail point.

Parameters
[in]pointThe point
Here is the caller graph for this function:

◆ getAcceleration()

std::array< double, 3 > Particle::getAcceleration ( ) const

Gets the acceleration.

Returns
The acceleration.
Here is the caller graph for this function:

◆ getColor()

std::array< int, 3 > Particle::getColor ( ) const

Gets the color.

Returns
The color.
Here is the caller graph for this function:

◆ getMass()

double Particle::getMass ( ) const

Gets the mass.

Returns
The mass.
Here is the caller graph for this function:

◆ getPosition()

std::array< double, 3 > Particle::getPosition ( ) const

Gets the position.

Returns
The position.
Here is the caller graph for this function:

◆ getRadius()

double Particle::getRadius ( ) const

Gets the radius.

Returns
The radius.
Here is the caller graph for this function:

◆ getTrail()

const std::deque< std::array< double, 3 > > & Particle::getTrail ( ) const

Gets the trail.

Returns
The trail.
Here is the caller graph for this function:

◆ getVelocity()

std::array< double, 3 > Particle::getVelocity ( ) const

Gets the velocity.

Returns
The velocity.
Here is the caller graph for this function:

◆ getVX()

double Particle::getVX ( ) const

Gets the x coordinate of the velocity.

Returns
The x.
Here is the caller graph for this function:

◆ getVY()

double Particle::getVY ( ) const

Gets the y coordinate of the velocity.

Returns
The y.
Here is the caller graph for this function:

◆ getVZ()

double Particle::getVZ ( ) const

Gets the z coordinate of the velocity.

Returns
The z.
Here is the caller graph for this function:

◆ getX()

double Particle::getX ( ) const

Gets the x coordinate of the posision.

Returns
The x.
Here is the caller graph for this function:

◆ getY()

double Particle::getY ( ) const

Gets the y coordinate of the posision.

Returns
The y.
Here is the caller graph for this function:

◆ getZ()

double Particle::getZ ( ) const

Gets the y coordinate of the posision.

Returns
The y.
Here is the caller graph for this function:

◆ setAcceleration()

void Particle::setAcceleration ( const std::array< double, 3 > & acceleration)

Sets the acceleration.

Parameters
[in]accelerationThe acceleration
Here is the caller graph for this function:

◆ setAX()

void Particle::setAX ( double ax)

Sets the x coordinate of the acceleration.

Parameters
[in]axThe new value

◆ setAY()

void Particle::setAY ( double ay)

Sets the y coordinate of the acceleration.

Parameters
[in]ayThe new value

◆ setAZ()

void Particle::setAZ ( double az)

Sets the z coordinate of the acceleration.

Parameters
[in]azThe new value

◆ setMass()

void Particle::setMass ( double mass)

Sets the mass.

Parameters
[in]massThe mass

◆ setPosition()

void Particle::setPosition ( const std::array< double, 3 > & position)

Sets the position.

Parameters
[in]positionThe position
Here is the caller graph for this function:

◆ setRadius()

void Particle::setRadius ( double radius)

Sets the radius.

Parameters
[in]radiusThe radius

◆ setVelocity()

void Particle::setVelocity ( const std::array< double, 3 > & velocity)

Sets the velocity.

Parameters
[in]velocityThe velocity
Here is the caller graph for this function:

◆ setVX()

void Particle::setVX ( double vx)

Sets the x coordinate of the velocity.

Parameters
[in]vxThe new value
Here is the caller graph for this function:

◆ setVY()

void Particle::setVY ( double vy)

Sets the y coordinate of the velocity.

Parameters
[in]vyThe new value
Here is the caller graph for this function:

◆ setVZ()

void Particle::setVZ ( double vz)

Sets the z coordinate of the velocity.

Parameters
[in]vzThe new value
Here is the caller graph for this function:

◆ setX()

void Particle::setX ( double x)

Sets the x coordinate of the position.

Parameters
[in]xThe new value
Here is the caller graph for this function:

◆ setY()

void Particle::setY ( double y)

Sets the y coordinate of the position.

Parameters
[in]yThe new value
Here is the caller graph for this function:

◆ setZ()

void Particle::setZ ( double z)

Sets the z coordinate of the position.

Parameters
[in]zThe new value
Here is the caller graph for this function:

◆ update()

void Particle::update ( double deltaTime)

Updates the particle.

Parameters
[in]deltaTimeThe delta time
Here is the call graph for this function:

Member Data Documentation

◆ m_acceleration

std::array<double, 3> Particle::m_acceleration
private

Particle acceleration (in m/s²).

◆ m_color

std::array<int, 3> Particle::m_color
private

Particle colors.

◆ m_mass

double Particle::m_mass
private

Particle mass (in kg).

◆ m_maxTrailLength

size_t Particle::m_maxTrailLength = 5000
staticconstexprprivate

max trail particle length.

◆ m_name

const std::string Particle::m_name

particle name.

◆ m_position

std::array<double, 3> Particle::m_position
private

Particle position (in m).

◆ m_radius

double Particle::m_radius
private

Particle radius (in m).

◆ m_trail

std::deque<std::array<double, 3> > Particle::m_trail
private

trail particle.

◆ m_velocity

std::array<double, 3> Particle::m_velocity
private

Particle velocity (in m/s).