use super::ClippingProcessor;
use crate::mesh::Mesh;
impl ClippingProcessor {
pub(crate) fn difference_result_looks_degenerate(host: &Mesh, result: &Mesh) -> bool {
let result_tris = result.indices.len() / 3;
if result_tris == 0 {
return false;
}
if result_tris < 4 {
return true;
}
let host_tris = host.indices.len() / 3;
if host_tris >= 12 && result_tris * 4 < host_tris {
return true;
}
let (host_min, host_max) = host.bounds();
let (res_min, res_max) = result.bounds();
let slack = (host_max - host_min).abs() * 0.01;
if res_min.x + slack.x < host_min.x
|| res_min.y + slack.y < host_min.y
|| res_min.z + slack.z < host_min.z
|| res_max.x > host_max.x + slack.x
|| res_max.y > host_max.y + slack.y
|| res_max.z > host_max.z + slack.z
{
return true;
}
false
}
}