MathForGameDevelopers
MathForGameDevelopers copied to clipboard
Cubic Spline m_coeffs array index out of bounds
Maybe I'm an idiot:
struct CubicSpline
{
vec3 m_points[SPLINE_POINTS];
vec3 m_coeffs[SPLINE_POINTS-1][4];
This initializes m_coeffs with an array size of [15], with available indexes from 0-14.
int n = SPLINE_POINTS - 1;
This sets n to 15.
m_coeffs[n,2] =Vector2.Zero;
Can you explain to me why this wouldn't be out of bounds? Am I dumb, or is this wrong?