Computational Geometry of Ski Run Turns, Part 2
As noted in the first part of this two part series, the Ski+ app features a unique ability to count the number of turns you take on a ski run, as well as calculate keys statistics of the turns including average turn radius, and average turn G-Force. After each turn is detected using the technique described in part one, the next step is again apply computational geometry to calculate the turn radius, and the G-Force of the skier for each turn.
Austrian-American mathematician Karl Menger derived the equation for calculating the radius of any curve passing through three points - a start point, a mid point, and an end point. Given a stream of GPS data points it’s quite simple to get the points immediately adjacent to the turn point to calculate the turn radius. The first step is to create a triangle between the three points P1, P2, and P3. P2 is the turn point. Next, you calculate the lengths, or distance for each edge of the triangle A, B, and C.
This algorithm requires that A ≥ B ≥ C. Fortunately, typically A ≫ B, A ≫ C, and B ≈ C, but to insure the reliability and numerical stability of the algorithm, the distances are sorted prior to calculating the Menger curvature. The radius, or inverse of the curvature, is the product of the triangle lengths divided by four times the area of the triangle (k).
The area of the triangle (k) can be calculated with the triangle edge lengths using Heron’s formula.
With the turn radius it straightforward to use physics to calculate the curvilinear acceleration for the turn using the square of the skier’s velocity at the turn point, the turn radius, and the gravitational acceleration constant to convert the units to G’s.
Note that these calculations are sensitive to the calculated distance between each point. As noted in the Little Lies my GPS Told Me article, the built-in distance functions in Apple’s Core Location system provide incorrect distance values when there are substantial altitude changes between GPS points, such as when you are skiing on a steep alpine slope. If you try and calculate the ski turn radius using Apple’s built-in distance functions, you will mis-estimate the turn radius and turn G-force.