<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    I find that push, pop, exch are not super intuitive. For the sake of
    brainstorming, here are my thoughts... I'm not totally convinced
    they are good as they are kind of exceptions to the way pipelines
    operate in the reverse direction (which isn't totally obvious
    either)<br>
    <p>So basically we would have 2 new operations:</p>
    <p>* +proj=save +only_fwd|+only_inv +into=some_name  : save the
      current coordinate as "some_name", but only do that in the
      specified direction. That is, it is a no-op in the other
      direction. +omit_fwd/+omit_inv are obviously not allowed on such
      an operation<br>
    </p>
    <p>* +proj=restore +only_fwd|+only_inv +from=some_name [+v_1] [+v_2]
      [+v_3] [+v_4]: restore "some_name" as the current coordinate, only
      in the specified direction. One must explicitly specify at least
      one +v_X. no-op in the other direction. +omit_fwd/+omit_inv are
      not allowed on such an operation</p>
    <p>You can interleave save and restore in any order, provided that
      you restore an already saved name...</p>
    <p><br>
    </p>
    So Jochem's pipeline would become (if I've understood well):<br>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">cct
        +proj=pipeline
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=save +only_fwd +into=orthometric_height</span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=restore +only_inv  </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"> +v_3
      </span><span style="font-size:9.0pt;font-family:Consolas"
        lang="EN-GB">+from=orthometric_height<br>
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=tmerc +inv +lat_0=12.180658675 +lon_0=-68.251802281 +k_0=1
        +x_0=23209.5600 +y_0=21423.9900 +ellps=intl
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=cart +ellps=intl
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=helmert +x=-366.1939 +y=-115.0688 +z=-776.7039
        +rx=20.963080 +ry=16.462749 +rz=-14.276379 +s=-12.80900
        +convention=coordinate_frame +exact
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=cart +inv +ellps=GRS80
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=restore +only_fwd </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+v_3 </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+from=orthometric_height
        <br>
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=restore +only_inv </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+v_3 </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+from=ellipsoidal_height
        <br>
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=save +only_inv +into=orthometric_height <br>
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=vgridshift +grids=egm2008_0_45.tif +inv
      </span></p>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=save +only_inv +into=ellipsoidal_height</span></p>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"><br>
      </span></p>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"></span>In
      the forward direction, it would be interpreted as (omitting all
      +only=inv steps):</p>
    <p><br>
    </p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">cct
        +proj=pipeline
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=save +only_fwd +into=orthometric_height</span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=tmerc +inv +lat_0=12.180658675 +lon_0=-68.251802281 +k_0=1
        +x_0=23209.5600 +y_0=21423.9900 +ellps=intl
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=cart +ellps=intl
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=helmert +x=-366.1939 +y=-115.0688 +z=-776.7039
        +rx=20.963080 +ry=16.462749 +rz=-14.276379 +s=-12.80900
        +convention=coordinate_frame +exact
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=cart +inv +ellps=GRS80
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=restore +only_fwd </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+v_3</span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">
        +from=orthometric_height <br>
      </span></p>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=vgridshift +grids=egm2008_0_45.tif +inv<br>
      </span></p>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"><br>
      </span></p>
    <p>And for the reverse direction, it would be interpreted as the
      following (that is when taking with a forward direction
      perspective), by reversing the order of steps, reversing the
      direction of each step (except the ones tagged with
      +only_fwd/+only_inv), omitting all +only_fwd steps, and renaming
      the +only_inv ones as +only_fwd :</p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">cct
        +proj=pipeline <br>
      </span></p>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=save +only_fwd +into=ellipsoidal_height</span></p>
    <span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
      +proj=vgridshift +grids=egm2008_0_45.tif 
    </span>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=save +only_fwd +into=orthometric_height <br>
      </span></p>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=restore +only_fwd </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+v_3 </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+from=ellipsoidal_height
        <br>
      </span></p>
    <span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"></span>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=cart +ellps=GRS80
      </span></p>
    <span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"></span><span
      style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step </span><span
      style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"> +inv  </span><span
      style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+proj=helmert
      +x=-366.1939 +y=-115.0688 +z=-776.7039 +rx=20.963080 +ry=16.462749
      +rz=-14.276379 +s=-12.80900 +convention=coordinate_frame +exact </span>
    <span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"></span>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
      </span><span style="font-size:9.0pt;font-family:Consolas"
        lang="EN-GB"> +inv </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+proj=cart
        +ellps=intl
      </span></p>
    <span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
      +proj=tmerc +lat_0=12.180658675 +lon_0=-68.251802281 +k_0=1
      +x_0=23209.5600 +y_0=21423.9900 +ellps=intl
    </span><br>
    <p></p>
    <span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
      +proj=restore +only_fwd </span><span
      style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+v_3</span><span
      style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">
      +from=orthometric_height <br>
    </span><br>
    <p>
    </p>
    <div class="moz-cite-prefix">I guess we could potentially use the
      +omit_fwd/+omit_inv logic, with its logic of inverting the
      semantics when reading in the reverse directions, but my brain is
      hurting hard when I'm tring to comprehend that (1).<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <br>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Hence this proposal of
      +only_fwd/+only_inv. Which is probably what we should have come up
      with originally instead of +omit_fwd/+omit_inv</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">I guess we could generalize
      +only_fwd/+only_inv to all operations, with the semantic detailed
      above, that is they are interpreted as written in the direction
      where they should be applied, without a reversal of their
      direction.<br>
    </div>
    <p><br>
    </p>
    <p>Actually... At the expense of being super verbose, but hopefully
      super straightforward, why not having "+proj=if +dir=fwd"  ,
      "+proj=elseif dir=inv" and "+proj=endif", eliminating all
      convoluted uses of +omit_fwd/inv (and/or +only_fwd/inv), and the
      mental process of inferring the inverse pipeline by reversing the
      order of the steps and their direction:<br>
    </p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">cct
        +proj=pipeline<br>
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=if +dir=fwd </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"></span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">    
        +step +proj=save +into=orthometric_height</span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">    
        +step +proj=tmerc +inv +lat_0=12.180658675 +lon_0=-68.251802281
        +k_0=1 +x_0=23209.5600 +y_0=21423.9900 +ellps=intl
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">     </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=cart +ellps=intl
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">     </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=helmert +x=-366.1939 +y=-115.0688 +z=-776.7039
        +rx=20.963080 +ry=16.462749 +rz=-14.276379 +s=-12.80900
        +convention=coordinate_frame +exact
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">     </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=cart +inv +ellps=GRS80
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">     </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=restore </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+v_3</span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">
        +from=orthometric_height <br>
      </span></p>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">    
      </span><span style="font-size:9.0pt;font-family:Consolas"
        lang="EN-GB">+step +proj=vgridshift +grids=egm2008_0_45.tif +inv</span></p>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=elseif +dir=inv</span>
    </p>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">    
      </span><span style="font-size:9.0pt;font-family:Consolas"
        lang="EN-GB">+step +proj=save +into=ellipsoidal_height</span></p>
    <span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">    
    </span><span style="font-size:9.0pt;font-family:Consolas"
      lang="EN-GB">+step +proj=vgridshift +grids=egm2008_0_45.tif 
    </span>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">    
      </span><span style="font-size:9.0pt;font-family:Consolas"
        lang="EN-GB">+step +proj=save  +into=orthometric_height <br>
      </span></p>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">
      </span></p>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">     </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=restore </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+v_3 </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+from=ellipsoidal_height
        <br>
      </span></p>
    <span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"></span>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">     </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
        +proj=cart +ellps=GRS80 </span></p>
    <span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"></span><span
      style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">     </span><span
      style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step </span><span
      style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+proj=helmert
    </span><span style="font-size:9.0pt;font-family:Consolas"
      lang="EN-GB">+inv </span><span
      style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+x=-366.1939
      +y=-115.0688 +z=-776.7039 +rx=20.963080 +ry=16.462749
      +rz=-14.276379 +s=-12.80900 +convention=coordinate_frame +exact </span>
    <span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"></span>
    <p class="MsoNormal"><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">     </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
      </span><span style="font-size:9.0pt;font-family:Consolas"
        lang="EN-GB">+proj=cart </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"> </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB"> +inv
      </span><span style="font-size:9.0pt;font-family:Consolas"
        lang="EN-GB"> +ellps=intl
      </span></p>
    <span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">    
    </span><span style="font-size:9.0pt;font-family:Consolas"
      lang="EN-GB">+step +proj=tmerc +lat_0=12.180658675
      +lon_0=-68.251802281 +k_0=1 +x_0=23209.5600 +y_0=21423.9900
      +ellps=intl
    </span><br>
    <p></p>
    <p><span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">    
      </span><span style="font-size:9.0pt;font-family:Consolas"
        lang="EN-GB">+step +proj=restore </span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+v_3</span><span
        style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">
        +from=orthometric_height <br>
      </span></p>
    <span style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
      +proj=endif </span><span
      style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">     </span>
    <p><br>
    </p>
    <p>if / elseif would be strictly restricted to this exact construct,
      but could potentially be later extended to doing other things. I'm
      quite happy with that last proposal actually</p>
    <p>And syntaxic sugar, I guess we coud tweak the PROJ string parser,
      to just understand +proj=XXX  as +step +proj=XXXX (would require
      +inv to be placed after +proj). And actually rename +proj as +op
      (from a quick check, it doesn't seem it is a valid parameter of an
      operation)<br>
    </p>
    <p>So here's my final proposal for today:<br>
    </p>
    <p>cct +op=pipeline<br>
      +op=if +dir=fwd<br>
           +op=save +into=orthometric_height<br>
           +op=tmerc +inv +lat_0=12.180658675 +lon_0=-68.251802281
      +k_0=1 +x_0=23209.5600 +y_0=21423.9900 +ellps=intl<br>
           +op=cart +ellps=intl<br>
           +op=helmert +x=-366.1939 +y=-115.0688 +z=-776.7039
      +rx=20.963080 +ry=16.462749 +rz=-14.276379 +s=-12.80900
      +convention=coordinate_frame +exact<br>
           +op=cart +inv +ellps=GRS80<br>
           +op=restore +v_3 +from=orthometric_height <br>
           +op=vgridshift +grids=egm2008_0_45.tif +inv<br>
      +op=elseif +dir=inv<br>
           +op=save +into=ellipsoidal_height<br>
           +op=vgridshift +grids=egm2008_0_45.tif <br>
           +op=save  +into=orthometric_height<br>
           +op=restore +v_3 +from=ellipsoidal_height <br>
           +op=cart +ellps=GRS80<br>
           +op=helmert +inv +x=-366.1939 +y=-115.0688 +z=-776.7039
      +rx=20.963080 +ry=16.462749 +rz=-14.276379 +s=-12.80900
      +convention=coordinate_frame +exact<br>
           +op=cart  +inv +ellps=intl<br>
           +op=tmerc +lat_0=12.180658675 +lon_0=-68.251802281 +k_0=1
      +x_0=23209.5600 +y_0=21423.9900 +ellps=intl<br>
           +op=restore +v_3 +from=orthometric_height <br>
      +op=endif<br>
    </p>
    Even<br>
    <p><br>
    </p>
    <p>(1) It would look as:
    </p>
    <div class="moz-cite-prefix">
      <div class="moz-cite-prefix">
        <p class="MsoNormal"><span
            style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">cct
            +proj=pipeline
          </span></p>
        <p class="MsoNormal"><span
            style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
            +proj=save +name=orthometric_height +omit_inv<br>
          </span></p>
        <p class="MsoNormal"><span
            style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
            +proj=save +name=orthometric_height +v_3 +omit_fwd<br>
          </span></p>
        <p class="MsoNormal"><span
            style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
            +proj=tmerc +inv +lat_0=12.180658675 +lon_0=-68.251802281
            +k_0=1 +x_0=23209.5600 +y_0=21423.9900 +ellps=intl
          </span></p>
        <p class="MsoNormal"><span
            style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
            +proj=cart +ellps=intl
          </span></p>
        <p class="MsoNormal"><span
            style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
            +proj=helmert +x=-366.1939 +y=-115.0688 +z=-776.7039
            +rx=20.963080 +ry=16.462749 +rz=-14.276379 +s=-12.80900
            +convention=coordinate_frame +exact
          </span></p>
        <p class="MsoNormal"><span
            style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
            +proj=cart +inv +ellps=GRS80
          </span></p>
        <p class="MsoNormal"><span
            style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
            +proj=restore +name=orthometric_height +v_3 +omit_inv<br>
          </span></p>
        <p class="MsoNormal"><span
            style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
            +proj=save  +name=ellipsoidal_height +v_3 +omit_fwd<br>
          </span></p>
        <p class="MsoNormal"><span
            style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
            +proj=restore +name=orthometric_height  +omit_fwd<br>
          </span></p>
        <p class="MsoNormal"><span
            style="font-size:9.0pt;font-family:Consolas" lang="EN-GB">+step
            +proj=vgridshift +grids=egm2008_0_45.tif +inv
          </span></p>
        <p><span style="font-size:9.0pt;font-family:Consolas"
            lang="EN-GB">+step +proj=restore  +name=ellipsoidal_height
            +omit_fwd<br>
          </span></p>
      </div>
      <div class="moz-cite-prefix"><br>
      </div>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Le 16/12/2023 à 17:42, Thomas Knudsen
      via PROJ a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAH0YoENC7m=MSf=H4+yaLTrhjRf-M42XFAxN9cergPG4_9Z3fQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div class="gmail_quote">
          <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Greg
            Troxel said:<br>
            > We are really re-inventing the traditional HP RPN, and<br>
            > that's ok, but it's better to re-implement it as<br>
            > consistently as possible.<br>
            <br>
            Actually Chuck Moore implemented Forth already in 1968,<br>
            four years before HP-35, the first HP RPN calculator,<br>
            was introduced. So in that sense "swap" is historically<br>
            more consistent than the 1984 PostScript "exch".<br>
            <br>
            My trusty old HP-15, now doing attic service, had a
            "x<>y"<br>
            key for "swap", and I see on the Wikipedia photo [1],<br>
            that that "x<>y" was used all the way back to the 1972
            HP-35.<br>
            <br>
            The HP-48G, introduced in 1990, according to the photo [2]<br>
            had a key labelled "swap", so HP RPN appears to be more<br>
            true to Forth, than to PostScript.<br>
            <br>
            So for HP, as well as Forth, consistency, "swap" would be<br>
            preferable.<br>
            <br>
            The bad thing, however, is that PROJ stacks do not work as<br>
            one would immediately expect: Actually, there are 4 separate<br>
            stacks, one for each coordinate, so doing a "push v_1 v_2"<br>
            followed by a "pop v_2 v_1" does not do any swapping (sse
            the<br>
            example in footnote [4], and try to play with different
            orders<br>
            of v_1 and v_2).<br>
            <br>
            Hence, you need to do a preparatory axisswap step to
            actually<br>
            put the first coordinate onto the second coordinate stack
            (from<br>
            where it can be pop'd back into the first coordinate of the<br>
            operand). I tend to forget this...<br>
            <br>
            Rust Geodesy [4] makes do with one stack, but for
            semi-consistency<br>
            with PROJ, always pushes and pops in fixed order, i.e. pop
            v_2 v_1<br>
            gives the same result as pop v_1 v_2<br>
            <br>
            In order to follow the principle of least astonishment
            (POLA) [5],<br>
            I would have preferred a single stack, and push/pop in
            consistent<br>
            order. But since the state of things are as they are,
            keeping POLA<br>
            will probably require us to keep things as is.<br>
            <br>
            <br>
            [1] <a
href="https://en.wikipedia.org/wiki/HP-35#/media/File:HP-35_Red_Dot.jpg"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://en.wikipedia.org/wiki/HP-35#/media/File:HP-35_Red_Dot.jpg</a><br>
            [2] <a
href="https://upload.wikimedia.org/wikipedia/commons/9/95/HP48G.jpg"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://upload.wikimedia.org/wikipedia/commons/9/95/HP48G.jpg</a><br>
            [3] echo 1 2 3 4 | cct proj=pipeline step proj=push v_1 v_2
            step proj=pop v_2 step proj=pop v_1  --<br>
            [4] <a href="https://github.com/busstoptaktik/geodesy"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/busstoptaktik/geodesy</a><br>
            [5] <a
href="https://en.wikipedia.org/wiki/Principle_of_least_astonishment"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://en.wikipedia.org/wiki/Principle_of_least_astonishment</a><br>
          </blockquote>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
PROJ mailing list
<a class="moz-txt-link-abbreviated" href="mailto:PROJ@lists.osgeo.org">PROJ@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/proj">https://lists.osgeo.org/mailman/listinfo/proj</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>