Created a better way to model the ground

The ground is now a function, so that more complex profiles can be used.
Additionally, all Endpoint constraints are now expressed as a function
of that ground, rather than hard coded.