Small fixed-endpoint Verlet rope simulation used by source reference connectors.
More...
#include "donner/editor/RopeSimulation.h"
|
|
| RopeSimulation ()=default |
| | Construct an empty rope simulation.
|
| void | reset (std::span< const Vector2d > route, const RopeSimulationOptions &options) |
| | Reset this rope by sampling route into evenly spaced simulated particles.
|
| void | resetCatenary (const Vector2d &start, const Vector2d &end, const RopeSimulationOptions &options) |
| | Reset this rope to a catenary between fixed endpoints.
|
| void | applyImpulse (const Vector2d &impulse) |
| | Add an instantaneous velocity impulse to interior rope particles.
|
| void | applyBottomImpulse (const Vector2d &impulse, double normalizedWidth) |
| | Add a localized velocity impulse centered on the lowest interior particle.
|
| void | update (const Vector2d &start, const Vector2d &end, double deltaTimeSeconds, double scrollDeltaY, double timeSeconds, std::uint32_t phaseSeed, bool frozen, const RopeSimulationOptions &options) |
| | Advance the rope by one frame.
|
|
std::span< const Vector2d > | points () const |
| | Return the simulated particle positions.
|
|
bool | empty () const |
| | Return true when this rope has no particles.
|
|
bool | needsAnimation () const |
| | Return true when this rope still needs timed animation frames.
|
|
Path | toPath (const RopeSimulationOptions &options) const |
| | Convert the current rope body into a Bézier path.
|
|
Vector2d | endTangent () const |
| | Return the final segment tangent for orienting an arrowhead.
|
Small fixed-endpoint Verlet rope simulation used by source reference connectors.
◆ applyBottomImpulse()
| void donner::editor::RopeSimulation::applyBottomImpulse |
( |
const Vector2d & | impulse, |
|
|
double | normalizedWidth ) |
Add a localized velocity impulse centered on the lowest interior particle.
- Parameters
-
| impulse | Screen-space velocity displacement at the catenary bottom. |
| normalizedWidth | Sine-normalized falloff width in [0, 1]. |
◆ applyImpulse()
| void donner::editor::RopeSimulation::applyImpulse |
( |
const Vector2d & | impulse | ) |
|
Add an instantaneous velocity impulse to interior rope particles.
- Parameters
-
| impulse | Screen-space velocity displacement applied with a sine envelope. |
◆ reset()
Reset this rope by sampling route into evenly spaced simulated particles.
- Parameters
-
| route | Polyline route from fixed start to fixed end. |
| options | Simulation options controlling segment count and smoothing. |
◆ resetCatenary()
Reset this rope to a catenary between fixed endpoints.
The resulting rest lengths come from the sampled catenary, so gravity and distance constraints settle toward the same hanging-curve family instead of a pre-routed polyline. The rope starts asleep with zero velocity; callers may wake it with applyBottomImpulse or endpoint motion.
- Parameters
-
| start | Fixed rope start point in screen coordinates. |
| end | Fixed rope end point in screen coordinates. |
| options | Simulation options controlling slack and segment count. |
◆ update()
| void donner::editor::RopeSimulation::update |
( |
const Vector2d & | start, |
|
|
const Vector2d & | end, |
|
|
double | deltaTimeSeconds, |
|
|
double | scrollDeltaY, |
|
|
double | timeSeconds, |
|
|
std::uint32_t | phaseSeed, |
|
|
bool | frozen, |
|
|
const RopeSimulationOptions & | options ) |
Advance the rope by one frame.
- Parameters
-
| start | Fixed rope start point in screen coordinates. |
| end | Fixed rope end point in screen coordinates. |
| deltaTimeSeconds | Frame delta time in seconds. |
| scrollDeltaY | Source-pane vertical scroll delta since the previous frame. |
| timeSeconds | Monotonic UI time in seconds, used for idle sway phase. |
| phaseSeed | Stable per-rope seed used to desynchronize idle sway. |
| frozen | If true, skip integration and keep the rope body stable for interaction. |
| options | Simulation options. |
The documentation for this class was generated from the following file: