forked from 1b-agent/fieldcraft-upstream
mesh: portable atan2 and cbrt for the quality measures (#115)
The platform maths libraries' atan2 and cbrt differ in the last bits between macOS and glibc, so the dihedral angles and the shape measure a mesh reports did too. The crate's own versions use + - * / and sqrt only (correctly rounded everywhere) and agree with the platform's to a few ulps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
1 parent
030799dfc8
commit
20281e5959
3 files changed
+82
-3
No files matched your search
@@ -104,7 +104,7 @@ pub fn dihedral_range(x: &[P; 4]) -> (f64, f64) {
|
||||
let mut lo = f64::INFINITY;
|
||||
let mut hi = f64::NEG_INFINITY;
|
||||
for (sv, cv) in s.iter().zip(c) {
|
||||
let a = sv.abs().atan2(cv).to_degrees();
|
||||
let a = crate::vec3::atan2(sv.abs(), cv).to_degrees();
|
||||
lo = lo.min(a);
|
||||
hi = hi.max(a);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user