Skip to content

Commit

Permalink
Merge pull request #5 from machindustries/etotheipluspi/fgtable-inter…
Browse files Browse the repository at this point in the history
…polation-slack

Add slack to fgtable interpolation
  • Loading branch information
etotheipluspi authored Sep 18, 2024
2 parents 95aa62e + e508c9a commit 525fe6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/math/FGTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,8 @@ double FGTable::GetValue(double key) const
double Span = Data[2*r] - x0;
assert(Span > 0.0);
double Factor = (key - x0) / Span;
assert(Factor >= 0.0 && Factor <= 1.0);
assert(Factor >= -EPSILON && Factor <= 1.0 + EPSILON);


double y0 = Data[2*r-1];
return Factor*(Data[2*r+1] - y0) + y0;
Expand Down
2 changes: 2 additions & 0 deletions src/math/FGTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ class JSBSIM_API FGTable : public FGParameter, public FGJSBBase

std::string GetName(void) const {return Name;}

static constexpr double EPSILON = 1e-9;

private:
enum type {tt1D, tt2D, tt3D} Type;
enum axis {eRow=0, eColumn, eTable};
Expand Down

0 comments on commit 525fe6a

Please sign in to comment.