Skip to content

Commit 11a4729

Browse files
Issue #161 Fixed so that when Min x is used at argument to curve GetY it will return Y value for Min x
1 parent ebdfca7 commit 11a4729

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

FreePIE.Core/Common/CurveMath.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public static double SolveCubicSpline(IList<Point> knownSamples, double z)
8080

8181
if (np > 1)
8282
{
83+
if (knownSamples[0].X == z) return knownSamples[0].Y;
8384

8485
double[] a = new double[np];
8586

@@ -182,13 +183,13 @@ public static double SolveCubicSpline(IList<Point> knownSamples, double z)
182183

183184
private static void SolveTridiag(double[] sub, double[] diag, double[] sup, ref double[] b, int n)
184185
{
185-
/* solve linear system with tridiagonal n by n matrix a
186-
using Gaussian elimination *without* pivoting
187-
where a(i,i-1) = sub[i] for 2<=i<=n
188-
a(i,i) = diag[i] for 1<=i<=n
189-
a(i,i+1) = sup[i] for 1<=i<=n-1
190-
(the values sub[1], sup[n] are ignored)
191-
right hand side vector b[1:n] is overwritten with solution
186+
/* solve linear system with tridiagonal n by n matrix a
187+
using Gaussian elimination *without* pivoting
188+
where a(i,i-1) = sub[i] for 2<=i<=n
189+
a(i,i) = diag[i] for 1<=i<=n
190+
a(i,i+1) = sup[i] for 1<=i<=n-1
191+
(the values sub[1], sup[n] are ignored)
192+
right hand side vector b[1:n] is overwritten with solution
192193
NOTE: 1...n is used in all arrays, 0 is unused */
193194
int i;
194195
/* factorization and forward substitution */

0 commit comments

Comments
 (0)