summaryrefslogtreecommitdiff
path: root/lib/include/graph.hpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-11-12 11:38:29 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-11-12 11:38:29 -0500
commit0a79391dc49a9662100969e53b55fef4d367df77 (patch)
treea84704ef2c37a8ae43a47fc92af38add8bb5804f /lib/include/graph.hpp
parent8c1b1a60656f21d206f6c7c188923df06b646ca5 (diff)
downloadfuse_networks-0a79391dc49a9662100969e53b55fef4d367df77.tar.gz
fuse_networks-0a79391dc49a9662100969e53b55fef4d367df77.tar.bz2
fuse_networks-0a79391dc49a9662100969e53b55fef4d367df77.zip
more progress on crack stress
Diffstat (limited to 'lib/include/graph.hpp')
-rw-r--r--lib/include/graph.hpp43
1 files changed, 38 insertions, 5 deletions
diff --git a/lib/include/graph.hpp b/lib/include/graph.hpp
index c78fe9f..5ad4c8b 100644
--- a/lib/include/graph.hpp
+++ b/lib/include/graph.hpp
@@ -13,13 +13,44 @@
#include "array_hash.hpp"
-class graph {
+class coordinate {
public:
- typedef struct coordinate {
- double x;
- double y;
- } coordinate;
+ double x;
+ double y;
+
+ coordinate operator+(const coordinate& r) const {
+ coordinate rp = {0, 0};
+ rp.x = x + r.x;
+ rp.y = y + r.y;
+
+ return rp;
+ }
+
+ template <class T>
+ coordinate operator*(const T& a) const {
+ coordinate rp = *this;
+ rp.x *= a;
+ rp.y *= a;
+ return rp;
+ }
+
+ coordinate operator-(const coordinate& r) const {
+ coordinate rp = *this;
+ return rp + (r * -1);
+ }
+
+ coordinate operator-() const {
+ return *this * -1;
+ }
+ void operator+=(const coordinate& r) {
+ x += r.x;
+ y += r.y;
+ }
+};
+
+class graph {
+public:
typedef struct vertex {
coordinate r;
std::vector<unsigned> nd;
@@ -49,4 +80,6 @@ public:
graph const rotate();
std::string write() const;
+
+ coordinate Δr(unsigned e) const;
};