diff options
| author | Mel <einebeere@gmail.com> | 2023-07-08 03:25:44 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2023-07-08 03:25:44 +0200 |
| commit | fe2baedc760c2f29e2c720f6b1132a2de33c5430 (patch) | |
| tree | dfbe1c72a17805a3cab6e0d47433e9021890c9ca /src/Math/Interpolation.cpp | |
| parent | 41fbca10f6c6cdd9c1623f1347e7ecb40f5e7f59 (diff) | |
| download | meowcraft-fe2baedc760c2f29e2c720f6b1132a2de33c5430.tar.zst meowcraft-fe2baedc760c2f29e2c720f6b1132a2de33c5430.zip | |
Use own size types
Diffstat (limited to 'src/Math/Interpolation.cpp')
| -rw-r--r-- | src/Math/Interpolation.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Math/Interpolation.cpp b/src/Math/Interpolation.cpp index d5b2564..ce87435 100644 --- a/src/Math/Interpolation.cpp +++ b/src/Math/Interpolation.cpp @@ -3,18 +3,18 @@ namespace Math { -float linear_interpolation(Vector<2> val, float left, float right, float pos) { +Real linear_interpolation(Vector<2> val, Real left, Real right, Real pos) { return val.x() + (pos - left) * (val.y() - val.x()) / (right - left); } -float bilinear_interpolation(Matrix<2, 2> val, GridCellBoundaries cell, Vector<2> pos) { +Real bilinear_interpolation(Matrix<2, 2> val, GridCellBoundaries cell, Vector<2> pos) { auto r1 = linear_interpolation(val.row(0), cell.x1, cell.x2, pos.x()); auto r2 = linear_interpolation(val.row(1), cell.x1, cell.x2, pos.x()); return linear_interpolation({r1, r2}, cell.y1, cell.y2, pos.y()); } -float trilinear_interpolation(Matrix<2, 2> val_front, Matrix<2, 2> val_back, const CubeCellBoundaries& cell, Vector<3> pos) { +Real trilinear_interpolation(Matrix<2, 2> val_front, Matrix<2, 2> val_back, const CubeCellBoundaries& cell, Vector<3> pos) { auto r1 = bilinear_interpolation(val_front, cell.grid_cell(), {pos.x(), pos.y()}); auto r2 = bilinear_interpolation(val_back, cell.grid_cell(), {pos.x(), pos.y()}); |
