In the terrain code:
If you change the terrain to use a pointer to the top left of the parabola, and a width (always 2r) and stride (n1-2r) then you might be able to save. Clip the pointer (max(heights, height_ptr)), width before drawing the parabola.
OR
To eliminate clipping altogether, render to a square which is much bigger than your landscape (you need to allocate at least r more pixels round the edge, or, if it's a texture, just go to the next power of 2 and change the uvs when you render, or use glTexSubImage.
Jim