summaryrefslogtreecommitdiffstats
path: root/src/libnr/nr-matrix.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2006-06-30 03:54:17 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2006-06-30 03:54:17 +0000
commit77500530cb0602331abb46a9677bc932b1e758f4 (patch)
tree602dd2a877db9b2a3023b9a162c01016dc546c8c /src/libnr/nr-matrix.cpp
parentNew placeholder code for gradients (diff)
downloadinkscape-77500530cb0602331abb46a9677bc932b1e758f4.tar.gz
inkscape-77500530cb0602331abb46a9677bc932b1e758f4.zip
add methods to identify scales and rotations
(bzr r1326)
Diffstat (limited to 'src/libnr/nr-matrix.cpp')
-rw-r--r--src/libnr/nr-matrix.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libnr/nr-matrix.cpp b/src/libnr/nr-matrix.cpp
index 24fa2e206..12a2f2fcb 100644
--- a/src/libnr/nr-matrix.cpp
+++ b/src/libnr/nr-matrix.cpp
@@ -522,6 +522,26 @@ bool Matrix::is_translation(Coord const eps) const {
}
+/**
+ *
+ */
+bool Matrix::is_scale(Coord const eps) const {
+ return ( (fabs(_c[0] - 1.0) > eps || fabs(_c[3] - 1.0) > eps) &&
+ fabs(_c[1]) < eps &&
+ fabs(_c[2]) < eps );
+}
+
+
+/**
+ *
+ */
+bool Matrix::is_rotation(Coord const eps) const {
+ return ( fabs(_c[1]) > eps &&
+ fabs(_c[2]) > eps &&
+ fabs(_c[1] + _c[2]) < 2 * eps);
+}
+
+