There are many methods that make circuit calculations possible. However, these methods were mainly used on servers with large computing capacity. So it was a real challenge for our application, to be able to have a method that can do these calculations locally and on most of our Android tablets and smartphones. The challenge is twofold! Since not only are the computing capabilities limited, but they can also vary greatly from one device to another.

First of all, there are three different types of circuits:

the

**3 turn points distance**,

the

**out and return**,

and the

**FAI triangle**:

Those are the ones who were selected to identify the flights. In practice, there are variations around these 3 forms, characterized by the rules that relate to each of them, but without fundamental change. An example is the flat triangle. In order to determine the circuit that best applies to your flight, a coefficient is applied to each, taken from the specificities of each league. Thus, your FAI triangle will not be considered for a 3 turn points distance. Well, under certain conditions!

These conditions are set by the

**FAI regulations**. Indeed, if a reference needs to be applied, let it be the international one. Thus, to complete a FAI triangle or an out-and-return, it is necessary to go back to the starting point (which may be different from the take-off), which can take the form of either a cylinder of 400 meters radius, or a FAI sector. And the table below gives you the coefficients used for each circuit:

On the process side, the algorithm makes its analysis by taking all the points of the tracklog up to a ceiling, from which the number of points taken into account for the calculation is reduced. A recursive method then makes it possible to find the best circuit, and the distance attached to it.

Recursion is a programming technique that allows our algorithm to consider the tracklog at different zoom levels. Thanks to this property, he can quickly focus on the most interesting areas to position the different legs of a circuit. Doing so, it avoids a bunch of unnecessary calculations in areas where it is unnecessary to draw the legs. If it were up to us to do this work, he would do it in the same way so as not to drown in the details of the drawing. The diagram below illustrates the leg calculation method for a 3 turn point distance. The magnifiers are positioned at different points in the tracklog where the algorithm will test the positioning of the legs more precisely. Inside each of these magnifiers other ones will be generated. And so on, until finding the best distance for the circuit. The blue dotted lines show different circuit possibilities inside the magnifiers.

We wanted to propose the most accurate results possible, without spending too much time in calculations, depending on the capabilities of each equipment. A combination not always easy to adjust, but that satisfies the best pilots at the moment. What experience do you get from using this method through the application? Share your ideas and wishes with us!

Some will be implemented in the next update with the introduction of the closing circuit's radius setting, according to your choice. It will also soon be possible to choose the flat triangle instead of the out-and-return distance. The idea is that, in the end, this circuit fits your wishes best, as well as the statistics and charts that depend on it in XC Analytics!