matrix3: make gegl_matrix3_transform_point support perspective transforms

The affine op uses this function to determine the bounding box of what needs
to be defined on the source pads. This should permit the affine op to work
for GIMPs needs, perhaps the whole op should be renamed to transform now?
parent 20fda017
......@@ -215,12 +215,12 @@ gegl_matrix3_transform_point (GeglMatrix3 *matrix,
gdouble *x,
gdouble *y)
{
gdouble xp,
yp;
gdouble xp, yp, w;
w = (*x * matrix->coeff [2][0] + *y * matrix->coeff [2][1] + matrix->coeff [2][2]);
/* assumes last row is [0 0 1] (true for affine transforms) */
xp = *x * matrix->coeff [0][0] + *y * matrix->coeff [0][1] + matrix->coeff [0][2];
yp = *x * matrix->coeff [1][0] + *y * matrix->coeff [1][1] + matrix->coeff [1][2];
xp = (*x * matrix->coeff [0][0] + *y * matrix->coeff [0][1] + matrix->coeff [0][2]) /w;
yp = (*x * matrix->coeff [1][0] + *y * matrix->coeff [1][1] + matrix->coeff [1][2]) /w;
*x = xp;
*y = yp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment