colour_hdri.distortion.parabolic_2D_function#

colour_hdri.distortion.parabolic_2D_function(x_y: Tuple, a_x2: float, a_x1: float, a_x0: float, a_y2: float, a_y1: float, a_y0: float)[source]#

Evaluate a parabolic 2D function on given coordinate matrices from coordinate vectors.

The parabolic 2D function adopts the following form as given by [KPB16]:

\(I_v(x, y) = \cfrac{1}{2}(a_{x2}x^2 + a_{x1}x + a_{x0}) + \cfrac{1}{2}(a_{y2}y^2 + a_{y1}y + a_{y0})\)

Parameters:
  • x_y (Tuple) – Coordinate matrices from coordinate vectors to evaluate the parabolic 2d function on. The coordinate matrices can be generated with the numpy.meshgrid() definition.

  • a_x2 (float) – Coefficient \(a_{x2}\) for the parabolic equation.

  • a_x1 (float) – Coefficient \(a_{x1}\) for the parabolic equation.

  • a_x0 (float) – Coefficient \(a_{x0}\) for the parabolic equation.

  • a_y2 (float) – Coefficient \(a_{y2}\) for the parabolic equation.

  • a_y1 (float) – Coefficient \(a_{y1}\) for the parabolic equation.

  • a_y0 (float) – Coefficient \(a_{y0}\) for the parabolic equation.

Returns:

Coordinate matrices with evaluated parabolic 2D function.

Return type:

numpy.ndarray

References

[KPB16]

Examples

>>> x_1, y_1 = np.meshgrid(np.linspace(0, 1, 4), np.linspace(0, 1, 3))
>>> parabolic_2D_function(  
...     (x_1, y_1), -0.5, 0, 1, -0.5, 0, 1
... )
array([[ 1.        ,  0.9722222...,  0.8888888...,  0.75      ],
       [ 0.9375    ,  0.9097222...,  0.8263888...,  0.6875    ],
       [ 0.75      ,  0.7222222...,  0.6388888...,  0.5       ]])