TS defines tables as [y_row_count x x_column_count] and we follow that weird Y, X order of arguments here

This commit is contained in:
rusefillc 2024-06-07 19:07:48 -04:00
parent 93b0f0db13
commit 126e269522
1 changed files with 7 additions and 6 deletions

View File

@ -93,13 +93,14 @@ float interpolate2d(const float value, const TBin (&bin)[TSize], const TValue (&
return priv::linterp(low, high, frac);
}
template<typename VType, unsigned RNum, typename RType, unsigned CNum, typename CType>
float interpolate3d(const VType (&table)[RNum][CNum],
const RType (&rowBins)[RNum], float rowValue,
const CType (&colBins)[CNum], float colValue)
// TS defines tables as [y_row_count x x_column_count] and we follow that weird Y, X order of arguments here
template<typename VType, unsigned RNum, typename RType, unsigned X_ColumnNum, typename X_CType>
float interpolate3d(const VType (&table)[RNum][X_ColumnNum],
const RType (&rowBins)[RNum], float yRowValue,
const X_CType (&colBins)[X_ColumnNum], float xColValue)
{
auto row = priv::getBin(rowValue, rowBins);
auto col = priv::getBin(colValue, colBins);
auto row = priv::getBin(yRowValue, rowBins);
auto col = priv::getBin(xColValue, colBins);
// Orient the table such that (0, 0) is the bottom left corner,
// then the following variable names will make sense