Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
lampda::modes::Particle Struct Reference

Define a particle in 3D space. it has a position and speed. More...

#include <particle.hpp>

Public Member Functions

 Particle ()
 Default particle init.
 
 Particle (const utils::vec3d &positionCartesian)
 Construct a Particle from a 3D cartesian position.
 
 Particle (const float positionTheta_rad, const float positionZ_mm)
 Construct a particle from an angle and height.
 
 Particle (const Particle &other)=default
 Copy constructor for a particle.
 
utils::vec2d compute_speed_increment (const utils::vec3d &accelerationCartesian_m, const float deltaTime_s) const
 Compute the speed increment in the constraint lamp body.
 
void apply_acceleration (const utils::vec3d &accelerationCartesian_m, const float deltaTime_s, const bool shouldContrain=true)
 apply a cartesian acceleration to this particulate
 
Particle simulate_after_acceleration (const utils::vec3d &accelerationCartesian_m, const float deltaTime_s, const bool shouldContrain=true) const
 Simulate this particle movement as a new particle.
 
void constraint_into_lamp_body ()
 Contrain the particle movement to the cylinder, limiting the movement at the extremities.
 
void dampen_speed (const float dampenFactor)
 Bleed off some speed. Simulate a dampening factor (like friction loss)
 
uint16_t to_lamp_index () const
 Convert this particle coordinates to a constraint lamp index.
 
int16_t to_lamp_index_no_bounds () const
 Convert this particle coordinates to an unconstraint lamp index.
 

Public Attributes

float thetaSpeed_radS
 angular speed, in radian/seconds
 
float zSpeed_mS
 linear speed, in meter/seconds
 
float theta_rad
 position, in radians
 
float z_mm
 height, in millimeters.
 
int16_t _savedLampIndex
 optimization
 

Detailed Description

Define a particle in 3D space. it has a position and speed.

Member Function Documentation

◆ apply_acceleration()

void lampda::modes::Particle::apply_acceleration ( const utils::vec3d accelerationCartesian_m,
const float  deltaTime_s,
const bool  shouldContrain = true 
)
inline

apply a cartesian acceleration to this particulate

Parameters
[in]accelerationCartesian_mAcceleration applied at this update
[in]deltaTime_sTime since the latest update
[in]shouldContrainIf true, will constrain the movement into the lamp body.

◆ compute_speed_increment()

utils::vec2d lampda::modes::Particle::compute_speed_increment ( const utils::vec3d accelerationCartesian_m,
const float  deltaTime_s 
) const
inline

Compute the speed increment in the constraint lamp body.

Parameters
[in]accelerationCartesian_mAcceleration applied at this update
[in]deltaTime_sTime since the latest update
Returns
The speed in angle and heigh.

◆ simulate_after_acceleration()

Particle lampda::modes::Particle::simulate_after_acceleration ( const utils::vec3d accelerationCartesian_m,
const float  deltaTime_s,
const bool  shouldContrain = true 
) const
inline

Simulate this particle movement as a new particle.

Parameters
[in]accelerationCartesian_mAcceleration applied at this update
[in]deltaTime_sTime since the latest update
[in]shouldContrainIf true, will constrain the movement into the lamp body.

The documentation for this struct was generated from the following file: