rows working correctly

This commit is contained in:
2019-09-12 19:30:26 -04:00
parent 1026a2c791
commit 0963c445d3
3 changed files with 73 additions and 9 deletions

View File

@@ -15,3 +15,5 @@ add_custom_command(
${CMAKE_CURRENT_SOURCE_DIR}/src/shaders
${CMAKE_CURRENT_BINARY_DIR}/shaders
)
add_executable(coxeter src/tc.cpp)

View File

@@ -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);

62
cosets/src/tc.cpp Normal file
View File

@@ -0,0 +1,62 @@
#include <iostream>
#include <vector>
struct Row {
std::vector<int>::const_iterator l;
std::vector<int>::const_iterator r;
int from;
int to;
Row(const std::vector<int> &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<std::vector<int>> ids{
{0, 0},
{1, 1},
{0, 1, 0, 1, 0, 1}
};
std::vector<int> &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<std::vector<char>> 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;
}