@@ -583,7 +583,10 @@ mod tests {
583583 #[ test]
584584 fn certificate_depth_interval_is_z_plus_minus_k_sigma ( ) {
585585 // cov_zz = 0.25 → σ_z = 0.5; k=2 → half-width = 1.0; depth=10.
586- let params = DepthCertParams { k_sigma : 2.0 , ..Default :: default ( ) } ;
586+ let params = DepthCertParams {
587+ k_sigma : 2.0 ,
588+ ..Default :: default ( )
589+ } ;
587590 let c = certify_depth_scalar ( 10.0 , 0.25 , 7.0 , & params) ;
588591 assert ! ( approx( c. depth_variance, 0.25 , 1e-6 ) ) ;
589592 assert ! ( approx( c. covariance_depth_error, 1.0 , 1e-6 ) , "cov err={}" , c. covariance_depth_error) ;
@@ -596,7 +599,10 @@ mod tests {
596599 #[ test]
597600 fn certificate_min_depth_clamped_non_negative ( ) {
598601 // depth 0.5, half-width 1.0 → raw min = -0.5, clamped to 0.
599- let params = DepthCertParams { k_sigma : 2.0 , ..Default :: default ( ) } ;
602+ let params = DepthCertParams {
603+ k_sigma : 2.0 ,
604+ ..Default :: default ( )
605+ } ;
600606 let c = certify_depth_scalar ( 0.5 , 0.25 , 1.0 , & params) ;
601607 assert_eq ! ( c. min_depth, 0.0 , "min_depth must clamp to 0" ) ;
602608 }
@@ -605,11 +611,11 @@ mod tests {
605611 fn certificate_total_is_sum_of_separate_terms ( ) {
606612 // Distinct values per term so a wiring mistake is visible.
607613 let params = DepthCertParams {
608- k_sigma : 2.0 , // σ_z=0.5 → cov term = 1.0
614+ k_sigma : 2.0 , // σ_z=0.5 → cov term = 1.0
609615 camera_transform_error : 0.1 ,
610616 quantization_depth_error : 0.2 ,
611617 splat_support_overlap_error : 0.4 ,
612- sort_bucket_width : 0.6 , // → 0.3
618+ sort_bucket_width : 0.6 , // → 0.3
613619 lod_substitution_error : 0.8 ,
614620 sampling_discrepancy : 1.6 ,
615621 max_total_depth_error : f32:: INFINITY ,
@@ -623,7 +629,11 @@ mod tests {
623629
624630 #[ test]
625631 fn certificate_pass_fail_tracks_threshold ( ) {
626- let mut params = DepthCertParams { k_sigma : 2.0 , max_total_depth_error : 0.5 , ..Default :: default ( ) } ;
632+ let mut params = DepthCertParams {
633+ k_sigma : 2.0 ,
634+ max_total_depth_error : 0.5 ,
635+ ..Default :: default ( )
636+ } ;
627637 // cov term alone = 1.0 > 0.5 → fail.
628638 assert ! ( !certify_depth_scalar( 10.0 , 0.25 , 5.0 , & params) . passed) ;
629639 // Loosen the threshold → pass.
@@ -633,7 +643,10 @@ mod tests {
633643
634644 #[ test]
635645 fn certificate_non_finite_fails ( ) {
636- let params = DepthCertParams { camera_transform_error : f32:: INFINITY , ..Default :: default ( ) } ;
646+ let params = DepthCertParams {
647+ camera_transform_error : f32:: INFINITY ,
648+ ..Default :: default ( )
649+ } ;
637650 let c = certify_depth_scalar ( 10.0 , 0.25 , 5.0 , & params) ;
638651 assert ! ( !c. passed, "non-finite total must not pass" ) ;
639652 assert ! ( !c. total_depth_error. is_finite( ) ) ;
@@ -642,8 +655,16 @@ mod tests {
642655 #[ test]
643656 fn ordering_uncertainty_scales_inverse_with_bucket ( ) {
644657 // half-width = 1.0 → full interval = 2.0.
645- let wide = DepthCertParams { k_sigma : 2.0 , sort_bucket_width : 8.0 , ..Default :: default ( ) } ;
646- let narrow = DepthCertParams { k_sigma : 2.0 , sort_bucket_width : 4.0 , ..Default :: default ( ) } ;
658+ let wide = DepthCertParams {
659+ k_sigma : 2.0 ,
660+ sort_bucket_width : 8.0 ,
661+ ..Default :: default ( )
662+ } ;
663+ let narrow = DepthCertParams {
664+ k_sigma : 2.0 ,
665+ sort_bucket_width : 4.0 ,
666+ ..Default :: default ( )
667+ } ;
647668 let cw = certify_depth_scalar ( 10.0 , 0.25 , 5.0 , & wide) ;
648669 let cn = certify_depth_scalar ( 10.0 , 0.25 , 5.0 , & narrow) ;
649670 assert ! ( approx( cw. ordering_uncertainty, 0.25 , 1e-6 ) , "wide={}" , cw. ordering_uncertainty) ;
@@ -652,19 +673,30 @@ mod tests {
652673
653674 #[ test]
654675 fn ordering_uncertainty_saturates_at_one ( ) {
655- let p = DepthCertParams { k_sigma : 2.0 , sort_bucket_width : 0.1 , ..Default :: default ( ) } ;
676+ let p = DepthCertParams {
677+ k_sigma : 2.0 ,
678+ sort_bucket_width : 0.1 ,
679+ ..Default :: default ( )
680+ } ;
656681 let c = certify_depth_scalar ( 10.0 , 0.25 , 5.0 , & p) ;
657682 assert ! ( approx( c. ordering_uncertainty, 1.0 , 1e-6 ) , "should clamp to 1, got {}" , c. ordering_uncertainty) ;
658683 }
659684
660685 #[ test]
661686 fn occlusion_confidence_high_without_overlap_drops_with_overlap ( ) {
662- let isolated = DepthCertParams { k_sigma : 2.0 , ..Default :: default ( ) } ;
687+ let isolated = DepthCertParams {
688+ k_sigma : 2.0 ,
689+ ..Default :: default ( )
690+ } ;
663691 let c0 = certify_depth_scalar ( 10.0 , 0.25 , 5.0 , & isolated) ;
664692 assert ! ( approx( c0. occlusion_confidence, 1.0 , 1e-6 ) , "isolated splat should be fully confident" ) ;
665693
666694 // overlap = half the depth-spread half-width (1.0) → confidence 0.5.
667- let overlap = DepthCertParams { k_sigma : 2.0 , splat_support_overlap_error : 0.5 , ..Default :: default ( ) } ;
695+ let overlap = DepthCertParams {
696+ k_sigma : 2.0 ,
697+ splat_support_overlap_error : 0.5 ,
698+ ..Default :: default ( )
699+ } ;
668700 let c1 = certify_depth_scalar ( 10.0 , 0.25 , 5.0 , & overlap) ;
669701 assert ! ( approx( c1. occlusion_confidence, 0.5 , 1e-5 ) , "got {}" , c1. occlusion_confidence) ;
670702 assert ! ( ( 0.0 ..=1.0 ) . contains( & c1. occlusion_confidence) ) ;
@@ -682,17 +714,32 @@ mod tests {
682714 let mut g = Gaussian3D :: unit ( ) ;
683715 g. mean = [ 0.0 , 0.0 , 2.0 ] ;
684716 g. scale = [ 0.1 + rng ( & mut st) * 1.5 , 0.1 + rng ( & mut st) * 1.5 , 0.1 + rng ( & mut st) * 1.5 ] ;
685- let q = [ rng ( & mut st) * 2.0 - 1.0 , rng ( & mut st) * 2.0 - 1.0 , rng ( & mut st) * 2.0 - 1.0 , rng ( & mut st) * 2.0 - 1.0 ] ;
686- let n = ( q[ 0 ] * q[ 0 ] + q[ 1 ] * q[ 1 ] + q[ 2 ] * q[ 2 ] + q[ 3 ] * q[ 3 ] ) . sqrt ( ) . max ( 1e-6 ) ;
717+ let q = [
718+ rng ( & mut st) * 2.0 - 1.0 ,
719+ rng ( & mut st) * 2.0 - 1.0 ,
720+ rng ( & mut st) * 2.0 - 1.0 ,
721+ rng ( & mut st) * 2.0 - 1.0 ,
722+ ] ;
723+ let n = ( q[ 0 ] * q[ 0 ] + q[ 1 ] * q[ 1 ] + q[ 2 ] * q[ 2 ] + q[ 3 ] * q[ 3 ] )
724+ . sqrt ( )
725+ . max ( 1e-6 ) ;
687726 g. quat = [ q[ 0 ] / n, q[ 1 ] / n, q[ 2 ] / n, q[ 3 ] / n] ;
688727 g. opacity = 1.0 ;
689728 batch. push ( g) ;
690729 }
691730 // 90° about +Y so the look-axis is non-trivial.
692731 let view = [ [ 0.0 , 0.0 , 1.0 , 0.0 ] , [ 0.0 , 1.0 , 0.0 , 0.0 ] , [ -1.0 , 0.0 , 0.0 , 0.0 ] , [ 0.0 , 0.0 , 0.0 , 1.0 ] ] ;
693732 let cam = Camera {
694- view, fx : 512.0 , fy : 512.0 , cx : 256.0 , cy : 256.0 , near : 0.01 , far : 1000.0 ,
695- width : 512 , height : 512 , position : [ 0.0 , 0.0 , 0.0 ] ,
733+ view,
734+ fx : 512.0 ,
735+ fy : 512.0 ,
736+ cx : 256.0 ,
737+ cy : 256.0 ,
738+ near : 0.01 ,
739+ far : 1000.0 ,
740+ width : 512 ,
741+ height : 512 ,
742+ position : [ 0.0 , 0.0 , 0.0 ] ,
696743 } ;
697744 let mut got = vec ! [ 0.0f32 ; batch. len] ;
698745 camera_depth_variance_batch ( & batch, & cam, & mut got) ;
@@ -771,7 +818,10 @@ mod tests {
771818 #[ test]
772819 fn mesh_alignment_within_interval_is_aligned ( ) {
773820 // depth=10, cov_zz=0.25, k=2 → interval [9, 11].
774- let params = DepthCertParams { k_sigma : 2.0 , ..Default :: default ( ) } ;
821+ let params = DepthCertParams {
822+ k_sigma : 2.0 ,
823+ ..Default :: default ( )
824+ } ;
775825 let cert = certify_depth_scalar ( 10.0 , 0.25 , 5.0 , & params) ;
776826 let a = mesh_alignment ( 10.0 , 10.0 , & cert, 0.01 ) ;
777827 assert ! ( a. within_interval && a. aligned, "{a:?}" ) ;
@@ -781,9 +831,12 @@ mod tests {
781831
782832 #[ test]
783833 fn mesh_alignment_outside_interval_but_within_tolerance_is_aligned ( ) {
784- let params = DepthCertParams { k_sigma : 2.0 , ..Default :: default ( ) } ;
834+ let params = DepthCertParams {
835+ k_sigma : 2.0 ,
836+ ..Default :: default ( )
837+ } ;
785838 let cert = certify_depth_scalar ( 10.0 , 0.25 , 5.0 , & params) ; // [9, 11]
786- // mesh at 8.5 is outside [9,11] but a generous 2.0 tolerance accepts it.
839+ // mesh at 8.5 is outside [9,11] but a generous 2.0 tolerance accepts it.
787840 let a = mesh_alignment ( 8.5 , 10.0 , & cert, 2.0 ) ;
788841 assert ! ( !a. within_interval) ;
789842 assert ! ( a. within_tolerance) ;
@@ -792,7 +845,10 @@ mod tests {
792845
793846 #[ test]
794847 fn mesh_alignment_far_is_not_aligned_and_many_sigma ( ) {
795- let params = DepthCertParams { k_sigma : 2.0 , ..Default :: default ( ) } ;
848+ let params = DepthCertParams {
849+ k_sigma : 2.0 ,
850+ ..Default :: default ( )
851+ } ;
796852 let cert = certify_depth_scalar ( 10.0 , 0.25 , 5.0 , & params) ; // half-width 1.0
797853 let a = mesh_alignment ( 11.5 , 10.0 , & cert, 0.01 ) ;
798854 assert ! ( !a. aligned && !a. within_interval && !a. within_tolerance, "{a:?}" ) ;
@@ -821,7 +877,10 @@ mod tests {
821877
822878 let mut dv = vec ! [ 0.0f32 ; batch. len] ;
823879 camera_depth_variance_batch ( & batch, & cam, & mut dv) ;
824- let params = DepthCertParams { k_sigma : 3.0 , ..Default :: default ( ) } ;
880+ let params = DepthCertParams {
881+ k_sigma : 3.0 ,
882+ ..Default :: default ( )
883+ } ;
825884 let cert = certify_depth_scalar ( proj. depth [ 0 ] , dv[ 0 ] , proj. radius [ 0 ] , & params) ;
826885
827886 // Scan skin sits on the CAD plane → aligned, mesh inside interval.
0 commit comments