[gegl] reflect.c: self-explanatory variable names



commit a543bce562f24f639f6678a2a07943bd7c12a407
Author: Nicolas Robidoux <nrobidoux git gnome org>
Date:   Wed Nov 21 10:35:03 2012 -0500

    reflect.c: self-explanatory variable names

 operations/transform/reflect.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/operations/transform/reflect.c b/operations/transform/reflect.c
index 970edca..3f62d21 100644
--- a/operations/transform/reflect.c
+++ b/operations/transform/reflect.c
@@ -44,15 +44,17 @@ create_matrix (OpTransform *op,
   GeglChantOperation *chant = GEGL_CHANT_OPERATION (op);
   const gdouble ux = chant->x;
   const gdouble uy = chant->y;
+
   /*
-   * There probably should be an assertion or check that dot != 0.
+   * There probably should be an assertion or check+fix that
+   * length_squared != 0.
    */
-  const gdouble dot = uy*uy + ux*ux;
-  const gdouble two_over_dot = (gdouble) 2 / dot;
+  const gdouble length_squared = ux*ux + uy*uy;
+  const gdouble two_over_length_squared = (gdouble) 2 / length_squared;
 
-  matrix->coeff [0][0] = ux*ux*two_over_dot - (gdouble) 1;
-  matrix->coeff [1][1] = uy*uy*two_over_dot - (gdouble) 1;
-  matrix->coeff [0][1] = matrix->coeff [1][0] = ux*uy*two_over_dot;
+  matrix->coeff [0][0] = ux*ux * two_over_length_squared - (gdouble) 1;
+  matrix->coeff [1][1] = uy*uy * two_over_length_squared - (gdouble) 1;
+  matrix->coeff [0][1] = matrix->coeff [1][0] = ux*uy * two_over_length_squared;
 }
 
 #endif



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