MathForGameDevelopers icon indicating copy to clipboard operation
MathForGameDevelopers copied to clipboard

Cubic Spline m_coeffs array index out of bounds

Open anaanook opened this issue 3 years ago • 0 comments

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?

anaanook avatar Apr 02 '21 22:04 anaanook