summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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));