|
| | TransitioningWaveField (std::shared_ptr< WaveField > initial) |
| |
| void | StartTransition (std::shared_ptr< WaveField > newField, double startTime, double duration) |
| |
| std::shared_ptr< WaveField > | GetCurrentField () const |
| |
| bool | IsSettled (double time) const |
| |
| std::string | SpectrumName () const override |
| | Returns the spectrum name of the current destination wave field.
|
| |
| std::string | WaveTheoryName () const override |
| | Returns the wave theory name of the current destination wave field.
|
| |
| marenv::Status | ComputeSurfaceElevation (double time, const double pos[2], double &elevationOut) override |
| | Computes surface elevation; interpolates between source and destination during a transition.
|
| |
| double | MaxWaveElevation () const override |
| |
| marenv::Status | ComputeSurfaceUnitNormal (double time, const double pos[2], double unitNormalOut[3]) override |
| | Computes surface unit normal; interpolates component-wise and renormalises during a transition.
|
| |
| marenv::Status | ComputeParticleVelocity (double time, const double pos[3], double velOut[3]) override |
| | Computes particle velocity; interpolates between source and destination during a transition.
|
| |
| marenv::Status | ComputeParticleAcceleration (double time, const double pos[3], double accOut[3]) override |
| | Computes particle acceleration; interpolates between source and destination during a transition.
|
| |
| marenv::Status | ComputeDynamicPressure (double time, const double pos[3], double &pressureOut) override |
| | Computes dynamic pressure; interpolates between source and destination during a transition.
|
| |
| marenv::Status | ComputeTotalPressure (double time, const double pos[3], double &pressureOut) override |
| | Computes total pressure; interpolates between source and destination during a transition.
|
| |
| marenv::Status | ComputePointQuery (double time, const double pos[3], double &surface_elevation, double surface_unit_normal[3], double particle_velocity[3], double particle_acceleration[3], double &pressure) override |
| | Computes a full point query; all outputs are interpolated during a transition.
|
| |
| InsecureDatapointers | GetWaveComponents () const override |
| |
| marenv::wave::WaveComponentData | GetWaveComponentsCopy () const override |
| |
| marenv::wave::WaveComponentData | GetWaveComponentsCopy (double time, size_t maxComponents=0) const override |
| |
| virtual | ~WaveField ()=default |
| |
Decorator that cross-fades between two WaveField instances in output space.
When no transition is active, all queries delegate directly to the current (destination) wave field. During a transition the decorator evaluates both the source and destination fields at the queried (time, position) and returns the linearly interpolated result:
\[
result(t) = (1 - \alpha(t)) \cdot from(t) + \alpha(t) \cdot to(t),
\quad \alpha(t) = \mathrm{clamp}\!\big((t - t_0) / (t_1 - t_0),\, 0,\, 1\big)
\]
Surface normals are interpolated component-wise and renormalised.
Thread safety follows the same snapshot pattern used elsewhere in the library: a TransitionSnapshot is published atomically so that in-flight Compute* calls see a consistent view while StartTransition() swaps in a new snapshot without blocking readers.
- Note
- The blend is of outputs, not of waves: it is not kinematically consistent (the blended elevation, velocity and acceleration do not obey the wave equations of either field while α changes). Make the transition time long compared with the wave periods (N5).
-
Performance: during an active transition every Compute* call evaluates both wave fields (2x cost). Outside the transition window the cost is a single shared_ptr load plus one virtual dispatch.
| void marenv::wave::TransitioningWaveField::StartTransition |
( |
std::shared_ptr< WaveField > |
newField, |
|
|
double |
startTime, |
|
|
double |
duration |
|
) |
| |
Begin a cross-fade from the current wave field to a new one.
- Parameters
-
| [in] | newField | The target wave field. Must not be null. |
| [in] | startTime | Simulation time at which the cross-fade begins (α = 0). Must not be NaN. |
| [in] | duration | Duration of the cross-fade in seconds. Must be >= 0. |
- Exceptions
-
| std::invalid_argument | if newField is null, startTime is NaN, or duration is NaN or negative. |
A duration of 0 is an immediate swap: newField is in force at once (at every query time, also before startTime), with no blend and no chain of earlier fields kept.
If a transition is already in progress at startTime, the new transition starts from the blend as it is at that time (owner ruling D19, as MENV-0010 for the wakes): the weight of the running blend is frozen at its value at startTime and the two fields go on moving, so the output is continuous across the retarget. Before the running transition starts the source is the field in force, A; after it ended, its destination. Each retarget during a transition adds one frozen blend to the chain of fields that are kept alive until the new transition ends.