Compare commits

...

3 Commits

Author SHA1 Message Date
11e87e69c6 change inequality inclusivity 2026-03-25 08:40:06 -07:00
1eeb6d5a25 print fev 2026-03-25 08:39:48 -07:00
311575aed7 disable comparison 2026-03-25 08:39:44 -07:00
2 changed files with 14 additions and 13 deletions

View File

@@ -191,7 +191,7 @@ fn reduce2<M:MeshQuery<Position=Planar64Vec3>>(
let p_u=p.dot(u); let p_u=p.dot(u);
// if p_u >= 0 then // if p_u >= 0 then
if !p_u.is_negative(){ if p_u.is_positive(){
// local direction = u:Cross(p):Cross(u) // local direction = u:Cross(p):Cross(u)
let direction=u.cross(p).cross(u); let direction=u.cross(p).cross(u);
@@ -263,7 +263,7 @@ fn reduce3<M:MeshQuery<Position=Planar64Vec3>>(
let uv_pv=uv.dot(pv); let uv_pv=uv.dot(pv);
// if uv_up >= 0 and uv_pv >= 0 then // if uv_up >= 0 and uv_pv >= 0 then
if !uv_up.is_negative()&&!uv_pv.is_negative(){ if uv_up.is_positive()&&uv_pv.is_positive(){
// local uvp = uv:Dot(p) // local uvp = uv:Dot(p)
let uvp=uv.dot(p); let uvp=uv.dot(p);
@@ -303,7 +303,7 @@ fn reduce3<M:MeshQuery<Position=Planar64Vec3>>(
let p_u=p.dot(u); let p_u=p.dot(u);
// if p_u >= 0 then // if p_u >= 0 then
if !p_u.is_negative(){ if p_u.is_positive(){
// local direction = up:Cross(u) // local direction = up:Cross(u)
let direction=up.cross(u); let direction=up.cross(u);
// if direction.magnitude == 0 then // if direction.magnitude == 0 then
@@ -384,9 +384,9 @@ fn reduce4<M:MeshQuery<Position=Planar64Vec3>>(
let uv_p=uv.dot(p); let uv_p=uv.dot(p);
// if pvw/uvw >= 0 and upw/uvw >= 0 and uvp/uvw >= 0 then // if pvw/uvw >= 0 and upw/uvw >= 0 and uvp/uvw >= 0 then
if !pv_w.div_sign(uv_w).is_negative() if pv_w.div_sign(uv_w).is_positive()
&&!up_w.div_sign(uv_w).is_negative() &&up_w.div_sign(uv_w).is_positive()
&&!uv_p.div_sign(uv_w).is_negative(){ &&uv_p.div_sign(uv_w).is_positive(){
// origin is contained, this is a positive detection // origin is contained, this is a positive detection
// local direction = Vector3.new(0, 0, 0) // local direction = Vector3.new(0, 0, 0)
// return direction, a0, a1, b0, b1, c0, c1, d0, d1 // return direction, a0, a1, b0, b1, c0, c1, d0, d1
@@ -439,7 +439,7 @@ fn reduce4<M:MeshQuery<Position=Planar64Vec3>>(
let uv_pv=uv.dot(pv); let uv_pv=uv.dot(pv);
// if uv_up >= 0 and uv_pv >= 0 then // if uv_up >= 0 and uv_pv >= 0 then
if !uv_up.is_negative()&&!uv_pv.is_negative(){ if uv_up.is_positive()&&uv_pv.is_positive(){
// local direction = uvw < 0 and uv or -uv // local direction = uvw < 0 and uv or -uv
// return direction, a0, a1, b0, b1, c0, c1 // return direction, a0, a1, b0, b1, c0, c1
let dir=if uv_w.is_negative(){ let dir=if uv_w.is_negative(){
@@ -475,7 +475,7 @@ fn reduce4<M:MeshQuery<Position=Planar64Vec3>>(
let p_u=p.dot(u); let p_u=p.dot(u);
// if p_u >= 0 then // if p_u >= 0 then
if !p_u.is_negative(){ if p_u.is_positive(){
// local direction = up:Cross(u) // local direction = up:Cross(u)
let direction=up.cross(u); let direction=up.cross(u);
// if direction.magnitude == 0 then // if direction.magnitude == 0 then
@@ -760,11 +760,11 @@ 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<'a>(mesh:&MinkowskiMesh<'a>,point:Planar64Vec3)->Option<FEV<MinkowskiMesh<'a>>>{
println!("=== LUA ==="); // println!("=== LUA ===");
let (hits,_details)=crate::minimum_difference_lua::minimum_difference_details(mesh,point).unwrap(); // let (hits,_details)=crate::minimum_difference_lua::minimum_difference_details(mesh,point).unwrap();
println!("=== RUST ==="); // println!("=== RUST ===");
let closest_fev_not_inside=closest_fev_not_inside_inner(mesh,point); let closest_fev_not_inside=closest_fev_not_inside_inner(mesh,point);
assert_eq!(hits,closest_fev_not_inside.is_none(),"algorithms disagree"); // assert_eq!(hits,closest_fev_not_inside.is_none(),"algorithms disagree");
closest_fev_not_inside closest_fev_not_inside
} }
@@ -893,7 +893,7 @@ fn minimum_difference<const ENABLE_FAST_FAIL:bool,T,M:MeshQuery<Position=Planar6
let d1=direction.dot(next_pos-last_pos); let d1=direction.dot(next_pos-last_pos);
let cond2=simplex_big.det_is_zero(mesh); let cond2=simplex_big.det_is_zero(mesh);
println!("d1={d1:?} cond2={cond2}"); println!("d1={d1:?} cond2={cond2}");
if !d1.is_positive()||cond2{ if d1.is_negative()||cond2{
println!("on_exact"); println!("on_exact");
// Found enough information to compute the exact closest point. // Found enough information to compute the exact closest point.
// local norm = direction.unit // local norm = direction.unit

View File

@@ -109,6 +109,7 @@ impl MinkowskiMesh<'_>{
Bound::Unbounded=>trajectory.position, Bound::Unbounded=>trajectory.position,
}; };
let fev=crate::minimum_difference::closest_fev_not_inside(self,start_position)?; let fev=crate::minimum_difference::closest_fev_not_inside(self,start_position)?;
println!("fev={fev:?}");
//continue forwards along the body parabola //continue forwards along the body parabola
fev.crawl(self,trajectory,range.start_bound(),range.end_bound()).hit() fev.crawl(self,trajectory,range.start_bound(),range.end_bound()).hit()
} }