summaryrefslogtreecommitdiffstats
path: root/sigmodr/widgets
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-04-28 01:43:17 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-04-28 01:43:17 -0400
commit6af5ea37f0f1699a4c67245a04d37dca72dbcd98 (patch)
tree5f265c6a487b07aa82a400e688fa4af429b786ef /sigmodr/widgets
parentd68f52169e1386bcd9ad9517f6ec19e6b7dbcd14 (diff)
downloadsigen-6af5ea37f0f1699a4c67245a04d37dca72dbcd98.tar.gz
sigen-6af5ea37f0f1699a4c67245a04d37dca72dbcd98.tar.xz
sigen-6af5ea37f0f1699a4c67245a04d37dca72dbcd98.zip
Add function for determining convex turn direction as well
Diffstat (limited to 'sigmodr/widgets')
-rw-r--r--sigmodr/widgets/mapeditor/WorldMapPlacement.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp b/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp
index b2facc97..6b39de54 100644
--- a/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp
+++ b/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp
@@ -90,6 +90,19 @@ static Corner turnDirection(const QPoint& previous, const QPoint& current, const
return Invalid;
}
+static Corner convexTurnDirection(const QPoint& previous, const QPoint& current, const QPoint& next)
+{
+ if ((current.y() < previous.y()) && (current.x() < next.x()))
+ return BottomRight;
+ if ((previous.x() < current.x()) && (current.y() < next.y()))
+ return BottomLeft;
+ if ((previous.y() < current.y()) && (next.x() < current.x()))
+ return TopLeft;
+ if ((current.x() < previous.x()) && (next.y() < current.y()))
+ return TopRight;
+ return Invalid;
+}
+
template<typename T> static bool between(const T& middle, const T& end1, const T& end2)
{
return (qMin(end1, end2) < middle) && (middle < qMax(end1, end2));