Skip to content

Commit 71a93d1

Browse files
committed
Make format happy
1 parent 1a0ce1d commit 71a93d1

File tree

13 files changed

+84
-81
lines changed

13 files changed

+84
-81
lines changed

src/aabb/aabb_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,8 @@ impl<T: BHValue, const D: usize> Bounded<T, D> for Point<T, D> {
718718
mod tests {
719719
use crate::aabb::Bounded;
720720
use crate::testbase::{
721-
tuple_to_point, tuple_to_vector, tuplevec_large_strategy, TAabb3, TPoint3, TVector3,
722-
TupleVec,
721+
TAabb3, TPoint3, TVector3, TupleVec, tuple_to_point, tuple_to_vector,
722+
tuplevec_large_strategy,
723723
};
724724

725725
use float_eq::assert_float_eq;

src/bounding_hierarchy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use nalgebra::{
77
use num_traits::{Float, FromPrimitive, Signed};
88

99
use crate::aabb::{Bounded, IntersectsAabb};
10+
use crate::bvh::BvhNodeBuildArgs;
1011
#[cfg(feature = "rayon")]
1112
use crate::bvh::rayon_executor;
12-
use crate::bvh::BvhNodeBuildArgs;
1313
use crate::point_query::PointDistance;
1414

1515
/// Encapsulates the required traits for the value type used in the Bvh.

src/bvh/bvh_impl.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,8 @@ mod tests {
542542
use crate::{
543543
bounding_hierarchy::BoundingHierarchy,
544544
testbase::{
545-
build_empty_bh, build_some_bh, nearest_to_some_bh, traverse_some_bh, TBvh3, TBvhNode3,
546-
TPoint3, TRay3, TVector3, UnitBox,
545+
TBvh3, TBvhNode3, TPoint3, TRay3, TVector3, UnitBox, build_empty_bh, build_some_bh,
546+
nearest_to_some_bh, traverse_some_bh,
547547
},
548548
};
549549

@@ -688,14 +688,14 @@ mod bench {
688688
#[cfg(feature = "rayon")]
689689
use crate::bounding_hierarchy::BoundingHierarchy;
690690
use crate::testbase::{
691-
build_1200_triangles_bh, build_120k_triangles_bh, build_12k_triangles_bh,
692-
intersect_1200_triangles_bh, intersect_120k_triangles_bh, intersect_12k_triangles_bh,
693-
intersect_bh, load_sponza_scene, nearest_to_1200_triangles_bh,
694-
nearest_to_120k_triangles_bh, nearest_to_12k_triangles_bh, nearest_to_bh, TBvh3,
691+
TBvh3, build_12k_triangles_bh, build_120k_triangles_bh, build_1200_triangles_bh,
692+
intersect_12k_triangles_bh, intersect_120k_triangles_bh, intersect_1200_triangles_bh,
693+
intersect_bh, load_sponza_scene, nearest_to_12k_triangles_bh, nearest_to_120k_triangles_bh,
694+
nearest_to_1200_triangles_bh, nearest_to_bh,
695695
};
696696
#[cfg(feature = "rayon")]
697697
use crate::testbase::{
698-
build_1200_triangles_bh_rayon, build_120k_triangles_bh_rayon, build_12k_triangles_bh_rayon,
698+
build_12k_triangles_bh_rayon, build_120k_triangles_bh_rayon, build_1200_triangles_bh_rayon,
699699
};
700700

701701
#[bench]

src/bvh/bvh_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::aabb::{Aabb, Bounded, IntersectsAabb};
22
use crate::bounding_hierarchy::{BHShape, BHValue};
33
use crate::point_query::PointDistance;
4-
use crate::utils::{joint_aabb_of_shapes, Bucket};
4+
use crate::utils::{Bucket, joint_aabb_of_shapes};
55
use std::cell::RefCell;
66
use std::marker::PhantomData;
77
use std::mem::MaybeUninit;

src/bvh/child_distance_traverse.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::aabb::Bounded;
22
use crate::bounding_hierarchy::BHValue;
3-
use crate::bvh::{iter_initially_has_node, Bvh, BvhNode};
3+
use crate::bvh::{Bvh, BvhNode, iter_initially_has_node};
44
use crate::ray::Ray;
55

66
#[derive(Debug, Clone, Copy)]
@@ -221,7 +221,7 @@ mod tests {
221221
use crate::aabb::Bounded;
222222
use crate::bvh::Bvh;
223223
use crate::ray::Ray;
224-
use crate::testbase::{generate_aligned_boxes, TBvh3, TPoint3, TVector3, UnitBox};
224+
use crate::testbase::{TBvh3, TPoint3, TVector3, UnitBox, generate_aligned_boxes};
225225
use std::collections::HashSet;
226226

227227
/// Create a `Bvh` for a fixed scene structure.

src/bvh/distance_traverse.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::collections::BinaryHeap;
33

44
use crate::aabb::{Aabb, Bounded};
55
use crate::bounding_hierarchy::BHValue;
6-
use crate::bvh::{iter_initially_has_node, Bvh, BvhNode};
6+
use crate::bvh::{Bvh, BvhNode, iter_initially_has_node};
77
use crate::ray::Ray;
88

99
#[derive(Debug, Clone, Copy)]
@@ -166,7 +166,7 @@ mod tests {
166166
use crate::bvh::Bvh;
167167
use crate::ray::Ray;
168168
use crate::testbase::{
169-
generate_aligned_boxes, TAabb3, TBvh3, TPoint3, TRay3, TVector3, UnitBox,
169+
TAabb3, TBvh3, TPoint3, TRay3, TVector3, UnitBox, generate_aligned_boxes,
170170
};
171171

172172
/// Create a `Bvh` for a fixed scene structure.
@@ -311,12 +311,13 @@ mod tests {
311311
);
312312

313313
let bvh = TBvh3::build(&mut aabbs);
314-
assert!(bvh
315-
.nearest_traverse_iterator(&ray, &aabbs)
316-
.is_sorted_by(|a, b| {
317-
let (a, _) = ray.intersection_slice_for_aabb(a).unwrap();
318-
let (b, _) = ray.intersection_slice_for_aabb(b).unwrap();
319-
a <= b
320-
}));
314+
assert!(
315+
bvh.nearest_traverse_iterator(&ray, &aabbs)
316+
.is_sorted_by(|a, b| {
317+
let (a, _) = ray.intersection_slice_for_aabb(a).unwrap();
318+
let (b, _) = ray.intersection_slice_for_aabb(b).unwrap();
319+
a <= b
320+
})
321+
);
321322
}
322323
}

src/bvh/iter.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,8 @@ pub struct BvhTraverseIterator<
2727
has_node: bool,
2828
}
2929

30-
impl<
31-
'bvh,
32-
'shape,
33-
T: BHValue,
34-
const D: usize,
35-
Query: IntersectsAabb<T, D>,
36-
Shape: Bounded<T, D>,
37-
> BvhTraverseIterator<'bvh, 'shape, T, D, Query, Shape>
30+
impl<'bvh, 'shape, T: BHValue, const D: usize, Query: IntersectsAabb<T, D>, Shape: Bounded<T, D>>
31+
BvhTraverseIterator<'bvh, 'shape, T, D, Query, Shape>
3832
{
3933
/// Creates a new [`BvhTraverseIterator`]
4034
pub fn new(bvh: &'bvh Bvh<T, D>, query: &'bvh Query, shapes: &'shape [Shape]) -> Self {
@@ -192,7 +186,7 @@ pub(crate) fn iter_initially_has_node<
192186
#[cfg(test)]
193187
mod tests {
194188
use crate::ray::Ray;
195-
use crate::testbase::{generate_aligned_boxes, TBvh3, TPoint3, TVector3, UnitBox};
189+
use crate::testbase::{TBvh3, TPoint3, TVector3, UnitBox, generate_aligned_boxes};
196190
use nalgebra::{OPoint, OVector};
197191
use std::collections::HashSet;
198192

@@ -321,7 +315,7 @@ mod tests {
321315

322316
#[cfg(all(feature = "bench", test))]
323317
mod bench {
324-
use crate::testbase::{create_ray, load_sponza_scene, TBvh3};
318+
use crate::testbase::{TBvh3, create_ray, load_sponza_scene};
325319

326320
#[bench]
327321
/// Benchmark the traversal of a [`Bvh`] with the Sponza scene with [`Vec`] return.

src/bvh/optimization.rs

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,8 @@ mod tests {
394394
use crate::aabb::Bounded;
395395
use crate::bounding_hierarchy::BHShape;
396396
use crate::testbase::{
397-
build_some_bh, create_n_cubes, default_bounds, randomly_transform_scene, TBvh3, TBvhNode3,
398-
TPoint3, UnitBox,
397+
TBvh3, TBvhNode3, TPoint3, UnitBox, build_some_bh, create_n_cubes, default_bounds,
398+
randomly_transform_scene,
399399
};
400400
use std::collections::HashSet;
401401

@@ -567,18 +567,26 @@ mod tests {
567567
assert_eq!(nodes[5].parent(), 1);
568568
assert_eq!(nodes[6].parent(), 2);
569569

570-
assert!(nodes[1]
571-
.child_l_aabb()
572-
.relative_eq(&shapes[2].aabb(), f32::EPSILON));
573-
assert!(nodes[1]
574-
.child_r_aabb()
575-
.relative_eq(&shapes[1].aabb(), f32::EPSILON));
576-
assert!(nodes[2]
577-
.child_l_aabb()
578-
.relative_eq(&shapes[0].aabb(), f32::EPSILON));
579-
assert!(nodes[2]
580-
.child_r_aabb()
581-
.relative_eq(&shapes[3].aabb(), f32::EPSILON));
570+
assert!(
571+
nodes[1]
572+
.child_l_aabb()
573+
.relative_eq(&shapes[2].aabb(), f32::EPSILON)
574+
);
575+
assert!(
576+
nodes[1]
577+
.child_r_aabb()
578+
.relative_eq(&shapes[1].aabb(), f32::EPSILON)
579+
);
580+
assert!(
581+
nodes[2]
582+
.child_l_aabb()
583+
.relative_eq(&shapes[0].aabb(), f32::EPSILON)
584+
);
585+
assert!(
586+
nodes[2]
587+
.child_r_aabb()
588+
.relative_eq(&shapes[3].aabb(), f32::EPSILON)
589+
);
582590
}
583591

584592
#[test]
@@ -609,18 +617,26 @@ mod tests {
609617
assert_eq!(nodes[5].parent(), 0);
610618
assert_eq!(nodes[6].parent(), 2);
611619

612-
assert!(nodes[0]
613-
.child_l_aabb()
614-
.relative_eq(&shapes[2].aabb(), f32::EPSILON));
615-
assert!(nodes[2]
616-
.child_r_aabb()
617-
.relative_eq(&shapes[3].aabb(), f32::EPSILON));
618-
assert!(nodes[1]
619-
.child_l_aabb()
620-
.relative_eq(&shapes[0].aabb(), f32::EPSILON));
621-
assert!(nodes[1]
622-
.child_r_aabb()
623-
.relative_eq(&shapes[1].aabb(), f32::EPSILON));
620+
assert!(
621+
nodes[0]
622+
.child_l_aabb()
623+
.relative_eq(&shapes[2].aabb(), f32::EPSILON)
624+
);
625+
assert!(
626+
nodes[2]
627+
.child_r_aabb()
628+
.relative_eq(&shapes[3].aabb(), f32::EPSILON)
629+
);
630+
assert!(
631+
nodes[1]
632+
.child_l_aabb()
633+
.relative_eq(&shapes[0].aabb(), f32::EPSILON)
634+
);
635+
assert!(
636+
nodes[1]
637+
.child_r_aabb()
638+
.relative_eq(&shapes[1].aabb(), f32::EPSILON)
639+
);
624640
}
625641

626642
#[test]
@@ -652,8 +668,8 @@ mod tests {
652668
#[cfg(all(feature = "bench", test))]
653669
mod bench {
654670
use crate::testbase::{
655-
create_n_cubes, default_bounds, intersect_bh, load_sponza_scene, randomly_transform_scene,
656-
TAabb3, TBvh3, Triangle,
671+
TAabb3, TBvh3, Triangle, create_n_cubes, default_bounds, intersect_bh, load_sponza_scene,
672+
randomly_transform_scene,
657673
};
658674

659675
#[bench]

src/flat_bvh.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ impl<T: BHValue + std::fmt::Display, const D: usize> BoundingHierarchy<T, D> for
590590
#[cfg(test)]
591591
mod tests {
592592
use crate::testbase::{
593-
build_empty_bh, build_some_bh, nearest_to_some_bh, traverse_some_bh, TBvh3, TFlatBvh3,
593+
TBvh3, TFlatBvh3, build_empty_bh, build_some_bh, nearest_to_some_bh, traverse_some_bh,
594594
};
595595

596596
#[test]
@@ -622,10 +622,10 @@ mod tests {
622622
#[cfg(all(feature = "bench", test))]
623623
mod bench {
624624
use crate::testbase::{
625-
build_1200_triangles_bh, build_120k_triangles_bh, build_12k_triangles_bh, create_n_cubes,
626-
default_bounds, intersect_1200_triangles_bh, intersect_120k_triangles_bh,
627-
intersect_12k_triangles_bh, nearest_to_1200_triangles_bh, nearest_to_120k_triangles_bh,
628-
nearest_to_12k_triangles_bh, TBvh3, TFlatBvh3,
625+
TBvh3, TFlatBvh3, build_12k_triangles_bh, build_120k_triangles_bh, build_1200_triangles_bh,
626+
create_n_cubes, default_bounds, intersect_12k_triangles_bh, intersect_120k_triangles_bh,
627+
intersect_1200_triangles_bh, nearest_to_12k_triangles_bh, nearest_to_120k_triangles_bh,
628+
nearest_to_1200_triangles_bh,
629629
};
630630

631631
#[bench]

src/ray/intersect_simd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::{
99
utils::{fast_max, fast_min, has_nan},
1010
};
1111

12-
use super::{intersect_default::RayIntersection, Ray};
12+
use super::{Ray, intersect_default::RayIntersection};
1313

1414
trait ToRegisterType {
1515
type Register;

0 commit comments

Comments
 (0)