Use correct formula in Curve#getTangentAt() for end-points when there is no handle.

Closes #553.