From 99c802552e0ca4e1410f85fc9e6699454119a7b6 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Fri, 26 Jan 2024 12:45:30 -0500 Subject: [PATCH] shifting --- include/shifting.h | 24 ++++++++++++ libraries/BLT-With-Graphics-Template | 2 +- src/shifting.cpp | 56 ++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 include/shifting.h create mode 100644 src/shifting.cpp diff --git a/include/shifting.h b/include/shifting.h new file mode 100644 index 0000000..c0a37f7 --- /dev/null +++ b/include/shifting.h @@ -0,0 +1,24 @@ +/* + * + * Copyright (C) 2024 Brett Terpstra + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef GP_IMAGE_TEST_SHIFTING_H +#define GP_IMAGE_TEST_SHIFTING_H + +void calculate_ordering(); + +#endif //GP_IMAGE_TEST_SHIFTING_H diff --git a/libraries/BLT-With-Graphics-Template b/libraries/BLT-With-Graphics-Template index 709db71..129f6e3 160000 --- a/libraries/BLT-With-Graphics-Template +++ b/libraries/BLT-With-Graphics-Template @@ -1 +1 @@ -Subproject commit 709db718275718e09b3c68bde3faa6d7c9701af8 +Subproject commit 129f6e3fb9d6524e9fd6ece47f9bf4ea6f0a1a83 diff --git a/src/shifting.cpp b/src/shifting.cpp new file mode 100644 index 0000000..b920a9f --- /dev/null +++ b/src/shifting.cpp @@ -0,0 +1,56 @@ +/* + * + * Copyright (C) 2024 Brett Terpstra + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include +#include +#include +#include + +inline constexpr char from_char(char c) +{ + return c - 'a'; +} + +struct vertex +{ + char name; + HASHSET neighbours; + + vertex(char name, const HASHSET& n): name(from_char(name)) + { + for (const auto& v : n) + neighbours.insert(from_char(v)); + } +}; + +std::vector edges = { + vertex{'a', {'i', 'e', 'b', 'j', 'h'}}, + vertex{'b', {'a', 'e', 'c', 'j'}}, + vertex{'c', {'e', 'd', 'f', 'j', 'b'}}, + vertex{'d', {'e', 'f', 'c'}}, + vertex{'e', {'h', 'f', 'd', 'c', 'b', 'a', 'i'}}, + vertex{'f', {'d', 'e', 'h', 'g', 'j', 'c'}}, + vertex{'g', {'j', 'f', 'h'}}, + vertex{'h', {'j', 'g', 'f', 'e', 'i', 'a'}}, + vertex{'i', {'e', 'a', 'h'}}, + vertex{'j', {'a', 'b', 'c', 'f', 'g', 'h'}}, +}; + +void calculate_ordering() +{ + +}