Question

AzimuthCalculator

  • 10 December 2015
  • 2 replies
  • 2 views

Badge +22
  • Contributor
  • 1959 replies

The AzimuthCalculator custom transformer uses 6 transformers to calculate the angle (acos((&acX2-;&acX1;)/sqrt(pow((&acY2-;&acY1;),2) + pow((&acX2-;&acX1;),2)))* (180/3.1415926535897932), and normalize it, and then tests which quadrant it's in and so as to calculate the azimuth as either 90-angle or 450-angle.

Is there any reason not to simply use 90-@radToDeg(@atan2(@Value(_!y1)-@Value(_!y0),@Value(_!x1)-@Value(_!x0)))?


2 replies

Userlevel 2
Badge +12

@jdh I tried this and it appears to do exactly what needs to be calculated.

Badge +2

The file history here says it originally dates back to 2005. I don't remember offhand whether syntax as complex as your second one was actually possible back then, but even if it was, I suspect it was a lot easier to use separate transformers!

If your calculation works, I'd stick with that instead!

Reply