From 0963c445d3c521a25de21df62f4bf574a1eac9ad Mon Sep 17 00:00:00 2001 From: David Allemang Date: Thu, 12 Sep 2019 19:30:26 -0400 Subject: [PATCH] rows working correctly --- cosets/CMakeLists.txt | 2 ++ cosets/src/main.cpp | 18 ++++++------- cosets/src/tc.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 cosets/src/tc.cpp diff --git a/cosets/CMakeLists.txt b/cosets/CMakeLists.txt index dfa29e2..c8cf75b 100644 --- a/cosets/CMakeLists.txt +++ b/cosets/CMakeLists.txt @@ -15,3 +15,5 @@ add_custom_command( ${CMAKE_CURRENT_SOURCE_DIR}/src/shaders ${CMAKE_CURRENT_BINARY_DIR}/shaders ) + +add_executable(coxeter src/tc.cpp) diff --git a/cosets/src/main.cpp b/cosets/src/main.cpp index 8531459..de0e007 100644 --- a/cosets/src/main.cpp +++ b/cosets/src/main.cpp @@ -29,16 +29,16 @@ public: program = build_program("main", vs, fs); - float verts_data[4 * VERTS_N]{ - +.5f, +.5f, 0.f, 0.f, - +.5f, -.5f, 0.f, 0.f, - -.5f, -.5f, 0.f, -.1f, - -.5f, +.5f, 0.f, -.1f, + glm::vec4 verts_data[VERTS_N]{ + {+0.5, +0.5, +0.5, +0.0}, + {+0.5, -0.5, +0.5, +0.0}, + {-0.5, -0.5, +0.5, +0.0}, + {-0.5, +0.5, +0.5, +0.0}, - +.5f, +.5f, 0.f, .1f, - +.5f, -.5f, 0.f, .1f, - -.5f, -.5f, 0.2f, .0f, - -.5f, +.5f, 0.2f, .0f, + {+0.5, +0.5, +0.5, -0.5}, + {+0.5, -0.5, +0.5, -0.5}, + {-0.5, -0.5, +0.5, +0.5}, + {-0.5, +0.5, +0.5, +0.5}, }; glGenBuffers(1, &verts); diff --git a/cosets/src/tc.cpp b/cosets/src/tc.cpp new file mode 100644 index 0000000..fa2b5b7 --- /dev/null +++ b/cosets/src/tc.cpp @@ -0,0 +1,62 @@ +#include +#include + +struct Row { + std::vector::const_iterator l; + std::vector::const_iterator r; + + int from; + int to; + + Row(const std::vector &vec, int from, int to) { + this->l = vec.begin(); + this->r = vec.end(); + this->from = from; + this->to = to; + } +}; + +std::ostream &operator<<(std::ostream &out, const Row &row) { + out << "[ " << row.from << " | "; + auto it = row.l; + while (it != row.r) { + out << *it << " "; + it++; + } + out << "| " << row.to << " ]"; + return out; +} + +int main(int argc, char *argv[]) { + int gens = 2; + std::vector> ids{ + {0, 0}, + {1, 1}, + {0, 1, 0, 1, 0, 1} + }; + + std::vector &id = ids[2]; + Row row(id, 8, 9); + + std::cout << row << std::endl; + + row.l++; + row.from = 6; + + std::cout << row << std::endl; + +// std::vector> vecs{ +// {'a', 'o', 'e', 'u'}, +// {'p'}, +// {'q', 'j', 'k'}, +// }; +// +// for (const auto& vec : vecs) { +// for (const auto& ch : vec) { +// std::cout << ch; +// } +// std::cout << std::endl; +// } + + return 0; +} \ No newline at end of file