Skip to content

Commit c67f5ea

Browse files
author
mlund
committed
Add test_spherical_face_area()
1 parent 173c613 commit c67f5ea

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/icosphere.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,14 @@ mod tests {
216216
assert_relative_eq!(mean_weight, 0.9999999999999999, epsilon = 1e-6);
217217
assert_relative_eq!(weight_stddev, 0.028536625575550475, epsilon = 1e-6);
218218
}
219+
220+
#[test]
221+
fn test_spherical_face_area() {
222+
// Equilateral triangle on the unit sphere
223+
let a = Vec3A::new(1.0, 0.0, 0.0);
224+
let b = Vec3A::new(0.0, 1.0, 0.0);
225+
let c = Vec3A::new(0.0, 0.0, 1.0);
226+
let area = spherical_face_area(&a, &b, &c);
227+
assert_relative_eq!(area, 0.5 * PI, epsilon = 1e-6);
228+
}
219229
}

0 commit comments

Comments
 (0)