|
Lamp-Da 0.1
A compact lantern project
|
Define a particle in 3D space. it has a position and speed. More...
#include <particle.hpp>
Public Member Functions | |
| Particle ()=default | |
| Default particle init. | |
| Particle (const Particle &other)=default | |
| Copy constructor for a particle. | |
| 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. | |
| utils::vec2d | compute_speed_increment (const utils::vec3d &accelerationCartesian_m, const float deltaTime_s) const |
| Compute the speed increment in the constraint lamp body. | |
| utils::vec2d | update_speed (const utils::vec3d &accelerationCartesian_m, const float deltaTime_s) |
| Dampen the speed and apply a cartesian acceleration to it, without moving the particle. | |
| 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) | |
| void | set_color (const uint32_t color) |
| uint32_t | get_color () const |
| 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: the nearest led of the helix. | |
| int16_t | led_index_at_offset (const utils::vec2d &offset_mm) const |
| Return the led under this particle, once moved by an offset on the cylinder surface (in mm). | |
| utils::vec2d | get_surface_speed () const |
| Return the speed on the cylinder surface, in mm/s (around the tube, along the height) | |
| void | move_by (const utils::vec2d &offset_mm, const int16_t ledIndex) |
| Move this particle on the cylinder surface, to a led already computed from this offset. | |
Static Public Member Functions | |
| static int16_t | led_index_at (const float positionTheta_rad, const float positionZ_mm) |
| Find the led nearest to a position, following the real helix of the strip. A led height depends on its angle: choosing the turn from the height alone would be up to a full row wrong. | |
| static float | potential_at_led (const utils::vec3d &accelerationCartesian_m, const int16_t ledIndex) |
| Potential energy of a led under an acceleration, consistent with the acceleration of a particle. | |
Define a particle in 3D space. it has a position and speed.
|
inline |
apply a cartesian acceleration to this particulate
| [in] | accelerationCartesian_m | Acceleration applied at this update |
| [in] | deltaTime_s | Time since the latest update |
| [in] | shouldContrain | If true, will constrain the movement into the lamp body. |
|
inline |
Compute the speed increment in the constraint lamp body.
| [in] | accelerationCartesian_m | Acceleration applied at this update |
| [in] | deltaTime_s | Time since the latest update |
|
inlinestatic |
Find the led nearest to a position, following the real helix of the strip. A led height depends on its angle: choosing the turn from the height alone would be up to a full row wrong.
| [in] | positionTheta_rad | Angle of the position, in radians. |
| [in] | positionZ_mm | Height of the position, in millimeters. |
|
inlinestatic |
Potential energy of a led under an acceleration, consistent with the acceleration of a particle.
| [in] | accelerationCartesian_m | Acceleration applied at this update |
| [in] | ledIndex | Index of the led. It can be out of the strip. |
|
inline |
Simulate this particle movement as a new particle.
| [in] | accelerationCartesian_m | Acceleration applied at this update |
| [in] | deltaTime_s | Time since the latest update |
| [in] | shouldContrain | If true, will constrain the movement into the lamp body. |
|
inline |
Dampen the speed and apply a cartesian acceleration to it, without moving the particle.
| [in] | accelerationCartesian_m | Acceleration applied at this update |
| [in] | deltaTime_s | Time since the latest update |