Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add slack to fgtable interpolation #5

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
etotheipluspi marked this conversation as resolved.
Show resolved Hide resolved

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