From 13e73fa386cd7843d7079ec7c162ef43d15097c4 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 30 Aug 2007 18:32:36 +0000 Subject: Update to 2Geom rev. 1113 (bzr r3622) --- src/2geom/matrix.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/2geom/matrix.cpp') 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); -- cgit v1.2.3