I have developed an air navigation program with XoJo. I am almost at the end of the program and I would not like to give up right now for a nonsense to which I cannot find a solution.
The question I am about to ask you is not inherent to XoJo: it is about the representation of a rotated line in the Leaflet map.
As you can see in the figure, there are two red lines C-> P1 and C-> P2 and there are blue lines C-> A, C-> B, …, C-> E.
The red line C-> P1 is the starting line, the C-P2 line is the finish line. They are input data.
The blue lines are lines I calculated with the following mathematical formula:
// Data input Cx = 10.247500 '=> C Cy = 43.557778 '=> C Ax = 10.395555 '=> P1x Ay = 43.838056 '=> P1y Bx = 10.64953 '=> P2x By = 43.62996 '=> P3y // Calculate the angle of C-> P2 with the axis Var z, w, Angle As Double w = ((Ax-Cx) * (Bx-Cx)) + ((Ay-Cy) * (By-Cy)) z = Sqrt (((Ax-Cx) ^ 2) + ((Ay-Cy) ^ 2)) * Sqrt (((Bx-Cx) ^ 2) + ((By-Cy) ^ 2)) Angle = (ACos (w / z)) * 180 / Pi Var iStepRotazione As UInteger = 10 'Let's start with 10° of rotation Var xPoint, yPoint As Double While iStepRotation <Angle xPoint = (Ax-Cx) * Cos (iStepRotazione * Pi / 180) + (Ay-Cy) * Sin (iStepRotazione * Pi / 180) + Cx yPoint = - (Ax-Cx) * Sin (iStepRotation * Pi / 180) + (Ay-Cy) * Cos (iStepRotation * Pi / 180) + Cy iStepRotazione = iStepRotazione + 10 'Step of 10 ° sReturn = sReturn + Str (yPoint) + "," + Str (xPoint) + ";" Wend
That is, I take point P1 and rotate it by 10 ° until reaching P2.
With the calculated points, I create the lines (in Leaflet) C->A, C->B, etc …
As you can see in the figure, the rotated points (A, B, …, F) form smaller lines (the blue lines).
I’m not a great mathematician but I believe the function is correct.
Having said that, do you think it is a mathematical problem or a Web-Mercator problem?
Do you know anything about it?