Compare commits
1 Commits
luau-md
...
md-generic
| Author | SHA1 | Date | |
|---|---|---|---|
|
a2f96ff6e2
|
@@ -3,8 +3,6 @@ use strafesnet_common::integer::vec3::Vector3;
|
||||
use strafesnet_common::integer::{Fixed,Planar64,Planar64Vec3};
|
||||
|
||||
use crate::model::{DirectedEdge,FEV,MeshQuery};
|
||||
// TODO: remove mesh invert
|
||||
use crate::model::{MinkowskiMesh,MinkowskiVert};
|
||||
|
||||
// This algorithm is based on Lua code
|
||||
// written by Trey Reynolds in 2021
|
||||
@@ -504,10 +502,10 @@ impl<Vert> Simplex2_4<Vert>{
|
||||
}
|
||||
}
|
||||
|
||||
pub fn contains_point(mesh:&MinkowskiMesh<'_>,point:Planar64Vec3)->bool{
|
||||
pub fn contains_point<M:MeshQuery>(mesh:&M,point:Planar64Vec3)->bool{
|
||||
const ENABLE_FAST_FAIL:bool=true;
|
||||
// TODO: remove mesh negation
|
||||
minimum_difference::<ENABLE_FAST_FAIL,_,_>(&-mesh,point,
|
||||
minimum_difference::<ENABLE_FAST_FAIL,_,M>(&-mesh,point,
|
||||
// on_exact
|
||||
|is_intersecting,_simplex|{
|
||||
is_intersecting
|
||||
@@ -674,7 +672,7 @@ fn crawl_to_closest_ev<M:MeshQuery>(mesh:&M,simplex:Simplex<2,M::Vert>,point:Pla
|
||||
}
|
||||
|
||||
/// This function drops a vertex down to an edge or a face if the path from infinity did not cross any vertex-edge boundaries but the point is supposed to have already crossed a boundary down from a vertex
|
||||
fn crawl_to_closest_fev<'a>(mesh:&MinkowskiMesh<'a>,simplex:Simplex<3,MinkowskiVert>,point:Planar64Vec3)->FEV::<MinkowskiMesh<'a>>{
|
||||
fn crawl_to_closest_fev<M:MeshQuery>(mesh:&M,simplex:Simplex<3,M::Vert>,point:Planar64Vec3)->FEV::<M>{
|
||||
// naively start at the closest vertex
|
||||
// the closest vertex is not necessarily the one with the fewest boundary hops
|
||||
// but it doesn't matter, we will get there regardless.
|
||||
@@ -721,10 +719,10 @@ fn crawl_to_closest_fev<'a>(mesh:&MinkowskiMesh<'a>,simplex:Simplex<3,MinkowskiV
|
||||
}
|
||||
}
|
||||
|
||||
pub fn closest_fev_not_inside<'a>(mesh:&MinkowskiMesh<'a>,point:Planar64Vec3)->Option<FEV<MinkowskiMesh<'a>>>{
|
||||
pub fn closest_fev_not_inside<M:MeshQuery>(mesh:&M,point:Planar64Vec3)->Option<FEV<M>>{
|
||||
const ENABLE_FAST_FAIL:bool=false;
|
||||
// TODO: remove mesh negation
|
||||
minimum_difference::<ENABLE_FAST_FAIL,_,_>(&-mesh,point,
|
||||
minimum_difference::<ENABLE_FAST_FAIL,_,M>(&-mesh,point,
|
||||
// on_exact
|
||||
|is_intersecting,simplex|{
|
||||
if is_intersecting{
|
||||
|
||||
Reference in New Issue
Block a user