fix orientation

This commit is contained in:
2020-01-27 18:16:21 -05:00
parent 2c27de54d3
commit 53aa778446
5 changed files with 27 additions and 24 deletions

View File

@@ -6,27 +6,27 @@
#include <geometry.hpp>
#include <iostream>
int main () {
auto g = tc::schlafli({3,2});
int main() {
auto g = tc::schlafli({3, 2});
GeomGen gg(g);
auto path = gg.solve().path;
//std::vector<std::string> = {"a", "b", "c"};
std::string base = "";
auto words = path.walk<std::string, std::string>(base,{"a","b","c"}, [](auto s1, auto g){return s1+g;});
auto words = path.walk<std::string, std::string>(base, {"a", "b", "c"}, [](auto s1, auto g) { return s1 + g; });
for (const auto word : words) {
std::cout << word << std::endl;
}
std::vector<int> gens = {0,1,2};
std::vector<int> gens = {0, 1, 2};
auto s = gg.triangulate(gens);
s.print();
return 0;
auto g_gens = gg.group_gens();
std::vector<int> sg_gens = {1,2};
auto ns = gg.tile(g_gens,sg_gens,s);
std::vector<int> sg_gens = {1, 2};
auto ns = gg.tile(g_gens, sg_gens, s);
std::cout << "Before: " << std::endl;
std::cout << '\t';

View File

@@ -39,20 +39,20 @@ int main() {
GeomGen mbig(big);
auto s1 = std::chrono::system_clock::now();
auto res1 = mbig.solve({0,1,2,3,4,7}, {2,4,7});
auto res1 = mbig.solve({0, 1, 2, 3, 4, 7}, {2, 4, 7});
auto e1 = std::chrono::system_clock::now();
std::chrono::duration<double> t1 = e1 - s1;
std::cout << t1.count() << ": " << res1.size() << std::endl;
auto s2 = std::chrono::system_clock::now();
auto res2 = mbig.solve({0,2,4,7,1,3}, {4,7,2});
auto res2 = mbig.solve({0, 2, 4, 7, 1, 3}, {4, 7, 2});
auto e2 = std::chrono::system_clock::now();
std::chrono::duration<double> t2 = e2 - s2;
std::cout << t2.count() << ": " << res2.size() << std::endl;
std::vector<int> gens = {0,1,2,3,4,5};
std::vector<int> gens = {0, 1, 2, 3, 4, 5};
auto s3 = std::chrono::system_clock::now();
auto res3 = mbig.triangulate(gens);
auto e3 = std::chrono::system_clock::now();

View File

@@ -241,12 +241,11 @@ struct GeomGen {
int start = sub_simps.size();
sub_simps = tile(g_gens, sg_gens, sub_simps);
for (int l = start; l < sub_simps.size(); l+=S.dim) {
S.vals.push_back(0);
for (int m = l; m < l+S.dim; m++) {
S.vals.push_back(sub_simps.vals[m]);
}
S.vals.push_back(0);
}
}
return S;
}

View File

@@ -1,12 +1,14 @@
#version 430
layout(location=0) uniform mat4 proj;
layout(location=1) uniform mat4 view;
layout(location=0) in vec4 pos;
out vec4 gpos;
out vec4 vpos;
void main() {
gpos = view * pos;
vpos = view * pos;
gl_Position = proj * vec4(vpos.xyz / (1), 1);
gl_PointSize = 5;
}

View File

@@ -27,7 +27,6 @@ float floatmod(float x, float m) {
int main(int argc, char *argv[]) {
//region init window
if (!glfwInit()) {
std::cerr << "Failed to initialize GLFW" << std::endl;
return EXIT_FAILURE;
@@ -47,7 +46,6 @@ int main(int argc, char *argv[]) {
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(0);
//endregion
std::cout << utilInfo();
@@ -66,7 +64,7 @@ int main(int argc, char *argv[]) {
utilCompileFiles(GL_VERTEX_SHADER, {"shaders/stereo-proper.vs.glsl"}),
// utilCompileFiles(GL_VERTEX_SHADER, {"shaders/ortho.vs.glsl"}),
// utilCompileFiles(GL_VERTEX_SHADER, {"shaders/stereo.vs.glsl"}),
utilCompileFiles(GL_GEOMETRY_SHADER, {"shaders/stereo-proper.gm.glsl"}),
// utilCompileFiles(GL_GEOMETRY_SHADER, {"shaders/stereo-proper.gm.glsl"}),
utilCompileFiles(GL_FRAGMENT_SHADER, {"shaders/one-color.fs.glsl"}),
// utilCompileFiles(GL_FRAGMENT_SHADER, {"shaders/w-axis-hue.fs.glsl"})
});
@@ -76,7 +74,7 @@ int main(int argc, char *argv[]) {
exit(EXIT_FAILURE);
}
auto group = tc::group::H(4);
auto group = tc::group::H(3);
// auto group = tc::group::B(5);
// auto group = tc::group::A(5);
GeomGen gg(group);
@@ -101,8 +99,10 @@ int main(int argc, char *argv[]) {
std::vector<GLuint> edge_ibo;
auto g_gens = gg.group_gens();
for (const auto i : g_gens) {
std::vector<int> sg_gens = {i};
GLenum mode = GL_TRIANGLES;
{
std::vector<int> sg_gens = {0, 1};
const auto data = gg.tile(g_gens, sg_gens, gg.triangulate(sg_gens)).vals;
edge_count.push_back(data.size());
@@ -147,6 +147,8 @@ int main(int argc, char *argv[]) {
glEnable(GL_PROGRAM_POINT_SIZE);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
//region uniforms
auto aspect = (float) width / (float) height;
@@ -171,15 +173,15 @@ int main(int argc, char *argv[]) {
auto view = glm::identity<glm::mat4>();
view *= utilRotate(0, 1, st * ts[0]);
view *= utilRotate(0, 2, st * ts[1]);
view *= utilRotate(0, 3, st * ts[2]);
// view *= utilRotate(0, 3, st * ts[2]);
view *= utilRotate(1, 2, st * ts[3]);
view *= utilRotate(1, 3, st * ts[4]);
view *= utilRotate(2, 3, st * ts[5]);
// view *= utilRotate(1, 3, st * ts[4]);
// view *= utilRotate(2, 3, st * ts[5]);
glUniformMatrix4fv(1, 1, false, glm::value_ptr(view));
//endregion
glUniform3f(2, 1.0f, 1.0f, 1.0f);
glDrawArrays(GL_POINTS, 0, points.size());
// glDrawArrays(GL_POINTS, 0, points.size());
glUniform3f(2, 1.0f, 1.0f, 1.0f);
for (int i = 0; i < group.ngens; ++i) {
@@ -187,7 +189,7 @@ int main(int argc, char *argv[]) {
auto count = edge_count[i];
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
glDrawElements(GL_LINES, count, GL_UNSIGNED_INT, nullptr);
glDrawElements(mode, count, GL_UNSIGNED_INT, nullptr);
}
glfwSwapBuffers(window);