@@ -16,7 +16,9 @@ pub enum LasDimension {
1616 Classification ,
1717 ScanDirectionFlag ,
1818 EdgeOfFlightLine ,
19- ScanAngleRank ,
19+ /// Scan angle in degrees. LAS 1.4 stores it as a scaled i16 in 0.006°
20+ /// increments; the column carries the decoded degrees losslessly.
21+ ScanAngle ,
2022 UserData ,
2123 PointSourceId ,
2224 Synthetic ,
@@ -41,8 +43,7 @@ impl LasDimension {
4143 pub const fn default_scalar ( self ) -> Option < ScalarType > {
4244 match self {
4345 Self :: X | Self :: Y | Self :: Z | Self :: GpsTime => Some ( ScalarType :: F64 ) ,
44- Self :: WavePacketReturnPointWaveformLocation => Some ( ScalarType :: F32 ) ,
45- Self :: ScanAngleRank => Some ( ScalarType :: I16 ) ,
46+ Self :: ScanAngle | Self :: WavePacketReturnPointWaveformLocation => Some ( ScalarType :: F32 ) ,
4647 Self :: WaveformPacketByteOffset => Some ( ScalarType :: U64 ) ,
4748 Self :: Intensity
4849 | Self :: PointSourceId
@@ -94,7 +95,7 @@ impl ColumnSelection {
9495 LasDimension :: Classification ,
9596 LasDimension :: ScanDirectionFlag ,
9697 LasDimension :: EdgeOfFlightLine ,
97- LasDimension :: ScanAngleRank ,
98+ LasDimension :: ScanAngle ,
9899 LasDimension :: UserData ,
99100 LasDimension :: PointSourceId ,
100101 LasDimension :: Synthetic ,
@@ -433,7 +434,7 @@ pub fn layout_for_las_format(format: LasPointFormat) -> Vec<ColumnSpec> {
433434 LasDimension :: Classification ,
434435 LasDimension :: ScanDirectionFlag ,
435436 LasDimension :: EdgeOfFlightLine ,
436- LasDimension :: ScanAngleRank ,
437+ LasDimension :: ScanAngle ,
437438 LasDimension :: UserData ,
438439 LasDimension :: PointSourceId ,
439440 LasDimension :: Synthetic ,
@@ -473,12 +474,6 @@ pub fn layout_for_las_format(format: LasPointFormat) -> Vec<ColumnSpec> {
473474 columns
474475}
475476
476- /// Converts scan angle degrees into the rank-style column used by existing readers.
477- pub fn scan_angle_rank_from_degrees ( degrees : f32 ) -> i16 {
478- let scaled = ( degrees * 180.0 / 90.0 ) . round ( ) as i32 ;
479- scaled. clamp ( i16:: MIN as i32 , i16:: MAX as i32 ) as i16
480- }
481-
482477fn push_default_specs < I > ( columns : & mut Vec < ColumnSpec > , dims : I )
483478where
484479 I : IntoIterator < Item = LasDimension > ,
@@ -575,7 +570,7 @@ mod tests {
575570 LasDimension :: Classification ,
576571 LasDimension :: ScanDirectionFlag ,
577572 LasDimension :: EdgeOfFlightLine ,
578- LasDimension :: ScanAngleRank ,
573+ LasDimension :: ScanAngle ,
579574 LasDimension :: UserData ,
580575 LasDimension :: PointSourceId ,
581576 LasDimension :: Synthetic ,
@@ -699,11 +694,12 @@ mod tests {
699694 assert ! ( ColumnSpec :: new( LasDimension :: ExtraBytes , ScalarType :: U8 )
700695 . validate_default_scalar( )
701696 . is_err( ) ) ;
702- assert ! (
703- ColumnSpec :: new( LasDimension :: ScanAngleRank , ScalarType :: F32 )
704- . validate_default_scalar( )
705- . is_err( )
706- ) ;
697+ assert ! ( ColumnSpec :: new( LasDimension :: ScanAngle , ScalarType :: I16 )
698+ . validate_default_scalar( )
699+ . is_err( ) ) ;
700+ assert ! ( ColumnSpec :: new( LasDimension :: ScanAngle , ScalarType :: F32 )
701+ . validate_default_scalar( )
702+ . is_ok( ) ) ;
707703 }
708704
709705 #[ test]
@@ -733,15 +729,6 @@ mod tests {
733729 assert ! ( all. contains( LasDimension :: ExtraBytes ) ) ;
734730 }
735731
736- #[ test]
737- fn scan_angle_rank_uses_engine_conversion ( ) {
738- assert_eq ! ( 0 , scan_angle_rank_from_degrees( 0.0 ) ) ;
739- assert_eq ! ( 91 , scan_angle_rank_from_degrees( 45.25 ) ) ;
740- assert_eq ! ( -91 , scan_angle_rank_from_degrees( -45.25 ) ) ;
741- assert_eq ! ( i16 :: MAX , scan_angle_rank_from_degrees( f32 :: MAX ) ) ;
742- assert_eq ! ( i16 :: MIN , scan_angle_rank_from_degrees( f32 :: MIN ) ) ;
743- }
744-
745732 #[ test]
746733 fn layout_for_format_0_has_core_dimensions ( ) {
747734 assert_layout_dims ( 0 , base_layout_dims ( ) ) ;
0 commit comments