@@ -452,12 +452,11 @@ public GeodesicData Position(bool arcmode, double s12_a12,
452
452
{
453
453
outmask &= _caps & GeodesicMask . OUT_MASK ;
454
454
GeodesicData r = new GeodesicData ( ) ;
455
- if ( ! ( Init ( ) &&
456
- ( arcmode ||
457
- ( _caps & ( GeodesicMask . OUT_MASK & GeodesicMask . DISTANCE_IN ) ) != 0 )
458
- ) )
455
+ if ( ! ( Init && ( arcmode || ( _caps & ( GeodesicMask . OUT_MASK & GeodesicMask . DISTANCE_IN ) ) != 0 ) ) )
456
+ {
459
457
// Uninitialized or impossible distance calculation requested
460
458
return r ;
459
+ }
461
460
r . lat1 = _lat1 ; r . azi1 = _azi1 ;
462
461
r . lon1 = ( ( outmask & GeodesicMask . LONG_UNROLL ) != 0 ) ? _lon1 :
463
462
GeoMath . AngNormalize ( _lon1 ) ;
@@ -637,6 +636,7 @@ public GeodesicData Position(bool arcmode, double s12_a12,
637
636
* This is only useful if the GeodesicLine object has been constructed
638
637
* with <i>caps</i> |= {@link GeodesicMask#DISTANCE_IN}.
639
638
**********************************************************************/
639
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
640
640
public void SetDistance ( double s13 )
641
641
{
642
642
_s13 = s13 ;
@@ -653,6 +653,7 @@ public void SetDistance(double s13)
653
653
* The distance <i>s13</i> is only set if the GeodesicLine object has been
654
654
* constructed with <i>caps</i> |= {@link GeodesicMask#DISTANCE}.
655
655
**********************************************************************/
656
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
656
657
void SetArc ( double a13 )
657
658
{
658
659
_a13 = a13 ;
@@ -671,6 +672,7 @@ void SetArc(double a13)
671
672
* point 1 to point 3 (meters); otherwise it is the arc length from
672
673
* point 1 to point 3 (degrees); it can be negative.
673
674
**********************************************************************/
675
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
674
676
public void GenSetDistance ( bool arcmode , double s13_a13 )
675
677
{
676
678
if ( arcmode )
@@ -682,90 +684,82 @@ public void GenSetDistance(bool arcmode, double s13_a13)
682
684
/**
683
685
* @return true if the object has been initialized.
684
686
**********************************************************************/
685
- private bool Init ( ) { return _caps != 0 ; }
687
+ private bool Init => _caps != 0 ;
686
688
687
689
/**
688
690
* @return <i>lat1</i> the latitude of point 1 (degrees).
689
691
**********************************************************************/
690
- public double Latitude ( )
691
- { return Init ( ) ? _lat1 : Double . NaN ; }
692
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
693
+ public double Latitude ( ) => Init ? _lat1 : double . NaN ;
692
694
693
695
/**
694
696
* @return <i>lon1</i> the longitude of point 1 (degrees).
695
697
**********************************************************************/
696
- public double Longitude ( )
697
- { return Init ( ) ? _lon1 : Double . NaN ; }
698
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
699
+ public double Longitude ( ) => Init ? _lon1 : double . NaN ;
698
700
699
701
/**
700
702
* @return <i>azi1</i> the azimuth (degrees) of the geodesic line at point 1.
701
703
**********************************************************************/
702
- public double Azimuth ( )
703
- { return Init ( ) ? _azi1 : Double . NaN ; }
704
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
705
+ public double Azimuth ( ) => Init ? _azi1 : double . NaN ;
704
706
705
707
/**
706
708
* @return pair of sine and cosine of <i>azi1</i> the azimuth (degrees) of
707
709
* the geodesic line at point 1.
708
710
**********************************************************************/
709
- public Pair AzimuthCosines ( )
710
- {
711
- return new Pair ( Init ( ) ? _salp1 : Double . NaN ,
712
- Init ( ) ? _calp1 : Double . NaN ) ;
713
- }
711
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
712
+ public Pair AzimuthCosines ( ) =>
713
+ new Pair ( Init ? _salp1 : Double . NaN , Init ? _calp1 : Double . NaN ) ;
714
714
715
715
/**
716
716
* @return <i>azi0</i> the azimuth (degrees) of the geodesic line as it
717
717
* crosses the equator in a northward direction.
718
718
**********************************************************************/
719
- public double EquatorialAzimuth ( )
720
- {
721
- return Init ( ) ?
722
- GeoMath . Atan2d ( _salp0 , _calp0 ) : Double . NaN ;
723
- }
719
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
720
+ public double EquatorialAzimuth ( ) =>
721
+ Init ? GeoMath . Atan2d ( _salp0 , _calp0 ) : Double . NaN ;
724
722
725
723
/**
726
724
* @return pair of sine and cosine of <i>azi0</i> the azimuth of the geodesic
727
725
* line as it crosses the equator in a northward direction.
728
726
**********************************************************************/
729
- public Pair EquatorialAzimuthCosines ( )
730
- {
731
- return new Pair ( Init ( ) ? _salp0 : Double . NaN ,
732
- Init ( ) ? _calp0 : Double . NaN ) ;
733
- }
727
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
728
+ public Pair EquatorialAzimuthCosines ( ) =>
729
+ new Pair ( Init ? _salp0 : Double . NaN , Init ? _calp0 : Double . NaN ) ;
734
730
735
731
/**
736
732
* @return <i>a1</i> the arc length (degrees) between the northward
737
733
* equatorial crossing and point 1.
738
734
**********************************************************************/
739
- public double EquatorialArc ( )
740
- {
741
- return Init ( ) ?
742
- GeoMath . Atan2d ( _ssig1 , _csig1 ) : Double . NaN ;
743
- }
735
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
736
+ public double EquatorialArc ( ) =>
737
+ Init ? GeoMath . Atan2d ( _ssig1 , _csig1 ) : double . NaN ;
744
738
745
739
/**
746
740
* @return <i>a</i> the equatorial radius of the ellipsoid (meters). This is
747
741
* the value inherited from the Geodesic object used in the constructor.
748
742
**********************************************************************/
749
- public double MajorRadius ( )
750
- { return Init ( ) ? _a : Double . NaN ; }
743
+ public double MajorRadius => Init ? _a : double . NaN ;
751
744
752
745
/**
753
746
* @return <i>f</i> the flattening of the ellipsoid. This is the value
754
747
* inherited from the Geodesic object used in the constructor.
755
748
**********************************************************************/
756
- public double Flattening ( )
757
- { return Init ( ) ? _f : Double . NaN ; }
749
+ public double Flattening => Init ? _f : double . NaN ;
758
750
759
751
/**
760
752
* @return <i>caps</i> the computational capabilities that this object was
761
753
* constructed with. LATITUDE and AZIMUTH are always included.
762
754
**********************************************************************/
763
- public int Capabilities ( ) { return _caps ; }
755
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
756
+ public int Capabilities ( ) => _caps ;
764
757
765
758
/**
766
759
* @param testcaps a set of bitor'ed {@link GeodesicMask} values.
767
760
* @return true if the GeodesicLine object has all these capabilities.
768
761
**********************************************************************/
762
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
769
763
public bool Capabilities ( int testcaps )
770
764
{
771
765
testcaps &= GeodesicMask . OUT_ALL ;
@@ -780,18 +774,20 @@ public bool Capabilities(int testcaps)
780
774
* @return <i>s13</i> if <i>arcmode</i> is false; <i>a13</i> if
781
775
* <i>arcmode</i> is true.
782
776
**********************************************************************/
783
- public double GenDistance ( bool arcmode )
784
- { return Init ( ) ? ( arcmode ? _a13 : _s13 ) : Double . NaN ; }
777
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
778
+ public double GenDistance ( bool arcmode ) => Init ? ( arcmode ? _a13 : _s13 ) : double . NaN ;
785
779
786
780
/**
787
781
* @return <i>s13</i>, the distance to point 3 (meters).
788
782
**********************************************************************/
789
- public double Distance ( ) { return GenDistance ( false ) ; }
783
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
784
+ public double Distance ( ) => GenDistance ( false ) ;
790
785
791
786
/**
792
787
* @return <i>a13</i>, the arc length to point 3 (degrees).
793
788
**********************************************************************/
794
- public double Arc ( ) { return GenDistance ( true ) ; }
789
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
790
+ public double Arc ( ) => GenDistance ( true ) ;
795
791
796
792
}
797
793
0 commit comments