pcdsdevices.targets.mesh_interpolation
- pcdsdevices.targets.mesh_interpolation(top_left, top_right, bottom_right, bottom_left)
Mapping functions for an arbitrary quadrilateral.
Reference: https://www.particleincell.com/2012/quad-interpolation/
In order to perform the interpolation on an arbitrary quad, we need to obtain a mapping function. Our goal is to come up with a function such as (x, y) = f(l, m) where l = [0, 1] and m = [0, 1] describes the entire point space enclosed by the quadrilateral. In addition, we want f(0, 0) = (x1, y1), f(1, 0) = (x2, y2) and so on to correspond to the polygon vertices. This function forms a map that allows us to transform the quad from the physical coordinates set to a logical coordinate space. In the logical coordinates, the polygon morphs into a square, regardless of its physical form. Once the logical coordinates are obtained, we perform the scatter and find the physical x, y values.
To find the map, we assume a bilinear mapping function given by: x = alpha_1 + alpha_2*l + alpha_3*m + alpha_4 * l _ m y = beta_1 + beta_2 * l + beta_3 * m + beta_4 * l * m
Next we use these experessions to solve for the 4 coefficients: x1 1 0 0 0 alpha_1 x2 1 1 0 0 alpha_2 x3 1 1 1 1 alpha_3 x4 1 0 1 0 alpha_4
We do the same for the beta coefficients.
- Parameters:
- Returns:
a_coeffs, b_coeffs (tuple) – List of tuples with the alpha and beta coefficients for projective transformation. They are used to find x and y.