From 32b361b1224e0be3b0506365cd45d3b114989729 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 21 Jan 2025 12:46:21 -0800 Subject: [PATCH] use Range to express time range --- strafe-client/src/model_physics.rs | 9 +++++---- strafe-client/src/physics.rs | 10 +++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/strafe-client/src/model_physics.rs b/strafe-client/src/model_physics.rs index be7382e..9aa0d71 100644 --- a/strafe-client/src/model_physics.rs +++ b/strafe-client/src/model_physics.rs @@ -1,5 +1,6 @@ use std::borrow::{Borrow,Cow}; use std::collections::{HashSet,HashMap}; +use core::ops::Range; use strafesnet_common::integer::vec3::Vector3; use strafesnet_common::model::{self,MeshId,PolygonIter}; use strafesnet_common::integer::{self,vec3,Fixed,Planar64,Planar64Vec3,Ratio}; @@ -718,7 +719,7 @@ impl MinkowskiMesh<'_>{ // // Most of the calculation time is just calculating the starting point // for the "actual" crawling algorithm below (predict_collision_{in|out}). - fn closest_fev_not_inside(&self,mut infinity_body:Body,start_time:Time,)->Option>{ + fn closest_fev_not_inside(&self,mut infinity_body:Body,start_time:Time)->Option>{ infinity_body.infinity_dir().map_or(None,|dir|{ let infinity_fev=self.infinity_fev(-dir,infinity_body.position); //a line is simpler to solve than a parabola @@ -729,13 +730,13 @@ impl MinkowskiMesh<'_>{ infinity_fev.crawl(self,&infinity_body,Time::MIN/4,start_time).miss() }) } - pub fn predict_collision_in(&self,relative_body:&Body,start_time:Time,time_limit:Time)->Option<(MinkowskiFace,GigaTime)>{ + pub fn predict_collision_in(&self,relative_body:&Body,Range{start:start_time,end:time_limit}:Range