colour.geometry.ellipse_coefficients_general_form#

colour.geometry.ellipse_coefficients_general_form(coefficients: ArrayLike) NDArrayFloat[source]#

Compute general form ellipse coefficients from the specified canonical form ellipse coefficients.

Transform ellipse coefficients from canonical representation (center, semi-axes, rotation) to general quadratic form \(Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0\).

The canonical form ellipse coefficients are: center coordinates \((x_c, y_c)\), semi-major axis length \(a\), semi-minor axis length \(b\), and rotation angle \(\theta\) (degrees) of the semi-major axis from the positive x-axis.

Parameters:

coefficients (ArrayLike) – Canonical form ellipse coefficients as \([x_c, y_c, a, b, \theta]\).

Returns:

General form coefficients \([A, B, C, D, E, F]\).

Return type:

numpy.ndarray

References

[Wikipedia]

Examples

>>> coefficients = np.array([0.5, 0.5, 2, 1, 45])
>>> ellipse_coefficients_general_form(coefficients)
array([ 2.5, -3. ,  2.5, -1. , -1. , -3.5])