From e7e07f42b336bb7b5c488eb3bcc6397c0a2a03f4 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期一, 24 八月 2020 16:36:09 +0800
Subject: [PATCH] fix conflict

---
 algorithm/graph.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/algorithm/graph.c b/algorithm/graph.c
new file mode 100644
index 0000000..2b15a19
--- /dev/null
+++ b/algorithm/graph.c
@@ -0,0 +1,51 @@
+#include "usg_common.h" 
+#include "graph.h" 
+using namespace std;
+
+const double epsilon = numeric_limits<float>().epsilon();
+const numeric_limits<double> DOUBLE;
+const double MIN = DOUBLE.min();
+const double MAX = DOUBLE.max();
+ 
+
+Figure::Figure(){}
+//Figure::Figure(const initializer_list<Edge> & _edges): edges(_edges) {}
+Figure::Figure(const std::vector<Edge> & _edges): edges(_edges) {}
+
+
+Figure & Figure::operator=(Figure && f)       // move assignment
+{
+    //std::cout << "move assignment operator called:\n";
+    if (this == &f)
+        return *this;
+    edges = std::move(f.edges);
+
+    return *this;
+}
+
+// bool Figure::contains(const Point& p) const
+// {
+//     auto c = 0;
+//     for (auto e : edges) if (e.isCorss(p)) c++;
+//     return c % 2 != 0;
+// }
+
+bool Figure::contains(const Point& p) const
+{
+    return true;
+}
+
+/**
+ * 鏄惁鐩镐氦
+*/
+bool Edge::isCorss(const Point& p) const
+{
+    if (a.y > b.y) return Edge{ b, a }.isCorss(p);
+    if (p.y == a.y || p.y == b.y) return isCorss({ p.x, p.y + epsilon });
+    if (p.y > b.y || p.y < a.y || p.x > max(a.x, b.x)) return false;
+    if (p.x < min(a.x, b.x)) return true;
+    auto blue = abs(a.x - p.x) > MIN ? (p.y - a.y) / (p.x - a.x) : MAX;
+    auto red = abs(a.x - b.x) > MIN ? (b.y - a.y) / (b.x - a.x) : MAX;
+    return blue >= red;
+}
+

--
Gitblit v1.8.0