Partly fixed MATH-1096.

The 2D cases seem to work now, but there are still problems with the 3D
cases.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1562882 13f79535-47bb-0310-9956-ffa450edef68