comment todos
This commit is contained in:
@@ -532,6 +532,7 @@ enum EV{
|
|||||||
|
|
||||||
impl MinkowskiMesh<'_>{
|
impl MinkowskiMesh<'_>{
|
||||||
fn next_transition_vert(&self,vert_id:MinkowskiVert,best_distance_squared:&mut Fixed<2,64>,point:Planar64Vec3)->Transition{
|
fn next_transition_vert(&self,vert_id:MinkowskiVert,best_distance_squared:&mut Fixed<2,64>,point:Planar64Vec3)->Transition{
|
||||||
|
// TODO: ensure test_vert_id is coplanar to simplex
|
||||||
let mut best_transition=Transition::Done;
|
let mut best_transition=Transition::Done;
|
||||||
for &directed_edge_id in self.vert_edges(vert_id).as_ref(){
|
for &directed_edge_id in self.vert_edges(vert_id).as_ref(){
|
||||||
//is boundary uncrossable by a crawl from infinity
|
//is boundary uncrossable by a crawl from infinity
|
||||||
@@ -549,6 +550,7 @@ impl MinkowskiMesh<'_>{
|
|||||||
best_transition
|
best_transition
|
||||||
}
|
}
|
||||||
fn final_ev(&self,vert_id:MinkowskiVert,best_distance_squared:&mut Fixed<2,64>,point:Planar64Vec3)->EV{
|
fn final_ev(&self,vert_id:MinkowskiVert,best_distance_squared:&mut Fixed<2,64>,point:Planar64Vec3)->EV{
|
||||||
|
// TODO: ensure directed_edge_id is coplanar to simplex
|
||||||
let mut best_transition=EV::Vert(vert_id);
|
let mut best_transition=EV::Vert(vert_id);
|
||||||
let diff=point-self.vert(vert_id);
|
let diff=point-self.vert(vert_id);
|
||||||
for &directed_edge_id in self.vert_edges(vert_id).as_ref(){
|
for &directed_edge_id in self.vert_edges(vert_id).as_ref(){
|
||||||
@@ -650,26 +652,14 @@ pub fn closest_fev_not_inside<'a>(mesh:&MinkowskiMesh<'a>,point:Planar64Vec3)->O
|
|||||||
Simplex1_3::Simplex3([v0,v1,v2])=>{
|
Simplex1_3::Simplex3([v0,v1,v2])=>{
|
||||||
// invert
|
// invert
|
||||||
let (v0,v1,v2)=(-v0,-v1,-v2);
|
let (v0,v1,v2)=(-v0,-v1,-v2);
|
||||||
let p0=mesh.vert(v0);
|
|
||||||
let p1=mesh.vert(v1);
|
|
||||||
let p2=mesh.vert(v2);
|
|
||||||
// spanning simplex normal
|
|
||||||
let n=(p2-p0).cross(p1-p0);
|
|
||||||
// Scan opposite vertices for coplanar ones and find a coplanar face
|
|
||||||
for &v0e in mesh.vert_edges(v0).as_ref(){
|
|
||||||
// check if opposite vertex is coplanar
|
|
||||||
let o0=mesh.edge_verts(v0e.as_undirected()).as_ref()[v0e.parity() as usize];
|
|
||||||
let o0p=mesh.vert(o0);
|
|
||||||
if n.dot(o0p-p0).is_zero(){
|
|
||||||
// always take left face (or right idk just use the parity)
|
|
||||||
let f0=mesh.edge_faces(v0e.as_undirected()).as_ref()[v0e.parity() as usize];
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Shimmy to the side until you find a face that contains the closest point
|
// Shimmy to the side until you find a face that contains the closest point
|
||||||
Err(OhNoes)
|
// it's ALWAYS representable as a face, but this algorithm may
|
||||||
|
// return E or V in edge cases but I don't think that will break the face crawler
|
||||||
|
let fev=mesh.crawl_to_closest_fev([v0,v1,v2],point);
|
||||||
|
if !matches!(fev,FEV::Face(_)){
|
||||||
|
println!("I can't believe it's not a face!");
|
||||||
|
}
|
||||||
|
Ok(fev)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user