summaryrefslogtreecommitdiffstats
path: root/src/2geom/matrix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/2geom/matrix.cpp')
-rw-r--r--src/2geom/matrix.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/2geom/matrix.cpp b/src/2geom/matrix.cpp
index f53795943..c0e64ad33 100644
--- a/src/2geom/matrix.cpp
+++ b/src/2geom/matrix.cpp
@@ -94,7 +94,7 @@ void Matrix::setExpansionY(double val) {
double exp_y = expansionY();
if(!near(exp_y, 0.0)) { //TODO: best way to deal with it is to skip op?
double coef = val / expansionY();
- for(unsigned i=2;i<4;i++) _c[i] *= coef;
+ for(unsigned i=2; i<4; i++) _c[i] *= coef;
}
}
@@ -105,6 +105,8 @@ void Matrix::setIdentity() {
_c[4] = 0.0; _c[5] = 0.0;
}
+//TODO: use eps
+
bool Matrix::isIdentity(Coord const eps) const {
return near(_c[0], 1.0) && near(_c[1], 0.0) &&
near(_c[2], 0.0) && near(_c[3], 1.0) &&
@@ -151,6 +153,14 @@ bool Matrix::isRotation(Coord const eps) const {
near(_c[0]*_c[0] + _c[1]*_c[1], 1.0);
}
+bool Matrix::onlyScaleAndTranslation(Coord const eps) const {
+ return near(_c[0], _c[3]) && near(_c[1], 0) && near(_c[2], 0);
+}
+
+bool Matrix::flips() const {
+ return cross(xAxis(), yAxis()) > 0;
+}
+
/** Returns the Scale/Rotate/skew part of the matrix without the translation part. */
Matrix Matrix::without_translation() const {
return Matrix(_c[0], _c[1], _c[2], _c[3], 0, 0);