Converting Geographic Coordinates into Lambert2008 coordinatesConverting from polar coordinates to rectangular coordinatesConverting latitude and longitude coordinates from CSV using web serviceWorking and calculating with geographic positionsConverting KML/XML to JavascriptGeographic searchUpdating geo coordinatesCompute spherical distance matrix from list of geographical coordinatesFunction to find user's region based on GPS coordinatesConvert geodetic coordinates to geocentric (cartesian)Convert British and Irish National Grid references to or from WGS84 geodetic coordinates

What is "oversubscription" in Networking?

Golf the smallest circle!

My colleague is constantly blaming me for his errors

Are all commands with an optional argument fragile?

How can I deal with extreme temperatures in a hotel room?

I need help with pasta

What's the safest way to inform a new user of their password on an invite-only website?

Company threatening to call my current job after I declined their offer

How Do I Know When I am in Private Mode?

Can SOCPs approximate better than LPs?

Will writing actual numbers instead of writing them with letters affect readership?

13th chords on guitar

Sharing referee/AE report online to point out a grievous error in refereeing

Is is okay to submit a paper from a master's thesis without informing the advisor?

Comment traduire « That screams X »

Handling a player (unintentionally) stealing the spotlight

Why was Mal so quick to drop Bester in favour of Kaylee?

Just graduated with a master’s degree, but I internalised nothing

Are the requirements of a Horn of Valhalla cumulative?

How is this practical and very old scene shot?

What happens to a wizard's magic when they are swallowed by a tarrasque?

Is Cyclic Ether oxidised by periodic acid

How do we separate rules of logic from non-logical constraints?

Who are these Discworld wizards from this picture?



Converting Geographic Coordinates into Lambert2008 coordinates


Converting from polar coordinates to rectangular coordinatesConverting latitude and longitude coordinates from CSV using web serviceWorking and calculating with geographic positionsConverting KML/XML to JavascriptGeographic searchUpdating geo coordinatesCompute spherical distance matrix from list of geographical coordinatesFunction to find user's region based on GPS coordinatesConvert geodetic coordinates to geocentric (cartesian)Convert British and Irish National Grid references to or from WGS84 geodetic coordinates






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








5












$begingroup$


This is part of a game made in Unity3D.



I wrote this class to convert geographic coordinates into lambert 2008 coordinates based on this reference document:



http://www.ngi.be/Common/Lambert2008/Transformation_Geographic_Lambert_FR.pdf



Reason is that I'm using a Belgian National Geographic Institute map as background, and want to locate waypoint and player position with full accuracy.



Code works fine, and runs in .000001s but I'm unhappy with its readability.



I start by declaring all the constants I need



public const int a = 6378137;
public const double f = 1 / 298.257222101;
public const double lowerLatitude = 49.8333333 * Mathf.Deg2Rad;
public const double upperLatitude = 51.1666667 * Mathf.Deg2Rad;
public const double originLatitude = 50.797815 * Mathf.Deg2Rad;
public const double originLongitude = 4.359215833 * Mathf.Deg2Rad;
public const int originX = 649328;
public const int originY = 665262;


Then I used properties for all values derived from those constants




public static double Excentricity get => System.Math.Sqrt((2 * f) - (f * f));

static double MLower get => M(lowerLatitude);
static double MUpper get => M(upperLatitude);

static double M(double latitude)

return System.Math.Cos(latitude) / System.Math.Sqrt(1 - (Excentricity * Excentricity * System.Math.Pow(System.Math.Sin(latitude), 2)));


static double TLower get => T(lowerLatitude);
static double TUpper get => T(upperLatitude);
static double TOrigin get => T(originLatitude);

static double T(double latitude)


return System.Math.Tan(Mathf.PI / 4 - latitude / 2) / System.Math.Pow((1 - Excentricity * System.Math.Sin(latitude)) / (1 + Excentricity * System.Math.Sin(latitude)), Excentricity / 2);


static double N get => (System.Math.Log(MLower) - System.Math.Log(MUpper)) / (System.Math.Log(TLower) - System.Math.Log(TUpper));

static double G get => MLower / (N * System.Math.Pow(TLower, N));

static double ROrigin get => R(TOrigin);

static double R (double t)

return a * G * System.Math.Pow(t, N);




As you can see some of the calculations are written on very long lines. I'm unhappy with their readability, but I have no Idea on how to re-write them to make them look better while not messing up floating point approximations.



Finally I perform the actual conversion using all those calculated values.



public static Vector2 FromGeographicRelative(Vector2 coordinates)


double t = T((double)coordinates.x * Mathf.Deg2Rad);
double r = R(t);
double angle = N * ((double)coordinates.y * Mathf.Deg2Rad - originLongitude);
Vector2 lambertCoord = new Vector2

x = (float) (r * System.Math.Sin(angle)),
y = (float) (ROrigin - r * System.Math.Cos(angle))
;
return lambertCoord;











share|improve this question









New contributor



user1747281 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$


















    5












    $begingroup$


    This is part of a game made in Unity3D.



    I wrote this class to convert geographic coordinates into lambert 2008 coordinates based on this reference document:



    http://www.ngi.be/Common/Lambert2008/Transformation_Geographic_Lambert_FR.pdf



    Reason is that I'm using a Belgian National Geographic Institute map as background, and want to locate waypoint and player position with full accuracy.



    Code works fine, and runs in .000001s but I'm unhappy with its readability.



    I start by declaring all the constants I need



    public const int a = 6378137;
    public const double f = 1 / 298.257222101;
    public const double lowerLatitude = 49.8333333 * Mathf.Deg2Rad;
    public const double upperLatitude = 51.1666667 * Mathf.Deg2Rad;
    public const double originLatitude = 50.797815 * Mathf.Deg2Rad;
    public const double originLongitude = 4.359215833 * Mathf.Deg2Rad;
    public const int originX = 649328;
    public const int originY = 665262;


    Then I used properties for all values derived from those constants




    public static double Excentricity get => System.Math.Sqrt((2 * f) - (f * f));

    static double MLower get => M(lowerLatitude);
    static double MUpper get => M(upperLatitude);

    static double M(double latitude)

    return System.Math.Cos(latitude) / System.Math.Sqrt(1 - (Excentricity * Excentricity * System.Math.Pow(System.Math.Sin(latitude), 2)));


    static double TLower get => T(lowerLatitude);
    static double TUpper get => T(upperLatitude);
    static double TOrigin get => T(originLatitude);

    static double T(double latitude)


    return System.Math.Tan(Mathf.PI / 4 - latitude / 2) / System.Math.Pow((1 - Excentricity * System.Math.Sin(latitude)) / (1 + Excentricity * System.Math.Sin(latitude)), Excentricity / 2);


    static double N get => (System.Math.Log(MLower) - System.Math.Log(MUpper)) / (System.Math.Log(TLower) - System.Math.Log(TUpper));

    static double G get => MLower / (N * System.Math.Pow(TLower, N));

    static double ROrigin get => R(TOrigin);

    static double R (double t)

    return a * G * System.Math.Pow(t, N);




    As you can see some of the calculations are written on very long lines. I'm unhappy with their readability, but I have no Idea on how to re-write them to make them look better while not messing up floating point approximations.



    Finally I perform the actual conversion using all those calculated values.



    public static Vector2 FromGeographicRelative(Vector2 coordinates)


    double t = T((double)coordinates.x * Mathf.Deg2Rad);
    double r = R(t);
    double angle = N * ((double)coordinates.y * Mathf.Deg2Rad - originLongitude);
    Vector2 lambertCoord = new Vector2

    x = (float) (r * System.Math.Sin(angle)),
    y = (float) (ROrigin - r * System.Math.Cos(angle))
    ;
    return lambertCoord;











    share|improve this question









    New contributor



    user1747281 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






    $endgroup$














      5












      5








      5





      $begingroup$


      This is part of a game made in Unity3D.



      I wrote this class to convert geographic coordinates into lambert 2008 coordinates based on this reference document:



      http://www.ngi.be/Common/Lambert2008/Transformation_Geographic_Lambert_FR.pdf



      Reason is that I'm using a Belgian National Geographic Institute map as background, and want to locate waypoint and player position with full accuracy.



      Code works fine, and runs in .000001s but I'm unhappy with its readability.



      I start by declaring all the constants I need



      public const int a = 6378137;
      public const double f = 1 / 298.257222101;
      public const double lowerLatitude = 49.8333333 * Mathf.Deg2Rad;
      public const double upperLatitude = 51.1666667 * Mathf.Deg2Rad;
      public const double originLatitude = 50.797815 * Mathf.Deg2Rad;
      public const double originLongitude = 4.359215833 * Mathf.Deg2Rad;
      public const int originX = 649328;
      public const int originY = 665262;


      Then I used properties for all values derived from those constants




      public static double Excentricity get => System.Math.Sqrt((2 * f) - (f * f));

      static double MLower get => M(lowerLatitude);
      static double MUpper get => M(upperLatitude);

      static double M(double latitude)

      return System.Math.Cos(latitude) / System.Math.Sqrt(1 - (Excentricity * Excentricity * System.Math.Pow(System.Math.Sin(latitude), 2)));


      static double TLower get => T(lowerLatitude);
      static double TUpper get => T(upperLatitude);
      static double TOrigin get => T(originLatitude);

      static double T(double latitude)


      return System.Math.Tan(Mathf.PI / 4 - latitude / 2) / System.Math.Pow((1 - Excentricity * System.Math.Sin(latitude)) / (1 + Excentricity * System.Math.Sin(latitude)), Excentricity / 2);


      static double N get => (System.Math.Log(MLower) - System.Math.Log(MUpper)) / (System.Math.Log(TLower) - System.Math.Log(TUpper));

      static double G get => MLower / (N * System.Math.Pow(TLower, N));

      static double ROrigin get => R(TOrigin);

      static double R (double t)

      return a * G * System.Math.Pow(t, N);




      As you can see some of the calculations are written on very long lines. I'm unhappy with their readability, but I have no Idea on how to re-write them to make them look better while not messing up floating point approximations.



      Finally I perform the actual conversion using all those calculated values.



      public static Vector2 FromGeographicRelative(Vector2 coordinates)


      double t = T((double)coordinates.x * Mathf.Deg2Rad);
      double r = R(t);
      double angle = N * ((double)coordinates.y * Mathf.Deg2Rad - originLongitude);
      Vector2 lambertCoord = new Vector2

      x = (float) (r * System.Math.Sin(angle)),
      y = (float) (ROrigin - r * System.Math.Cos(angle))
      ;
      return lambertCoord;











      share|improve this question









      New contributor



      user1747281 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      $endgroup$




      This is part of a game made in Unity3D.



      I wrote this class to convert geographic coordinates into lambert 2008 coordinates based on this reference document:



      http://www.ngi.be/Common/Lambert2008/Transformation_Geographic_Lambert_FR.pdf



      Reason is that I'm using a Belgian National Geographic Institute map as background, and want to locate waypoint and player position with full accuracy.



      Code works fine, and runs in .000001s but I'm unhappy with its readability.



      I start by declaring all the constants I need



      public const int a = 6378137;
      public const double f = 1 / 298.257222101;
      public const double lowerLatitude = 49.8333333 * Mathf.Deg2Rad;
      public const double upperLatitude = 51.1666667 * Mathf.Deg2Rad;
      public const double originLatitude = 50.797815 * Mathf.Deg2Rad;
      public const double originLongitude = 4.359215833 * Mathf.Deg2Rad;
      public const int originX = 649328;
      public const int originY = 665262;


      Then I used properties for all values derived from those constants




      public static double Excentricity get => System.Math.Sqrt((2 * f) - (f * f));

      static double MLower get => M(lowerLatitude);
      static double MUpper get => M(upperLatitude);

      static double M(double latitude)

      return System.Math.Cos(latitude) / System.Math.Sqrt(1 - (Excentricity * Excentricity * System.Math.Pow(System.Math.Sin(latitude), 2)));


      static double TLower get => T(lowerLatitude);
      static double TUpper get => T(upperLatitude);
      static double TOrigin get => T(originLatitude);

      static double T(double latitude)


      return System.Math.Tan(Mathf.PI / 4 - latitude / 2) / System.Math.Pow((1 - Excentricity * System.Math.Sin(latitude)) / (1 + Excentricity * System.Math.Sin(latitude)), Excentricity / 2);


      static double N get => (System.Math.Log(MLower) - System.Math.Log(MUpper)) / (System.Math.Log(TLower) - System.Math.Log(TUpper));

      static double G get => MLower / (N * System.Math.Pow(TLower, N));

      static double ROrigin get => R(TOrigin);

      static double R (double t)

      return a * G * System.Math.Pow(t, N);




      As you can see some of the calculations are written on very long lines. I'm unhappy with their readability, but I have no Idea on how to re-write them to make them look better while not messing up floating point approximations.



      Finally I perform the actual conversion using all those calculated values.



      public static Vector2 FromGeographicRelative(Vector2 coordinates)


      double t = T((double)coordinates.x * Mathf.Deg2Rad);
      double r = R(t);
      double angle = N * ((double)coordinates.y * Mathf.Deg2Rad - originLongitude);
      Vector2 lambertCoord = new Vector2

      x = (float) (r * System.Math.Sin(angle)),
      y = (float) (ROrigin - r * System.Math.Cos(angle))
      ;
      return lambertCoord;








      c# geospatial






      share|improve this question









      New contributor



      user1747281 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question









      New contributor



      user1747281 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question








      edited 4 hours ago







      user1747281













      New contributor



      user1747281 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked 8 hours ago









      user1747281user1747281

      263 bronze badges




      263 bronze badges




      New contributor



      user1747281 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      user1747281 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          4 Answers
          4






          active

          oldest

          votes


















          2












          $begingroup$

          Since the code is about implementing mathematical formulas I would make an exception and completely ignore the usual naming conventions. Instead, I would use the exact symbols as that document.



          This would mean a little bit copy/paste because it's difficult to write symbols like [ϕ, λ, θ] but the compiler can work with unicode.



          I find that code like this:



          var rad = 0.01745329252;

          var ellipsoide = (a: 6378137, f: 1 / 298.257222101);
          var ϕ1 = 49.8333333 * rad;
          var ϕ2 = 51.1666667 * rad;
          var ϕ0 = 50.797815 * rad;
          var λ0 = 4.359215833 * rad;
          var x0 = 649328;
          var y0 = 665262;


          is the most easy one to understand because you can compare it with the book almost without any translation.






          share|improve this answer











          $endgroup$












          • $begingroup$
            Oh, that's awesome, I didn't know the compiler accepted special characters like this. Thanks a lot.
            $endgroup$
            – user1747281
            3 hours ago


















          1












          $begingroup$

          I think it's a code smell to have more than one (infix) operator in one line.




          What would be the recommended way of doing this, both for readability and performance?




          Yes! But please use good names.



          For performance it doesn't matter. The C# compiler will probably inline those things so it's the same generated IL code



          Related:



          "Expressions should not be too complex"



          https://rules.sonarsource.com/csharp/RSPEC-1067?search=operator




          Noncompliant Code Example
          With the default threshold value of 3



          if (((condition1 && condition2) || (condition3 && condition4)) && condition5) ... 


          Compliant Solution



          if ((MyFirstCondition() || MySecondCondition()) && MyLastCondition()) ... 






          share|improve this answer








          New contributor



          Julian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          $endgroup$












          • $begingroup$
            I would love to use good names, but I just have no idea what to name things. Here's the reference document for the formulas, good luck with coming up with nice names: ngi.be/Common/Lambert2008/…
            $endgroup$
            – user1747281
            8 hours ago










          • $begingroup$
            What is a good name for mathematical functions and operands? I rather like f(a, b) then anyfunction(firstOperandOfAnyFunction, secondOperandOfAnyFunction)
            $endgroup$
            – dfhwze
            5 hours ago


















          1












          $begingroup$

          • In math heavy code you might use the using static directive, see the microsoft documentation such that System.Math. can be removed throughout the code.


          • Excentricity can be made a constant and may have a shorter name as I have seen in other codes dealing with WGS84.

          • If possible refer to a document and formula number in a comment

          • Although sometime frowned on, I like to layout the the code as much as possible as the mathematical equation looks like. (use extra parentheses if it improves readability)

          With this in mind I came to to following example for method T.



          using static System.Math;

          public const double E2 = (2 * f) - (f * f); # Excentricity squared
          public const double E1 = Sqrt(E2); # Excentricity

          .....

          static double T(double lat)

          // if possible refer to a document and formula number
          return Tan(PI / 4 - lat / 2)
          /
          Pow( ((1 - E1 * Sin(lat))
          /
          (1 + E1 * Sin(lat))) , E1 / 2);






          share|improve this answer











          $endgroup$












          • $begingroup$
            Thanks, a lot for these hints. I'm deliberately not using "using System.Math" because this code is part of a game made with Unity3D. Typically, Unity programmers would use UnityEngine.Mathf, which is a wrapper class for System.Math using floats instead of doubles (because game engines like floats better). So to make it more obvious I explicitly prefix my math calls with System.Math (perhaps a bad practice, would be happy to have your opinion on this) Thanks for the excentricity tip, will definitely do that.
            $endgroup$
            – user1747281
            6 hours ago










          • $begingroup$
            You can add a using directive: using Math = System.Math
            $endgroup$
            – dfhwze
            5 hours ago










          • $begingroup$
            @user1747281 I am not familiar with Unity programmers conventions, but using static UnityEngine.Mathf might be acceptable, also when using Mathf the constants can be made floats instead of doubles.
            $endgroup$
            – Jan Kuiken
            5 hours ago







          • 1




            $begingroup$
            @user1747281 that this code is part of a game made with Unity3D should have been mentioned in the question so that reviewers have enough context how it is used.
            $endgroup$
            – t3chb0t
            5 hours ago










          • $begingroup$
            @t3chb0t done, thanks for pointing that out
            $endgroup$
            – user1747281
            4 hours ago


















          1












          $begingroup$

          Naming Conventions



          Some, but not all of your variables and functions are named after mathematical usage. I like it either way, but a combination is an inconsistent naming convention.




          public const double f = 1 / 298.257222101;
          public const double lowerLatitude = 49.8333333 * Mathf.Deg2Rad;



          Constants



          You have a lot of mathematical constants that aren't constants in your API. Why?




          Excentricity, MLower, MUpper, TLower, TUpper, TOrigin, ROrigin, N, G.



          Aliases



          You are using both System.Math and UnityEngine.Mathf. To avoid repeating code I suggest to import the one you used most as a static using and the other as an aliased using.



          using static UnityEngine.Mathf;
          using Math = System.Math;





          share|improve this answer









          $endgroup$












          • $begingroup$
            Naming conventions: I didn't know you could use mathematical symbols in names, so instead of naming the variable "phi1", "phi2" etc... I opted for a purposeful name. But I now know better thanks to this community :-) Constants: I don't understand what you mean. They're not constants, they're derived from constants. I tried this: public const double Excentricity = System.Math.Sqrt((2 * f) - (f * f)); but the compiler doesn't accept it because Sqrt((2 * f)-(f*f)) is not a constant. Aliases: I like that idea, thanks for the tip
            $endgroup$
            – user1747281
            2 hours ago













          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "196"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          user1747281 is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f222988%2fconverting-geographic-coordinates-into-lambert2008-coordinates%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          4 Answers
          4






          active

          oldest

          votes








          4 Answers
          4






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2












          $begingroup$

          Since the code is about implementing mathematical formulas I would make an exception and completely ignore the usual naming conventions. Instead, I would use the exact symbols as that document.



          This would mean a little bit copy/paste because it's difficult to write symbols like [ϕ, λ, θ] but the compiler can work with unicode.



          I find that code like this:



          var rad = 0.01745329252;

          var ellipsoide = (a: 6378137, f: 1 / 298.257222101);
          var ϕ1 = 49.8333333 * rad;
          var ϕ2 = 51.1666667 * rad;
          var ϕ0 = 50.797815 * rad;
          var λ0 = 4.359215833 * rad;
          var x0 = 649328;
          var y0 = 665262;


          is the most easy one to understand because you can compare it with the book almost without any translation.






          share|improve this answer











          $endgroup$












          • $begingroup$
            Oh, that's awesome, I didn't know the compiler accepted special characters like this. Thanks a lot.
            $endgroup$
            – user1747281
            3 hours ago















          2












          $begingroup$

          Since the code is about implementing mathematical formulas I would make an exception and completely ignore the usual naming conventions. Instead, I would use the exact symbols as that document.



          This would mean a little bit copy/paste because it's difficult to write symbols like [ϕ, λ, θ] but the compiler can work with unicode.



          I find that code like this:



          var rad = 0.01745329252;

          var ellipsoide = (a: 6378137, f: 1 / 298.257222101);
          var ϕ1 = 49.8333333 * rad;
          var ϕ2 = 51.1666667 * rad;
          var ϕ0 = 50.797815 * rad;
          var λ0 = 4.359215833 * rad;
          var x0 = 649328;
          var y0 = 665262;


          is the most easy one to understand because you can compare it with the book almost without any translation.






          share|improve this answer











          $endgroup$












          • $begingroup$
            Oh, that's awesome, I didn't know the compiler accepted special characters like this. Thanks a lot.
            $endgroup$
            – user1747281
            3 hours ago













          2












          2








          2





          $begingroup$

          Since the code is about implementing mathematical formulas I would make an exception and completely ignore the usual naming conventions. Instead, I would use the exact symbols as that document.



          This would mean a little bit copy/paste because it's difficult to write symbols like [ϕ, λ, θ] but the compiler can work with unicode.



          I find that code like this:



          var rad = 0.01745329252;

          var ellipsoide = (a: 6378137, f: 1 / 298.257222101);
          var ϕ1 = 49.8333333 * rad;
          var ϕ2 = 51.1666667 * rad;
          var ϕ0 = 50.797815 * rad;
          var λ0 = 4.359215833 * rad;
          var x0 = 649328;
          var y0 = 665262;


          is the most easy one to understand because you can compare it with the book almost without any translation.






          share|improve this answer











          $endgroup$



          Since the code is about implementing mathematical formulas I would make an exception and completely ignore the usual naming conventions. Instead, I would use the exact symbols as that document.



          This would mean a little bit copy/paste because it's difficult to write symbols like [ϕ, λ, θ] but the compiler can work with unicode.



          I find that code like this:



          var rad = 0.01745329252;

          var ellipsoide = (a: 6378137, f: 1 / 298.257222101);
          var ϕ1 = 49.8333333 * rad;
          var ϕ2 = 51.1666667 * rad;
          var ϕ0 = 50.797815 * rad;
          var λ0 = 4.359215833 * rad;
          var x0 = 649328;
          var y0 = 665262;


          is the most easy one to understand because you can compare it with the book almost without any translation.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 3 hours ago









          dfhwze

          3,6161 gold badge6 silver badges32 bronze badges




          3,6161 gold badge6 silver badges32 bronze badges










          answered 3 hours ago









          t3chb0tt3chb0t

          36.1k7 gold badges58 silver badges133 bronze badges




          36.1k7 gold badges58 silver badges133 bronze badges











          • $begingroup$
            Oh, that's awesome, I didn't know the compiler accepted special characters like this. Thanks a lot.
            $endgroup$
            – user1747281
            3 hours ago
















          • $begingroup$
            Oh, that's awesome, I didn't know the compiler accepted special characters like this. Thanks a lot.
            $endgroup$
            – user1747281
            3 hours ago















          $begingroup$
          Oh, that's awesome, I didn't know the compiler accepted special characters like this. Thanks a lot.
          $endgroup$
          – user1747281
          3 hours ago




          $begingroup$
          Oh, that's awesome, I didn't know the compiler accepted special characters like this. Thanks a lot.
          $endgroup$
          – user1747281
          3 hours ago













          1












          $begingroup$

          I think it's a code smell to have more than one (infix) operator in one line.




          What would be the recommended way of doing this, both for readability and performance?




          Yes! But please use good names.



          For performance it doesn't matter. The C# compiler will probably inline those things so it's the same generated IL code



          Related:



          "Expressions should not be too complex"



          https://rules.sonarsource.com/csharp/RSPEC-1067?search=operator




          Noncompliant Code Example
          With the default threshold value of 3



          if (((condition1 && condition2) || (condition3 && condition4)) && condition5) ... 


          Compliant Solution



          if ((MyFirstCondition() || MySecondCondition()) && MyLastCondition()) ... 






          share|improve this answer








          New contributor



          Julian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          $endgroup$












          • $begingroup$
            I would love to use good names, but I just have no idea what to name things. Here's the reference document for the formulas, good luck with coming up with nice names: ngi.be/Common/Lambert2008/…
            $endgroup$
            – user1747281
            8 hours ago










          • $begingroup$
            What is a good name for mathematical functions and operands? I rather like f(a, b) then anyfunction(firstOperandOfAnyFunction, secondOperandOfAnyFunction)
            $endgroup$
            – dfhwze
            5 hours ago















          1












          $begingroup$

          I think it's a code smell to have more than one (infix) operator in one line.




          What would be the recommended way of doing this, both for readability and performance?




          Yes! But please use good names.



          For performance it doesn't matter. The C# compiler will probably inline those things so it's the same generated IL code



          Related:



          "Expressions should not be too complex"



          https://rules.sonarsource.com/csharp/RSPEC-1067?search=operator




          Noncompliant Code Example
          With the default threshold value of 3



          if (((condition1 && condition2) || (condition3 && condition4)) && condition5) ... 


          Compliant Solution



          if ((MyFirstCondition() || MySecondCondition()) && MyLastCondition()) ... 






          share|improve this answer








          New contributor



          Julian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          $endgroup$












          • $begingroup$
            I would love to use good names, but I just have no idea what to name things. Here's the reference document for the formulas, good luck with coming up with nice names: ngi.be/Common/Lambert2008/…
            $endgroup$
            – user1747281
            8 hours ago










          • $begingroup$
            What is a good name for mathematical functions and operands? I rather like f(a, b) then anyfunction(firstOperandOfAnyFunction, secondOperandOfAnyFunction)
            $endgroup$
            – dfhwze
            5 hours ago













          1












          1








          1





          $begingroup$

          I think it's a code smell to have more than one (infix) operator in one line.




          What would be the recommended way of doing this, both for readability and performance?




          Yes! But please use good names.



          For performance it doesn't matter. The C# compiler will probably inline those things so it's the same generated IL code



          Related:



          "Expressions should not be too complex"



          https://rules.sonarsource.com/csharp/RSPEC-1067?search=operator




          Noncompliant Code Example
          With the default threshold value of 3



          if (((condition1 && condition2) || (condition3 && condition4)) && condition5) ... 


          Compliant Solution



          if ((MyFirstCondition() || MySecondCondition()) && MyLastCondition()) ... 






          share|improve this answer








          New contributor



          Julian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          $endgroup$



          I think it's a code smell to have more than one (infix) operator in one line.




          What would be the recommended way of doing this, both for readability and performance?




          Yes! But please use good names.



          For performance it doesn't matter. The C# compiler will probably inline those things so it's the same generated IL code



          Related:



          "Expressions should not be too complex"



          https://rules.sonarsource.com/csharp/RSPEC-1067?search=operator




          Noncompliant Code Example
          With the default threshold value of 3



          if (((condition1 && condition2) || (condition3 && condition4)) && condition5) ... 


          Compliant Solution



          if ((MyFirstCondition() || MySecondCondition()) && MyLastCondition()) ... 







          share|improve this answer








          New contributor



          Julian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.








          share|improve this answer



          share|improve this answer






          New contributor



          Julian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.








          answered 8 hours ago









          JulianJulian

          1293 bronze badges




          1293 bronze badges




          New contributor



          Julian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.




          New contributor




          Julian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.













          • $begingroup$
            I would love to use good names, but I just have no idea what to name things. Here's the reference document for the formulas, good luck with coming up with nice names: ngi.be/Common/Lambert2008/…
            $endgroup$
            – user1747281
            8 hours ago










          • $begingroup$
            What is a good name for mathematical functions and operands? I rather like f(a, b) then anyfunction(firstOperandOfAnyFunction, secondOperandOfAnyFunction)
            $endgroup$
            – dfhwze
            5 hours ago
















          • $begingroup$
            I would love to use good names, but I just have no idea what to name things. Here's the reference document for the formulas, good luck with coming up with nice names: ngi.be/Common/Lambert2008/…
            $endgroup$
            – user1747281
            8 hours ago










          • $begingroup$
            What is a good name for mathematical functions and operands? I rather like f(a, b) then anyfunction(firstOperandOfAnyFunction, secondOperandOfAnyFunction)
            $endgroup$
            – dfhwze
            5 hours ago















          $begingroup$
          I would love to use good names, but I just have no idea what to name things. Here's the reference document for the formulas, good luck with coming up with nice names: ngi.be/Common/Lambert2008/…
          $endgroup$
          – user1747281
          8 hours ago




          $begingroup$
          I would love to use good names, but I just have no idea what to name things. Here's the reference document for the formulas, good luck with coming up with nice names: ngi.be/Common/Lambert2008/…
          $endgroup$
          – user1747281
          8 hours ago












          $begingroup$
          What is a good name for mathematical functions and operands? I rather like f(a, b) then anyfunction(firstOperandOfAnyFunction, secondOperandOfAnyFunction)
          $endgroup$
          – dfhwze
          5 hours ago




          $begingroup$
          What is a good name for mathematical functions and operands? I rather like f(a, b) then anyfunction(firstOperandOfAnyFunction, secondOperandOfAnyFunction)
          $endgroup$
          – dfhwze
          5 hours ago











          1












          $begingroup$

          • In math heavy code you might use the using static directive, see the microsoft documentation such that System.Math. can be removed throughout the code.


          • Excentricity can be made a constant and may have a shorter name as I have seen in other codes dealing with WGS84.

          • If possible refer to a document and formula number in a comment

          • Although sometime frowned on, I like to layout the the code as much as possible as the mathematical equation looks like. (use extra parentheses if it improves readability)

          With this in mind I came to to following example for method T.



          using static System.Math;

          public const double E2 = (2 * f) - (f * f); # Excentricity squared
          public const double E1 = Sqrt(E2); # Excentricity

          .....

          static double T(double lat)

          // if possible refer to a document and formula number
          return Tan(PI / 4 - lat / 2)
          /
          Pow( ((1 - E1 * Sin(lat))
          /
          (1 + E1 * Sin(lat))) , E1 / 2);






          share|improve this answer











          $endgroup$












          • $begingroup$
            Thanks, a lot for these hints. I'm deliberately not using "using System.Math" because this code is part of a game made with Unity3D. Typically, Unity programmers would use UnityEngine.Mathf, which is a wrapper class for System.Math using floats instead of doubles (because game engines like floats better). So to make it more obvious I explicitly prefix my math calls with System.Math (perhaps a bad practice, would be happy to have your opinion on this) Thanks for the excentricity tip, will definitely do that.
            $endgroup$
            – user1747281
            6 hours ago










          • $begingroup$
            You can add a using directive: using Math = System.Math
            $endgroup$
            – dfhwze
            5 hours ago










          • $begingroup$
            @user1747281 I am not familiar with Unity programmers conventions, but using static UnityEngine.Mathf might be acceptable, also when using Mathf the constants can be made floats instead of doubles.
            $endgroup$
            – Jan Kuiken
            5 hours ago







          • 1




            $begingroup$
            @user1747281 that this code is part of a game made with Unity3D should have been mentioned in the question so that reviewers have enough context how it is used.
            $endgroup$
            – t3chb0t
            5 hours ago










          • $begingroup$
            @t3chb0t done, thanks for pointing that out
            $endgroup$
            – user1747281
            4 hours ago















          1












          $begingroup$

          • In math heavy code you might use the using static directive, see the microsoft documentation such that System.Math. can be removed throughout the code.


          • Excentricity can be made a constant and may have a shorter name as I have seen in other codes dealing with WGS84.

          • If possible refer to a document and formula number in a comment

          • Although sometime frowned on, I like to layout the the code as much as possible as the mathematical equation looks like. (use extra parentheses if it improves readability)

          With this in mind I came to to following example for method T.



          using static System.Math;

          public const double E2 = (2 * f) - (f * f); # Excentricity squared
          public const double E1 = Sqrt(E2); # Excentricity

          .....

          static double T(double lat)

          // if possible refer to a document and formula number
          return Tan(PI / 4 - lat / 2)
          /
          Pow( ((1 - E1 * Sin(lat))
          /
          (1 + E1 * Sin(lat))) , E1 / 2);






          share|improve this answer











          $endgroup$












          • $begingroup$
            Thanks, a lot for these hints. I'm deliberately not using "using System.Math" because this code is part of a game made with Unity3D. Typically, Unity programmers would use UnityEngine.Mathf, which is a wrapper class for System.Math using floats instead of doubles (because game engines like floats better). So to make it more obvious I explicitly prefix my math calls with System.Math (perhaps a bad practice, would be happy to have your opinion on this) Thanks for the excentricity tip, will definitely do that.
            $endgroup$
            – user1747281
            6 hours ago










          • $begingroup$
            You can add a using directive: using Math = System.Math
            $endgroup$
            – dfhwze
            5 hours ago










          • $begingroup$
            @user1747281 I am not familiar with Unity programmers conventions, but using static UnityEngine.Mathf might be acceptable, also when using Mathf the constants can be made floats instead of doubles.
            $endgroup$
            – Jan Kuiken
            5 hours ago







          • 1




            $begingroup$
            @user1747281 that this code is part of a game made with Unity3D should have been mentioned in the question so that reviewers have enough context how it is used.
            $endgroup$
            – t3chb0t
            5 hours ago










          • $begingroup$
            @t3chb0t done, thanks for pointing that out
            $endgroup$
            – user1747281
            4 hours ago













          1












          1








          1





          $begingroup$

          • In math heavy code you might use the using static directive, see the microsoft documentation such that System.Math. can be removed throughout the code.


          • Excentricity can be made a constant and may have a shorter name as I have seen in other codes dealing with WGS84.

          • If possible refer to a document and formula number in a comment

          • Although sometime frowned on, I like to layout the the code as much as possible as the mathematical equation looks like. (use extra parentheses if it improves readability)

          With this in mind I came to to following example for method T.



          using static System.Math;

          public const double E2 = (2 * f) - (f * f); # Excentricity squared
          public const double E1 = Sqrt(E2); # Excentricity

          .....

          static double T(double lat)

          // if possible refer to a document and formula number
          return Tan(PI / 4 - lat / 2)
          /
          Pow( ((1 - E1 * Sin(lat))
          /
          (1 + E1 * Sin(lat))) , E1 / 2);






          share|improve this answer











          $endgroup$



          • In math heavy code you might use the using static directive, see the microsoft documentation such that System.Math. can be removed throughout the code.


          • Excentricity can be made a constant and may have a shorter name as I have seen in other codes dealing with WGS84.

          • If possible refer to a document and formula number in a comment

          • Although sometime frowned on, I like to layout the the code as much as possible as the mathematical equation looks like. (use extra parentheses if it improves readability)

          With this in mind I came to to following example for method T.



          using static System.Math;

          public const double E2 = (2 * f) - (f * f); # Excentricity squared
          public const double E1 = Sqrt(E2); # Excentricity

          .....

          static double T(double lat)

          // if possible refer to a document and formula number
          return Tan(PI / 4 - lat / 2)
          /
          Pow( ((1 - E1 * Sin(lat))
          /
          (1 + E1 * Sin(lat))) , E1 / 2);







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 4 hours ago

























          answered 6 hours ago









          Jan KuikenJan Kuiken

          8884 silver badges8 bronze badges




          8884 silver badges8 bronze badges











          • $begingroup$
            Thanks, a lot for these hints. I'm deliberately not using "using System.Math" because this code is part of a game made with Unity3D. Typically, Unity programmers would use UnityEngine.Mathf, which is a wrapper class for System.Math using floats instead of doubles (because game engines like floats better). So to make it more obvious I explicitly prefix my math calls with System.Math (perhaps a bad practice, would be happy to have your opinion on this) Thanks for the excentricity tip, will definitely do that.
            $endgroup$
            – user1747281
            6 hours ago










          • $begingroup$
            You can add a using directive: using Math = System.Math
            $endgroup$
            – dfhwze
            5 hours ago










          • $begingroup$
            @user1747281 I am not familiar with Unity programmers conventions, but using static UnityEngine.Mathf might be acceptable, also when using Mathf the constants can be made floats instead of doubles.
            $endgroup$
            – Jan Kuiken
            5 hours ago







          • 1




            $begingroup$
            @user1747281 that this code is part of a game made with Unity3D should have been mentioned in the question so that reviewers have enough context how it is used.
            $endgroup$
            – t3chb0t
            5 hours ago










          • $begingroup$
            @t3chb0t done, thanks for pointing that out
            $endgroup$
            – user1747281
            4 hours ago
















          • $begingroup$
            Thanks, a lot for these hints. I'm deliberately not using "using System.Math" because this code is part of a game made with Unity3D. Typically, Unity programmers would use UnityEngine.Mathf, which is a wrapper class for System.Math using floats instead of doubles (because game engines like floats better). So to make it more obvious I explicitly prefix my math calls with System.Math (perhaps a bad practice, would be happy to have your opinion on this) Thanks for the excentricity tip, will definitely do that.
            $endgroup$
            – user1747281
            6 hours ago










          • $begingroup$
            You can add a using directive: using Math = System.Math
            $endgroup$
            – dfhwze
            5 hours ago










          • $begingroup$
            @user1747281 I am not familiar with Unity programmers conventions, but using static UnityEngine.Mathf might be acceptable, also when using Mathf the constants can be made floats instead of doubles.
            $endgroup$
            – Jan Kuiken
            5 hours ago







          • 1




            $begingroup$
            @user1747281 that this code is part of a game made with Unity3D should have been mentioned in the question so that reviewers have enough context how it is used.
            $endgroup$
            – t3chb0t
            5 hours ago










          • $begingroup$
            @t3chb0t done, thanks for pointing that out
            $endgroup$
            – user1747281
            4 hours ago















          $begingroup$
          Thanks, a lot for these hints. I'm deliberately not using "using System.Math" because this code is part of a game made with Unity3D. Typically, Unity programmers would use UnityEngine.Mathf, which is a wrapper class for System.Math using floats instead of doubles (because game engines like floats better). So to make it more obvious I explicitly prefix my math calls with System.Math (perhaps a bad practice, would be happy to have your opinion on this) Thanks for the excentricity tip, will definitely do that.
          $endgroup$
          – user1747281
          6 hours ago




          $begingroup$
          Thanks, a lot for these hints. I'm deliberately not using "using System.Math" because this code is part of a game made with Unity3D. Typically, Unity programmers would use UnityEngine.Mathf, which is a wrapper class for System.Math using floats instead of doubles (because game engines like floats better). So to make it more obvious I explicitly prefix my math calls with System.Math (perhaps a bad practice, would be happy to have your opinion on this) Thanks for the excentricity tip, will definitely do that.
          $endgroup$
          – user1747281
          6 hours ago












          $begingroup$
          You can add a using directive: using Math = System.Math
          $endgroup$
          – dfhwze
          5 hours ago




          $begingroup$
          You can add a using directive: using Math = System.Math
          $endgroup$
          – dfhwze
          5 hours ago












          $begingroup$
          @user1747281 I am not familiar with Unity programmers conventions, but using static UnityEngine.Mathf might be acceptable, also when using Mathf the constants can be made floats instead of doubles.
          $endgroup$
          – Jan Kuiken
          5 hours ago





          $begingroup$
          @user1747281 I am not familiar with Unity programmers conventions, but using static UnityEngine.Mathf might be acceptable, also when using Mathf the constants can be made floats instead of doubles.
          $endgroup$
          – Jan Kuiken
          5 hours ago





          1




          1




          $begingroup$
          @user1747281 that this code is part of a game made with Unity3D should have been mentioned in the question so that reviewers have enough context how it is used.
          $endgroup$
          – t3chb0t
          5 hours ago




          $begingroup$
          @user1747281 that this code is part of a game made with Unity3D should have been mentioned in the question so that reviewers have enough context how it is used.
          $endgroup$
          – t3chb0t
          5 hours ago












          $begingroup$
          @t3chb0t done, thanks for pointing that out
          $endgroup$
          – user1747281
          4 hours ago




          $begingroup$
          @t3chb0t done, thanks for pointing that out
          $endgroup$
          – user1747281
          4 hours ago











          1












          $begingroup$

          Naming Conventions



          Some, but not all of your variables and functions are named after mathematical usage. I like it either way, but a combination is an inconsistent naming convention.




          public const double f = 1 / 298.257222101;
          public const double lowerLatitude = 49.8333333 * Mathf.Deg2Rad;



          Constants



          You have a lot of mathematical constants that aren't constants in your API. Why?




          Excentricity, MLower, MUpper, TLower, TUpper, TOrigin, ROrigin, N, G.



          Aliases



          You are using both System.Math and UnityEngine.Mathf. To avoid repeating code I suggest to import the one you used most as a static using and the other as an aliased using.



          using static UnityEngine.Mathf;
          using Math = System.Math;





          share|improve this answer









          $endgroup$












          • $begingroup$
            Naming conventions: I didn't know you could use mathematical symbols in names, so instead of naming the variable "phi1", "phi2" etc... I opted for a purposeful name. But I now know better thanks to this community :-) Constants: I don't understand what you mean. They're not constants, they're derived from constants. I tried this: public const double Excentricity = System.Math.Sqrt((2 * f) - (f * f)); but the compiler doesn't accept it because Sqrt((2 * f)-(f*f)) is not a constant. Aliases: I like that idea, thanks for the tip
            $endgroup$
            – user1747281
            2 hours ago















          1












          $begingroup$

          Naming Conventions



          Some, but not all of your variables and functions are named after mathematical usage. I like it either way, but a combination is an inconsistent naming convention.




          public const double f = 1 / 298.257222101;
          public const double lowerLatitude = 49.8333333 * Mathf.Deg2Rad;



          Constants



          You have a lot of mathematical constants that aren't constants in your API. Why?




          Excentricity, MLower, MUpper, TLower, TUpper, TOrigin, ROrigin, N, G.



          Aliases



          You are using both System.Math and UnityEngine.Mathf. To avoid repeating code I suggest to import the one you used most as a static using and the other as an aliased using.



          using static UnityEngine.Mathf;
          using Math = System.Math;





          share|improve this answer









          $endgroup$












          • $begingroup$
            Naming conventions: I didn't know you could use mathematical symbols in names, so instead of naming the variable "phi1", "phi2" etc... I opted for a purposeful name. But I now know better thanks to this community :-) Constants: I don't understand what you mean. They're not constants, they're derived from constants. I tried this: public const double Excentricity = System.Math.Sqrt((2 * f) - (f * f)); but the compiler doesn't accept it because Sqrt((2 * f)-(f*f)) is not a constant. Aliases: I like that idea, thanks for the tip
            $endgroup$
            – user1747281
            2 hours ago













          1












          1








          1





          $begingroup$

          Naming Conventions



          Some, but not all of your variables and functions are named after mathematical usage. I like it either way, but a combination is an inconsistent naming convention.




          public const double f = 1 / 298.257222101;
          public const double lowerLatitude = 49.8333333 * Mathf.Deg2Rad;



          Constants



          You have a lot of mathematical constants that aren't constants in your API. Why?




          Excentricity, MLower, MUpper, TLower, TUpper, TOrigin, ROrigin, N, G.



          Aliases



          You are using both System.Math and UnityEngine.Mathf. To avoid repeating code I suggest to import the one you used most as a static using and the other as an aliased using.



          using static UnityEngine.Mathf;
          using Math = System.Math;





          share|improve this answer









          $endgroup$



          Naming Conventions



          Some, but not all of your variables and functions are named after mathematical usage. I like it either way, but a combination is an inconsistent naming convention.




          public const double f = 1 / 298.257222101;
          public const double lowerLatitude = 49.8333333 * Mathf.Deg2Rad;



          Constants



          You have a lot of mathematical constants that aren't constants in your API. Why?




          Excentricity, MLower, MUpper, TLower, TUpper, TOrigin, ROrigin, N, G.



          Aliases



          You are using both System.Math and UnityEngine.Mathf. To avoid repeating code I suggest to import the one you used most as a static using and the other as an aliased using.



          using static UnityEngine.Mathf;
          using Math = System.Math;






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 4 hours ago









          dfhwzedfhwze

          3,6161 gold badge6 silver badges32 bronze badges




          3,6161 gold badge6 silver badges32 bronze badges











          • $begingroup$
            Naming conventions: I didn't know you could use mathematical symbols in names, so instead of naming the variable "phi1", "phi2" etc... I opted for a purposeful name. But I now know better thanks to this community :-) Constants: I don't understand what you mean. They're not constants, they're derived from constants. I tried this: public const double Excentricity = System.Math.Sqrt((2 * f) - (f * f)); but the compiler doesn't accept it because Sqrt((2 * f)-(f*f)) is not a constant. Aliases: I like that idea, thanks for the tip
            $endgroup$
            – user1747281
            2 hours ago
















          • $begingroup$
            Naming conventions: I didn't know you could use mathematical symbols in names, so instead of naming the variable "phi1", "phi2" etc... I opted for a purposeful name. But I now know better thanks to this community :-) Constants: I don't understand what you mean. They're not constants, they're derived from constants. I tried this: public const double Excentricity = System.Math.Sqrt((2 * f) - (f * f)); but the compiler doesn't accept it because Sqrt((2 * f)-(f*f)) is not a constant. Aliases: I like that idea, thanks for the tip
            $endgroup$
            – user1747281
            2 hours ago















          $begingroup$
          Naming conventions: I didn't know you could use mathematical symbols in names, so instead of naming the variable "phi1", "phi2" etc... I opted for a purposeful name. But I now know better thanks to this community :-) Constants: I don't understand what you mean. They're not constants, they're derived from constants. I tried this: public const double Excentricity = System.Math.Sqrt((2 * f) - (f * f)); but the compiler doesn't accept it because Sqrt((2 * f)-(f*f)) is not a constant. Aliases: I like that idea, thanks for the tip
          $endgroup$
          – user1747281
          2 hours ago




          $begingroup$
          Naming conventions: I didn't know you could use mathematical symbols in names, so instead of naming the variable "phi1", "phi2" etc... I opted for a purposeful name. But I now know better thanks to this community :-) Constants: I don't understand what you mean. They're not constants, they're derived from constants. I tried this: public const double Excentricity = System.Math.Sqrt((2 * f) - (f * f)); but the compiler doesn't accept it because Sqrt((2 * f)-(f*f)) is not a constant. Aliases: I like that idea, thanks for the tip
          $endgroup$
          – user1747281
          2 hours ago










          user1747281 is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          user1747281 is a new contributor. Be nice, and check out our Code of Conduct.












          user1747281 is a new contributor. Be nice, and check out our Code of Conduct.











          user1747281 is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f222988%2fconverting-geographic-coordinates-into-lambert2008-coordinates%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

          Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

          François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480