title: Shift Geo Point with Pitagora's theorem
body: <p>I have two geo point with WGS84 and a line that links these two points.
  I need to split this line in two chunks shifting the middle point to build an half rhombus.</p>
  
  <p>What I have:</p>
  
  <ul>
  <li>A coords (ex. 47.2270293988673, 4.06494140625); </li>
  <li>B coords; </li>
  <li>len of the shift; </li>
  <li>D coords;</li>
  </ul>
  
  <p>What I need:</p>
  
  <ul>
  <li>C coords;</li>
  </ul>
  
  <p>To calc D coords, im using:</p>
  
  <pre><code>calcMidPoint(position01, position02)
      {
          var lat1 = position01[1];
          var lon1 = position01[0];
          var lat2 = position02[1];
          var lon2 = position02[0];
  
          var dLon = this.toRad(lon2 - lon1);
  
          //convert to radians
          lat1 = this.toRad(lat1);
          lat2 = this.toRad(lat2);
          lon1 = this.toRad(lon1);
  
          var Bx = Math.cos(lat2) * Math.cos(dLon);
          var By = Math.cos(lat2) * Math.sin(dLon);
          var lat3 = Math.atan2(Math.sin(lat1) + Math.sin(lat2), Math.sqrt((Math.cos(lat1) + Bx) * (Math.cos(lat1) + Bx) + By * By));
          var lon3 = lon1 + Math.atan2(By, Math.cos(lat1) + Bx);
          return [ this.toDegrees(lat3), this.toDegrees(lon3) ];
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/gaWkA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gaWkA.png" alt="enter image description here"></a></p>