[gegl] matrix: add gegl_matrix2_is_scale()



commit ae47ea9ad10fa46b85f50096feafda9f039a612e
Author: Ell <ell_se yahoo com>
Date:   Tue Mar 6 11:01:30 2018 -0500

    matrix: add gegl_matrix2_is_scale()

 gegl/gegl-matrix.c |    6 ++++++
 gegl/gegl-matrix.h |   10 ++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/gegl/gegl-matrix.c b/gegl/gegl-matrix.c
index 98a0864..70a0486 100644
--- a/gegl/gegl-matrix.c
+++ b/gegl/gegl-matrix.c
@@ -24,6 +24,12 @@
 #include "gegl-matrix.h"
 
 
+gboolean
+gegl_matrix2_is_scale (GeglMatrix2 *matrix)
+{
+  return matrix->coeff[0][1] == 0.0 && matrix->coeff[1][0] == 0.0;
+}
+
 gdouble
 gegl_matrix2_determinant (GeglMatrix2 *matrix)
 {
diff --git a/gegl/gegl-matrix.h b/gegl/gegl-matrix.h
index b1a110f..30e2c52 100644
--- a/gegl/gegl-matrix.h
+++ b/gegl/gegl-matrix.h
@@ -33,6 +33,16 @@ typedef struct {
 } GeglMatrix2;
 
 /*
+ * gegl_matrix2_is_scale:
+ * @matrix: a #GeglMatrix2
+ *
+ * Check if a matrix only does scaling.
+ *
+ * Returns TRUE if the matrix only does scaling.
+ */
+gboolean   gegl_matrix2_is_scale        (GeglMatrix2 *matrix);
+
+/*
  * gegl_matrix2_determinant:
  * @matrix: a #GeglMatrix2
  *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]