parry
parry copied to clipboard
Bug: very small vertex input to TriMesh results in panic: unwrap on None when distance_to_local_point is called
Issue occurred after converting vertex input to Angstroms, resulting in very small vertex list:
vertices = [
[-0.5, -0.5, 0.5],
[0.5, -0.5, 0.5],
[-0.5, 0.5, 0.5],
[0.5, 0.5, 0.5],
[-0.5, 0.5, -0.5],
[0.5, 0.5, -0.5],
[-0.5, -0.5, -0.5],
[0.5, -0.5, -0.5],
]
indices = [
[3, 1, 0],
[2, 3, 0],
[5, 3, 2],
[4, 5, 2],
[7, 5, 4],
[6, 7, 4],
[1, 7, 6],
[0, 1, 6],
[5, 7, 1],
[3, 5, 1],
[2, 0, 6],
[4, 2, 6]
]
If length_unit below is 1E-10 (1 Angstrom):
let points = input.vertices.iter().map(|p| Point::new(p[0]*length_unit as f32, p[1]*length_unit as f32, p[2]*length_unit as f32)).collect();
let trimesh = TriMesh::new(points, input.indices.clone());
When calling distance_to_local_point(&p, true), parry3d-f32 panics at:
thread 'main' panicked at 'called Option::unwrap() on a None value', C:\Users\Jarat\.cargo\registry\src\github.com-1ecc6299db9ec823\parry3d-0.2.0\src\query\point\point_composite_shape.rs:126:59
Debug output from failing quadtree below: quadtree_debug.txt
Errors at this scale are expected, that being said, maybe project_local_point_and_get_location would benefit forwarding the Option... it's irrelevant for the majority of cases so it's a bit controversial.