fix: tests for PlaneIntersectionMode

This commit is contained in:
Mateusz Stulczewski 2025-07-16 03:53:17 +02:00
parent d26bd57ea7
commit 12be5be377

View File

@ -252,21 +252,20 @@ mod tests {
let ray = Ray3d::new(Vec3::ZERO, Dir3::Z); let ray = Ray3d::new(Vec3::ZERO, Dir3::Z);
// Orthogonal, and test that ray intersects only the front face // Orthogonal, and test that ray intersects only the front face
assert_eq!( assert!(
ray.intersect_plane( ray.intersect_plane(
Vec3::Z, Vec3::Z,
InfinitePlane3d::new(Vec3::Z), InfinitePlane3d::new(Vec3::Z),
PlaneIntersectionMode::FrontFaceOnly PlaneIntersectionMode::FrontFaceOnly
), )
Some(1.0) .is_none());
); assert_eq!(ray
assert!(ray
.intersect_plane( .intersect_plane(
Vec3::Z, Vec3::Z,
InfinitePlane3d::new(Vec3::NEG_Z), InfinitePlane3d::new(Vec3::NEG_Z),
PlaneIntersectionMode::FrontFaceOnly PlaneIntersectionMode::FrontFaceOnly
) ),
.is_none()); Some(1.0));
assert!(ray assert!(ray
.intersect_plane( .intersect_plane(
Vec3::NEG_Z, Vec3::NEG_Z,
@ -277,7 +276,7 @@ mod tests {
assert!(ray assert!(ray
.intersect_plane( .intersect_plane(
Vec3::NEG_Z, Vec3::NEG_Z,
InfinitePlane3d::new(Vec3::Z), InfinitePlane3d::new(Vec3::NEG_Z),
PlaneIntersectionMode::FrontFaceOnly PlaneIntersectionMode::FrontFaceOnly
) )
.is_none()); .is_none());
@ -288,13 +287,6 @@ mod tests {
let ray = Ray3d::new(Vec3::ZERO, Dir3::Z); let ray = Ray3d::new(Vec3::ZERO, Dir3::Z);
// Orthogonal, and test that ray intersects only the back face // Orthogonal, and test that ray intersects only the back face
assert!(ray
.intersect_plane(
Vec3::Z,
InfinitePlane3d::new(Vec3::Z),
PlaneIntersectionMode::BackFaceOnly
)
.is_none());
assert_eq!( assert_eq!(
ray.intersect_plane( ray.intersect_plane(
Vec3::Z, Vec3::Z,
@ -305,8 +297,8 @@ mod tests {
); );
assert!(ray assert!(ray
.intersect_plane( .intersect_plane(
Vec3::NEG_Z, Vec3::Z,
InfinitePlane3d::new(Vec3::Z), InfinitePlane3d::new(Vec3::NEG_Z),
PlaneIntersectionMode::BackFaceOnly PlaneIntersectionMode::BackFaceOnly
) )
.is_none()); .is_none());
@ -317,5 +309,12 @@ mod tests {
PlaneIntersectionMode::BackFaceOnly PlaneIntersectionMode::BackFaceOnly
) )
.is_none()); .is_none());
assert!(ray
.intersect_plane(
Vec3::NEG_Z,
InfinitePlane3d::new(Vec3::NEG_Z),
PlaneIntersectionMode::BackFaceOnly
)
.is_none());
} }
} }