[gegl] gegl-matrix: improve description of gegl_matrix3_originate()
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl-matrix: improve description of gegl_matrix3_originate()
- Date: Tue, 21 Nov 2017 17:01:34 +0000 (UTC)
commit 2f1ba90c6525ef3e3f927a7ce3df7c684d7569e3
Author: Ell <ell_se yahoo com>
Date: Tue Nov 21 11:53:52 2017 -0500
gegl-matrix: improve description of gegl_matrix3_originate()
gegl/gegl-matrix.c | 13 ++++++-------
gegl/gegl-matrix.h | 13 ++++++++++---
2 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/gegl/gegl-matrix.c b/gegl/gegl-matrix.c
index 4d57e38..119f230 100644
--- a/gegl/gegl-matrix.c
+++ b/gegl/gegl-matrix.c
@@ -197,17 +197,16 @@ gegl_matrix3_multiply (GeglMatrix3 *left,
void
gegl_matrix3_originate (GeglMatrix3 *matrix,
- gdouble x,
- gdouble y)
+ gdouble x,
+ gdouble y)
{
-
/* assumes last row is [0 0 1] (true for affine transforms) */
matrix->coeff [0][2] = matrix->coeff [0][0] * (-x) +
- matrix->coeff [0][1] * (-y) +
- matrix->coeff [0][2] + x;
+ matrix->coeff [0][1] * (-y) +
+ matrix->coeff [0][2] + x;
matrix->coeff [1][2] = matrix->coeff [1][0] * (-x) +
- matrix->coeff [1][1] * (-y) +
- matrix->coeff [1][2] + y;
+ matrix->coeff [1][1] * (-y) +
+ matrix->coeff [1][2] + y;
}
void
diff --git a/gegl/gegl-matrix.h b/gegl/gegl-matrix.h
index 76a1ee9..8b68612 100644
--- a/gegl/gegl-matrix.h
+++ b/gegl/gegl-matrix.h
@@ -146,12 +146,19 @@ void gegl_matrix3_multiply (GeglMatrix3 *left,
* @x: x coordinate of new origin
* @y: y coordinate of new origin.
*
- * Hmm not quite sure what this does.
+ * Shift the origin of the transformation specified by @matrix
+ * to (@x, @y). In other words, calculate the matrix that:
+ *
+ * 1. Translates the input by (-@x, -@y).
+ *
+ * 2. Transforms the result using the original @matrix.
+ *
+ * 3. Translates the result by (@x, @y).
*
*/
void gegl_matrix3_originate (GeglMatrix3 *matrix,
- gdouble x,
- gdouble y);
+ gdouble x,
+ gdouble y);
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]