Physics Simulation & Visualization Tool 0.1
A C++ physics simulation engine with real-time 3D visualization
Loading...
Searching...
No Matches
InterceptSolver Class Reference

A linear "monitor" solver that stops simulation when a condition is met. More...

#include <InterceptSolver.h>

Inheritance diagram for InterceptSolver:
[legend]
Collaboration diagram for InterceptSolver:
[legend]

Public Types

using MonitorFunction = std::function< float()>
 
using TimeoutCondition = std::function< bool()>
 

Public Member Functions

 InterceptSolver (MonitorFunction monitorFunc, TimeoutCondition timeoutFunc=nullptr)
 Construct a new Intercept Solver.
 
bool stepFrame () override
 Checks the current simulation state against the intercept conditions.
 
- Public Member Functions inherited from ISolver
virtual ~ISolver ()=default
 Virtual destructor for proper cleanup of derived classes.
 

Detailed Description

A linear "monitor" solver that stops simulation when a condition is met.

This solver is used for "Forward Problems" where the initial conditions are known, and we simply need to run the simulation until a specific event occurs (e.g., reaching a peak, hitting a target, or reaching a specific time).

Unlike VectorRootSolver, this does NOT iterate or reset the simulation repeatedly. It runs a single trajectory and returns 'true' when the event is detected.

Definition at line 15 of file InterceptSolver.h.

Member Typedef Documentation

◆ MonitorFunction

using InterceptSolver::MonitorFunction = std::function<float()>

Definition at line 18 of file InterceptSolver.h.

◆ TimeoutCondition

using InterceptSolver::TimeoutCondition = std::function<bool()>

Definition at line 21 of file InterceptSolver.h.

Constructor & Destructor Documentation

◆ InterceptSolver()

InterceptSolver::InterceptSolver ( MonitorFunction  monitorFunc,
TimeoutCondition  timeoutFunc = nullptr 
)
explicit

Construct a new Intercept Solver.

Parameters
monitorFuncFunction returning the metric to monitor. Solver stops when this drops <= 0.
timeoutFunc(Optional) Safety abort check.

Definition at line 5 of file InterceptSolver.cpp.

Member Function Documentation

◆ stepFrame()

bool InterceptSolver::stepFrame ( )
overridevirtual

Checks the current simulation state against the intercept conditions.

Returns
true if the intercept event occurred (metric <= 0), success condition met, or timeout.
false otherwise.

Implements ISolver.

Definition at line 8 of file InterceptSolver.cpp.


The documentation for this class was generated from the following files: