Fix index out of range exception in FastExpansionSumZeroElim

git-svn-id: https://triangle.svn.codeplex.com/svn@73549 0e2699bc-83d4-4a8f-98e7-55e24ab8c7a5
This commit is contained in:
SND\wo80_cp
2013-08-30 23:09:00 +00:00
parent f07cb1ded7
commit 948069da2b
+8 -7
View File
@@ -419,7 +419,7 @@ namespace TriangleNet
/// <param name="h"></param> /// <param name="h"></param>
/// <returns></returns> /// <returns></returns>
/// <remarks> /// <remarks>
/// Sets h = e + f. See my Robust Predicates paper for details. /// Sets h = e + f. See the Robust Predicates paper for details.
/// ///
/// If round-to-even is used (as with IEEE 754), maintains the strongly nonoverlapping /// If round-to-even is used (as with IEEE 754), maintains the strongly nonoverlapping
/// property. (That is, if e is strongly nonoverlapping, h will be also.) Does NOT /// property. (That is, if e is strongly nonoverlapping, h will be also.) Does NOT
@@ -639,10 +639,13 @@ namespace TriangleNet
double detleft, detright; double detleft, detright;
double detlefttail, detrighttail; double detlefttail, detrighttail;
double det, errbound; double det, errbound;
double[] B = new double[4], C1 = new double[8], C2 = new double[12], D = new double[16]; // Edited to work around index out of range exceptions (changed array length from 4 to 5).
// See unsafe indexing in FastExpansionSumZeroElim.
double[] B = new double[5], u = new double[5];
double[] C1 = new double[8], C2 = new double[12], D = new double[16];
double B3; double B3;
int C1length, C2length, Dlength; int C1length, C2length, Dlength;
double[] u = new double[4];
double u3; double u3;
double s1, t1; double s1, t1;
double s0, t0; double s0, t0;
@@ -762,10 +765,8 @@ namespace TriangleNet
double aa3, bb3, cc3; double aa3, bb3, cc3;
double ti1, tj1; double ti1, tj1;
double ti0, tj0; double ti0, tj0;
// Edited to work around rare index out of range exceptions (changed array length from 4 to 5) // Edited to work around index out of range exceptions (changed array length from 4 to 5).
// Reason: see loops in FastExpansionSumZeroElim // See unsafe indexing in FastExpansionSumZeroElim.
// while (eindex < elen) { [...] enow = e[++eindex]; [...] }
// Definitely not safe, but Triangle C code doesn't crash!?
double[] u = new double[5], v = new double[5]; double[] u = new double[5], v = new double[5];
double u3, v3; double u3, v3;
double[] temp8 = new double[8], temp16a = new double[16], temp16b = new double[16], temp16c = new double[16]; double[] temp8 = new double[8], temp16a = new double[16], temp16b = new double[16], temp16c = new double[16];