optimize vertex generation; break edge/face generation

This commit is contained in:
2019-09-19 23:31:53 -04:00
parent 649cec0a9d
commit 583f6fef71
8 changed files with 422 additions and 659 deletions

View File

@@ -2,6 +2,31 @@
#include <vector>
#include <glm/glm.hpp>
#include "coxeter.hpp"
#include <cmath>
std::vector<glm::vec4> mirror(const Mults &mults);
#include "coxeter.hpp"
#include "numeric.hpp"
template<int NGENS>
std::vector<glm::vec4> mirror(const Mults<NGENS> &mults) {
std::vector<glm::vec4> mirrors{};
for (int p = 0; p < NGENS; ++p) {
glm::vec4 vp{};
for (int m = 0; m < p; ++m) {
glm::vec4 vq = mirrors[m];
vp[m] = (cos(M_PI / mults.get(p, m)) - dot(m, vp, vq)) / vq[m];
}
vp[p] = std::sqrt(1 - glm::dot(vp, vp));
for (const auto &v : mirrors) {
if (glm::dot(vp, v) > 0) {
vp *= -1;
break;
}
}
mirrors.push_back(round(vp, 15));
}
return mirrors;
}