[dia] [transform] Implement dia_matrix_is_identity()
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] [transform] Implement dia_matrix_is_identity()
- Date: Fri, 8 Oct 2010 18:55:05 +0000 (UTC)
commit c7bf9817b5a4aef6716ac9388d988cf5ddf54887
Author: Hans Breuer <hans breuer org>
Date: Fri Oct 8 20:43:05 2010 +0200
[transform] Implement dia_matrix_is_identity()
lib/geometry.c | 15 +++++++++++++++
lib/geometry.h | 2 ++
2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/lib/geometry.c b/lib/geometry.c
index 290b63c..74567af 100644
--- a/lib/geometry.c
+++ b/lib/geometry.c
@@ -780,3 +780,18 @@ calculate_object_edge(Point *objmid, Point *end, DiaObject *obj)
return mid2;
}
+gboolean
+dia_matrix_is_identity (const DiaMatrix *matrix)
+{
+ const real epsilon = 1e-6;
+ if ( fabs(matrix->xx - 1.0) < epsilon
+ && fabs(matrix->yy - 1.0) < epsilon
+ && fabs(matrix->xy) < epsilon
+ && fabs(matrix->yx) < epsilon
+ && fabs(matrix->x0) < epsilon
+ && fabs(matrix->y0) < epsilon)
+ return TRUE;
+
+ return FALSE;
+}
+
diff --git a/lib/geometry.h b/lib/geometry.h
index 6d7eb8f..1088af4 100644
--- a/lib/geometry.h
+++ b/lib/geometry.h
@@ -125,6 +125,8 @@ struct _DiaMatrix {
real x0; real y0;
};
+gboolean dia_matrix_is_identity (const DiaMatrix *matix);
+
#define ROUND(x) ((int) floor((x)+0.5))
/* inline these functions if the platform supports it */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]