View Source Idmlx.Utils.Transform (idmlx v0.2.1)
Summary
Functions
Calculates a 2x3 transformation matrix that maps the old coordinates to the new coordinates.
Functions
Calculates a 2x3 transformation matrix that maps the old coordinates to the new coordinates.
Parameters
old_coords
: A list of four elements representing the old coordinates[x1_old, x2_old, y1_old, y2_old]
.new_coords
: A list of four elements representing the new coordinates[x1_new, x2_new, y1_new, y2_new]
.
Returns
- A list of six elements representing the transformation matrix
[a, b, c, d, e, f]
where:a
is the scaling factor in the x direction multiplied by the cosine of the rotation angle.b
is the scaling factor in the x direction multiplied by the sine of the rotation angle.c
is the negative scaling factor in the y direction multiplied by the sine of the rotation angle.d
is the scaling factor in the y direction multiplied by the cosine of the rotation angle.e
is the translation in the x direction.f
is the translation in the y direction.
Example
iex> Transform.calculate_transform_matrix([0, 2, 0, 2], [1, 3, 1, 3])
[1.0, 0.0, 0.0, 1.0, 1.0, 1.0]