diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2009-05-22 17:48:06 -0400 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2009-05-22 17:48:06 -0400 |
commit | cc7f7c4d13a676d61d9e328038274879c8f6ccb7 (patch) | |
tree | 9d6264df1b0d56d2bbba668788350d85ea325a17 | |
parent | feaa9785f7e98c8511388112d735d6465ad8eb9d (diff) | |
download | sigen-cc7f7c4d13a676d61d9e328038274879c8f6ccb7.tar.gz sigen-cc7f7c4d13a676d61d9e328038274879c8f6ccb7.tar.xz sigen-cc7f7c4d13a676d61d9e328038274879c8f6ccb7.zip |
Track leading point as well
-rw-r--r-- | sigmodr/widgets/mapeditor/WorldMapPlacement.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp b/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp index 0b66a662..6f603f7d 100644 --- a/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp +++ b/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp @@ -115,8 +115,9 @@ template<typename T> static bool between(const T& middle, const T& end1, const T static CollisionInfo findCollisions(const QPolygon& polygon1, const QPolygon& polygon2) { CollisionInfo data; - QPoint prevPoint1 = polygon1.last(); - foreach (const QPoint& point1, polygon1) + QPoint prevPoint1 = polygon1[polygon1.size() - 2]; + QPoint point1 = polygon1.last(); + foreach (const QPoint& nextPoint1, polygon1) { QPoint prevPoint2 = polygon2.last(); foreach (const QPoint& point2, polygon2) @@ -144,6 +145,7 @@ static CollisionInfo findCollisions(const QPolygon& polygon1, const QPolygon& po } prevPoint2 = point2; } + point1 = nextPoint1; prevPoint1 = point1; } return data; |