Speeduino
Loading...
Searching...
No Matches
table3d_interpolate.h
Go to the documentation of this file.
1#pragma once
2
3#include "table3d_typedefs.h"
4
5// A table location.
11
12
14 // Store the upper *index* of the X and Y axis bins that were last hit.
15 // This is used to make the next check faster since very likely the x & y values have
16 // only changed by a small amount & are in the same bin (or an adjacent bin).
17 //
18 // It's implicit that the other bin index is max bin index - 1 (a single axis
19 // value can't span 2 axis bins). This saves 1 byte.
20 //
21 // E.g. 6 element x-axis contents:
22 // [ 8| 9|12|15|18|21]
23 // indices:
24 // 0, 1, 2, 3, 4, 5
25 // If lastXBinMax==3, the min index must be 2. I.e. the last X value looked
26 // up was between 12<X<=15.
29
30 //Store the last input and output values, again for caching purposes
33};
34
35
37{
38 pCache->last_lookup.x = INT16_MAX;
39}
40
41/*
423D Tables have an origin (0,0) in the top left hand corner. Vertical axis is expressed first.
43Eg: 2x2 table
44-----
45|2 7|
46|1 4|
47-----
48
49(0,1) = 7
50(0,0) = 2
51(1,0) = 1
52
53*/
55 table3d_dim_t axisSize,
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349
int16_t table3d_axis_t
The type of each axis value.
Definition table3d_typedefs.h:28
uint8_t table3d_value_t
The type of each table value.
Definition table3d_typedefs.h:25
uint8_t table3d_dim_t
Encodes the length of the axes.
Definition table3d_typedefs.h:22
static uint8_t x
Definition maths.cpp:7
static uint8_t y
Definition maths.cpp:7
Definition table3d_interpolate.h:7
table3d_axis_t y
Definition table3d_interpolate.h:9
table3d_axis_t x
Definition table3d_interpolate.h:8
Definition table3d_interpolate.h:13
table3d_dim_t lastYBinMax
Definition table3d_interpolate.h:28
coord2d last_lookup
Definition table3d_interpolate.h:31
table3d_value_t lastOutput
Definition table3d_interpolate.h:32
table3d_dim_t lastXBinMax
Definition table3d_interpolate.h:27
table3d_value_t get3DTableValue(struct table3DGetValueCache *pValueCache, table3d_dim_t axisSize, const table3d_value_t *pValues, const table3d_axis_t *pXAxis, const table3d_axis_t *pYAxis, table3d_axis_t y, table3d_axis_t x)
Definition table3d_interpolate.cpp:152
static void invalidate_cache(table3DGetValueCache *pCache)
Definition table3d_interpolate.h:36
Typedefs for primitive 3D table elements.