From fbcb807463142d2ec48dba828634bd900f078015 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 28 Jan 2014 01:16:02 -0500 Subject: [PATCH] Short-circuit zero scaled 2D objects --- src/Polygon2d.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Polygon2d.cc b/src/Polygon2d.cc index 3c72b6f2..271a68a0 100644 --- a/src/Polygon2d.cc +++ b/src/Polygon2d.cc @@ -1,4 +1,5 @@ #include "Polygon2d.h" +#include "printutils.h" #include /*! @@ -54,6 +55,11 @@ bool Polygon2d::isEmpty() const void Polygon2d::transform(const Transform2d &mat) { + if (mat.matrix().determinant() == 0) { + PRINT("Warning: Scaling a 2D object with 0 - removing object"); + this->theoutlines.clear(); + return; + } BOOST_FOREACH(Outline2d &o, this->theoutlines) { BOOST_FOREACH(Vector2d &v, o.vertices) { v = mat * v;