File Interpolation.hpp¶
-
namespace Acts
Note
This file is foreseen for the
Geometry
module to replaceExtent
Note
this is foreseen for the ‘Geometry’ module
Functions
-
template<typename T, size_t N, class Point1, class Point2 = Point1, class Point3 = Point2, typename = std::enable_if_t<detail::can_interpolate<Point1, Point2, Point3, T>::value>>
inline T interpolate(const Point1 &position, const Point2 &lowerCorner, const Point3 &upperCorner, const std::array<T, N> &values)¶ performs linear interpolation inside a hyper box
Note
Given
U
andV
of value typeT
as well as twodouble
a
andb
, then the following must be a valid expressiona * U + b * V
yielding an object which is (implicitly) convertible toT
.All
Point
types must represent d-dimensional positions and support coordinate access usingoperator
[] which should return adouble
(or a value which is implicitly convertible). Coordinate indices must start at 0.N
is the number of hyper box corners which is \(2^d\) where \(d\) is the dimensionality of the hyper box. The dimensionality must be consistent with the providedPoint
types.Definition of the canonical order for sorting the field values: The hyper box corners are numbered according to the following scheme. Each corner is defined by the set of lower/upper boundary limits in each dimension
i
. This can be represented by a binary code (from left to right) where a0
stands for a lower bound along this axis and a1
stand for the upper bound along this axis. The left most bit corresponds to the first dimension and the bits to the left correspond to the 2nd, 3rd… dimension. The binary code can be interpreted as integer which gives the number of the corresponding hyper box corner. The field values are ordered according to ascending hyper box corner numbers.
As an example assume we have a 3D box with
lowerCorner
= (1,2,3) andupperCorner
= (4,5,6). The eight corners with their bit patterns and corner numbers are:(1,2,3): 000 = 0
(1,2,6): 001 = 1
(1,5,3): 010 = 2
(1,5,6): 011 = 3
(4,2,3): 100 = 4
(4,2,6): 101 = 5
(4,5,3): 110 = 6
(4,5,6): 111 = 7
- Template Parameters
T – type of values to be interpolated
N – number of hyper box corners
Point1 – type specifying geometric positions
Point2 – type specifying geometric positions
Point3 – type specifying geometric positions
- Parameters
position – [in] position to which to interpolate
lowerCorner – [in] generalized lower-left corner of hyper box (containing the minima of the hyper box along each dimension)
upperCorner – [in] generalized upper-right corner of hyper box (containing the maxima of the hyper box along each dimension)
values – [in] field values at the hyper box corners sorted in the canonical order defined below.
- Returns
interpolated value at given position
- Pre
position
must describe a position inside the given hyper box, that is \(\text{lowerCorner}[i] \le \text{position}[i] \le \text{upperCorner}[i] \quad \forall i=0, \dots, d-1\).
-
template<typename T, size_t N, class Point1, class Point2 = Point1, class Point3 = Point2, typename = std::enable_if_t<detail::can_interpolate<Point1, Point2, Point3, T>::value>>