You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I put this in the Discord too, but just for good measure I'll open an issue too.
It appears that ConvexPolyhedron::from_convex_hull(&points) produces invalid topology:
use std::fs::File;
use parry3d::na::Point3;
use parry3d::shape::{ConvexPolyhedron, TriMeshFlags};
fn main() {
let decoded: Vec<f32> = bincode::deserialize_from(File::open("points.bin").unwrap()).unwrap();
let points : Vec<Point3<f32>> = decoded.chunks(3).map(|c| Point3::new(c[0], c[1], c[2])).collect();
let convex = ConvexPolyhedron::from_convex_hull(&points)
.expect("Failed to compute convex hull of mesh");
let (vertices, mut indices) = convex.to_trimesh();
let mut convex_mesh = parry3d::shape::TriMesh::new(vertices, indices)
.expect("Failed to convert convex polyhedron to triangle mesh");
// This panics.
convex_mesh.set_flags(TriMeshFlags::HALF_EDGE_TOPOLOGY).unwrap()
}
Here's the input data (remove the .txt, GitHub refused to upload it otherwise)
let (vertices, mut indices) = convex.to_trimesh();
let mut edge_counter = HashMap::new();
for triangle in indices.iter_mut() {
for i in 0..3 {
let edge = [triangle[i], triangle[(i + 1) % 3]];
edge_counter.entry(edge).and_modify(|e| *e += 1).or_insert(1);
if edge_counter[&edge] > 1 {
println!("Edge {:?} is shared by {} triangles", edge, edge_counter[&edge]);
}
}
}
Oh, this is weird:
Edge [31, 22] is shared by 2 triangles
Edge [22, 31] is shared by 2 triangles
If we see edges as undirected, that's one edge showing up 4 times there.
Hi there,
I put this in the Discord too, but just for good measure I'll open an issue too.
It appears that
ConvexPolyhedron::from_convex_hull(&points)
produces invalid topology:Here's the input data (remove the .txt, GitHub refused to upload it otherwise)
points.bin.txt
The text was updated successfully, but these errors were encountered: