Yasiu Math 1
Collection of mathematic functions that help create game mechanics and procedural tools
Loading...
Searching...
No Matches
YasiuMath::Ballistics Namespace Reference

Linear and dynamic objects simulation / prediction. More...

Classes

struct  ProjectileDynamicState
 Ballistic state. Can move in time with DiscreteStep function. More...
struct  InterceptorParams
 Params used for ballistics predictions. More...

Functions

template<typename T>
bool InterceptMissile_Linear (const Types::Vec3< T > &MissilePosition, const Types::Vec3< T > &MissileVelocity, const T BulletSpeed, Types::Vec3< T > &InterceptLocation, T &ImpactTime)
 Linear movement with linear velocity, Fast: O(1).
template<typename T>
bool InterceptMissile_Linear (const Vec3< T > &TargetPosition, const Vec3< T > &TargetVelocity, const T BulletSpeed, Vec3< T > &InterceptLocation)
 Linear movement with linear velocity, Fast: O(1).
template<typename T>
bool InterceptMissile_Dynamic (ProjectileDynamicState< T > Target, const InterceptorParams< T > &Interceptor, const T MaxQueryTime, const T StepTime, Types::Vec3< T > &PredictedLocation)
 Iterative state prediction. Returns first possible intercept location and time.
template<typename T>
bool InterceptMissile_Dynamic (ProjectileDynamicState< T > Target, const InterceptorParams< T > &Interceptor, const T MaxQueryTime, const T StepTime, Types::Vec3< T > &HitLocation, T &HitTime)
 Iterative state prediction. Returns first possible intercept location and time.
template<typename T>
bool InterceptMissile_Dynamic (ProjectileDynamicState< T > Target, const InterceptorParams< T > &Interceptor, const T MaxQueryTime, const T StepTime, const T AccurateStepTime, Types::Vec3< T > &HitLocation)
 Iterative state prediction. Returns first possible intercept location and time.
template<typename T>
bool InterceptMissile_Dynamic (ProjectileDynamicState< T > Target, const InterceptorParams< T > &Interceptor, const T MaxQueryTime, const T StepTime, const T AccurateStepTime, Types::Vec3< T > &HitLocation, T &HitTime)
 FULL IMPL.

Detailed Description

Linear and dynamic objects simulation / prediction.

Function Documentation

◆ InterceptMissile_Dynamic() [1/4]

template<typename T>
bool YasiuMath::Ballistics::InterceptMissile_Dynamic ( ProjectileDynamicState< T > Target,
const InterceptorParams< T > & Interceptor,
const T MaxQueryTime,
const T StepTime,
const T AccurateStepTime,
Types::Vec3< T > & HitLocation )

Iterative state prediction. Returns first possible intercept location and time.

Accuracy is based on DeltaTime.

Note
There is no iteration limit. Loop is restricted by N = QueryTime / DeltaTime
Suggested Delta range: <0.1 , 1>. Depending on space and distance.
Parameters
TargetState of missile
InterceptorParams of interceptor
MaxQueryTimePrediction time to intercept
StepTimePrediction resolution, how big steps to make. Smaller steps = more steps.
AccurateStepTimeStepsize used in last phase to determine accurate result, 0=Skip accurate phase
HitLocationPredicted intercept location
Returns
Flag is solution found estimated intercept location

◆ InterceptMissile_Dynamic() [2/4]

template<typename T>
bool YasiuMath::Ballistics::InterceptMissile_Dynamic ( ProjectileDynamicState< T > Target,
const InterceptorParams< T > & Interceptor,
const T MaxQueryTime,
const T StepTime,
const T AccurateStepTime,
Types::Vec3< T > & HitLocation,
T & HitTime )

FULL IMPL.

Iterative state prediction. Returns first possible intercept location and time.

Accuracy is based on StepTime and slightly overshoot position.

AccurateStepTime will iterate positon in last step to evaluate more precise hit. AccurateStepTime=0 will not do better estimation.

Implementation with all arguments.

Note
There is no iteration limit. Loop is restricted by N = QueryTime / DeltaTime
Suggested Delta range: <0.1 , 1>. Depending on space and distance.
Parameters
TargetState of missile
InterceptorParams of interceptor
MaxQueryTimePrediction time to intercept
StepTimePrediction resolution, how big steps to make. Smaller steps = more steps.
AccurateStepTimeSmallStep used to estimate more accurate results
HitLocationPredicted intercept location
HitTimeEstimated time
Returns
Flag is solution found estimated intercept location

◆ InterceptMissile_Dynamic() [3/4]

template<typename T>
bool YasiuMath::Ballistics::InterceptMissile_Dynamic ( ProjectileDynamicState< T > Target,
const InterceptorParams< T > & Interceptor,
const T MaxQueryTime,
const T StepTime,
Types::Vec3< T > & HitLocation,
T & HitTime )

Iterative state prediction. Returns first possible intercept location and time.

Accuracy is based on DeltaTime.

Return HitTime arguments.

Note
There is no iteration limit. Loop is restricted by N = QueryTime / DeltaTime
Suggested Delta range: <0.1 , 1>. Depending on space and distance.
Parameters
TargetState of missile
InterceptorParams of interceptor
MaxQueryTimePrediction time to intercept
StepTimePrediction resolution, how big steps to make. Smaller steps = more steps.
HitLocationPredicted intercept location
HitTimeEstimated time
Returns
Flag is solution found estimated intercept location

◆ InterceptMissile_Dynamic() [4/4]

template<typename T>
bool YasiuMath::Ballistics::InterceptMissile_Dynamic ( ProjectileDynamicState< T > Target,
const InterceptorParams< T > & Interceptor,
const T MaxQueryTime,
const T StepTime,
Types::Vec3< T > & PredictedLocation )

Iterative state prediction. Returns first possible intercept location and time.

Accuracy is based on DeltaTime.

Minimal arguments.

Note
There is no iteration limit. Loop is restricted by N = QueryTime / DeltaTime
Suggested Delta range: <0.1 , 1>. Depending on space and distance.
Parameters
TargetState of missile
InterceptorParams of interceptor
MaxQueryTimePrediction time to intercept
StepTimePrediction resolution, how big steps to make. Smaller steps = more steps.
PredictedLocationPredicted intercept location
Returns
Flag is solution found estimated intercept location

◆ InterceptMissile_Linear() [1/2]

template<typename T>
bool YasiuMath::Ballistics::InterceptMissile_Linear ( const Types::Vec3< T > & MissilePosition,
const Types::Vec3< T > & MissileVelocity,
const T BulletSpeed,
Types::Vec3< T > & InterceptLocation,
T & ImpactTime )

Linear movement with linear velocity, Fast: O(1).

Parameters
MissilePositionCurrent Relative position
MissileVelocityCurrent Vector
BulletSpeedMaximal bullet speed
InterceptLocationPosition relative to bullet starting position
ImpactTimePredicted time
Returns
Flag if solution is valid

◆ InterceptMissile_Linear() [2/2]

template<typename T>
bool YasiuMath::Ballistics::InterceptMissile_Linear ( const Vec3< T > & TargetPosition,
const Vec3< T > & TargetVelocity,
const T BulletSpeed,
Vec3< T > & InterceptLocation )

Linear movement with linear velocity, Fast: O(1).

Parameters
TargetPositionCurrent Relative position
TargetVelocityCurrent Vector
BulletSpeedMaximal bullet speed
InterceptLocationPosition relative to bullet starting position
Returns
Flag if solution is valid