Scoring
Calculating Flight Distances
When calculating the distance covered during a flight, it's not sufficient to simply sum up the distances between each GPS point on the track. In some cases, this could result in flights of several tens of kilometers where the pilot has only made return trips along a cliff face.
Initial Approach
The first approach is to measure the distance between the two most distant points on the track, which are referred to as the Start marker (DB fr) and End marker (AB fr). By taking inspiration from glider flight evaluation methods, several types of circuits have been defined to achieve the greatest possible distance. These different circuits may vary depending on the specific competition rules being used.
This is why Logfly's scoring function offers multiple cotation options: FFVL, XContest, FAI, and XCLeague. Depending on the chosen option, there may be slight variations in the calculation results.
Maximizing Distance
To maximize the distance between the two most distant points, it's possible to assume two or three turning points. This is referred to as free distance.

A flight can be considered a triangle when the distance between the departure and arrival points is less than a certain criterion. For FFVL, this means less than 3 km between the DB and AB. For XContest, this distance must be less than 20% of the total distance given by the three turning points. A triangle benefits from a higher scoring coefficient than a free distance.

A triangle can receive an even higher scoring coefficient if it meets the criteria of the Fédération Aéronautique Internationale (FAI). The shortest side of the triangle must represent at least 28% of the total triangle.

Igc-XC-Score
Calculating flight distances requires complex calculations. Fortunately, brilliant developers have taken an interest in this problem. Logfly uses the Igc-XC-Score module written by Momtchil Momtchev. We would like to thank him for his outstanding work, which is made available on a GitHub repository.
GitHub Repository
The Igc-XC-Score GitHub page where Momtchil Momtchev presents the complexity of the problem and the solutions adopted