Figure 1: Difference in segment section lengths when control points positioned outside of natural gait proportion |
This is because the length of each segment between two control points in normalised (they are always represented between 0 and 1).
As the object is moved along each curve segment by interpolation from 0 to 1, it takes the same amount of time to transition between each pair of control points regardless of the segment length. Longer segments will be followed faster, shorter segments are followed more slowly.
In order to calculate how to move the object to achieve a constant velocity along the curve “the curve to be reparameterized by arc length.” (Eberly, 2017, p. 2), rather than each curve point at ‘t’.
This proves problematic as an arc is an ellipse, the length of which cannot be explicitly defined as a closed formula – only approximated.
An approach to approximate the total curve length is proposed by Holmer (2015), Eberly (2017), and OneLoneCoder (2017) involves sampling the position of the curve at a constant interval throughout it’s entire length to allow for use of the Pythagorean theorem to find the straight line distance between each pair of intervals.
One potential issue with this approach is straight lines will never yield identical result to a curve, and if the curvature of a curve segment reaches a highly acute degree, the interval samples may not adequately reach the apex of the curve and inaccurately draw a line which omits a portion of the curved path, reducing the sum curve length.
To reduce the discrepancy, OneLoneCoder (2017) suggests plotting additional sample intervals based on assessment of the tangent angle at each sample interval along the curve. If sequential tangent angles are not within an acceptable tolerance, an additional interval can be created between them, increasing the resolution of the sample intervals to a threshold value, only where necessary.
While still only an estimation, this would mean significantly less curve length is neglected between placed sample intervals.
These distances are summed to give the total curve length based on the approximation polygon plotted from the sample intervals. Using this approximated length, it is possible to compute ‘curve point at distance’ instead of ‘curve point at ‘t’’.
Fortunately, I believe my solution will preserve the natural curve proportions of the human gait as my interior control points will be moved away from the centre of the curve proportionally, in opposite directions to the other control point along the y-axis and the curves forward direction.
This proportional movement will maintain the curves equal segment length, meaning that unless my solution requires alteration later in development, this improvement is not essential.
If there is spare development time prior to the project deadline I will implement approach. In the meantime, my time is better spent advancing the crucial functionality of the project.
References
Eberly, D. (2017). Moving Along a Curve with Specified Speed. [online] Redmond Available at: https://www.geometrictools.com/Documentation/MovingAlongCurveSpecifiedSpeed.pdf [Accessed 10 Jan. 2019].
Holmer, J. (2015). Unite 2015 - A coder's guide to spline-based procedural geometry. [video] Available at: https://www.youtube.com/watch?v=o9RK6O2kOKo [Accessed 9 Jan. 2019].
Programming & Using Splines - Part#2. (2017). [video] Directed by 'One Lone Coder'. Available at: https://www.youtube.com/watch?v=DzjtU4WLYNs [Accessed 9 Jan. 2019].
Bibliography
Eberly, D. (2017). Moving Along a Curve with Specified Speed. [online] Redmond, pp.2 - 6. Available at: https://www.geometrictools.com/Documentation/MovingAlongCurveSpecifiedSpeed.pdf [Accessed 11 Jan. 2019].