use one type def for dt ratio

This commit is contained in:
Quaternions 2024-09-26 18:43:11 -07:00
parent 9453ef17fb
commit 72c91558e7

View File

@ -1,18 +1,18 @@
use crate::physics::Body;
use crate::model_physics::{FEV,MeshQuery,DirectedEdge,MinkowskiMesh,MinkowskiFace,MinkowskiDirectedEdge,MinkowskiVert};
use crate::model_physics::{GigaTime,FEV,MeshQuery,DirectedEdge,MinkowskiMesh,MinkowskiFace,MinkowskiDirectedEdge,MinkowskiVert};
use strafesnet_common::integer::{Time,Fixed,Ratio};
#[derive(Debug)]
enum Transition<F,E:DirectedEdge,V>{
Miss,
Next(FEV<F,E,V>,Ratio<Fixed<4,128>,Fixed<4,128>>),
Hit(F,Ratio<Fixed<4,128>,Fixed<4,128>>),
Next(FEV<F,E,V>,GigaTime),
Hit(F,GigaTime),
}
type MinkowskiFEV=FEV<MinkowskiFace,MinkowskiDirectedEdge,MinkowskiVert>;
type MinkowskiTransition=Transition<MinkowskiFace,MinkowskiDirectedEdge,MinkowskiVert>;
fn next_transition(fev:&MinkowskiFEV,body_time:Ratio<Fixed<4,128>,Fixed<4,128>>,mesh:&MinkowskiMesh,body:&Body,mut best_time:Ratio<Fixed<4,128>,Fixed<4,128>>)->MinkowskiTransition{
fn next_transition(fev:&MinkowskiFEV,body_time:GigaTime,mesh:&MinkowskiMesh,body:&Body,mut best_time:GigaTime)->MinkowskiTransition{
//conflicting derivative means it crosses in the wrong direction.
//if the transition time is equal to an already tested transition, do not replace the current best.
let mut best_transtition=MinkowskiTransition::Miss;
@ -102,7 +102,7 @@ type MinkowskiTransition=Transition<MinkowskiFace,MinkowskiDirectedEdge,Minkowsk
}
pub enum CrawlResult<F,E:DirectedEdge,V>{
Miss(FEV<F,E,V>),
Hit(F,Ratio<Fixed<4,128>,Fixed<4,128>>),
Hit(F,GigaTime),
}
type MinkowskiCrawlResult=CrawlResult<MinkowskiFace,MinkowskiDirectedEdge,MinkowskiVert>;
pub fn crawl_fev(mut fev:MinkowskiFEV,mesh:&MinkowskiMesh,relative_body:&Body,start_time:Time,time_limit:Time)->MinkowskiCrawlResult{