This curve calculation function uses cubic spline curves and has the following characteristics:
(1) Supports 2D and 3D coordinates
(2) Tangent vectors at each output coordinate can be obtained
As shown in Figure 1, by specifying just a few points, you can obtain points on a curve that smoothly passes through that point. Figure 1 shows that if you specify the input coordinate array P0~3, the number of arrays 4, and the number of output coordinates 10, you can obtain the output coordinate array c0~9 that smoothly passes through that point. Also, by using the tangent function, you can obtain the tangent vector at each output coordinate. Tangent vectors can be used for things such as the character's direction of movement.
Figure 1 Conceptual diagram of curve calculation