-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdodec.h
More file actions
127 lines (119 loc) · 4.08 KB
/
Copy pathdodec.h
File metadata and controls
127 lines (119 loc) · 4.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#pragma once
//#include <iostream>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
//#include <vector>
//#include <cmath>
using namespace std;
using namespace glm;
//GLfloat incenter = RADIUS/4 * sqrt(10 * (3 + sqrt(5)));
//glm::mat3 rotations[5] = {
// glm::mat3(0,-1,0,1,0,0,0,0,1), //90 about z
// glm::mat3(-1,0,0,0,-1,0,0,0,1), //180 about z
// glm::mat3(1,0,0,0,0,-1,0,1,0), //90 about x
// glm::mat3(-1/3,2/3,2/3,2/3,-1/3,2/3,2/3,2/3,-1/3), //120 about diagonal 1,1,1
// glm::mat3(0,0,1,0,-1,0,1,0,0)// 180 about 1,0,1
//};
void GeneratePentagon(GLfloat*& vertices, int offset, GLfloat face_offset);
//void GenerateHardPentagon(GLfloat*& vertices, int offset) {
// int pos = offset;
// vertices[pos] = -0.27639320;
// vertices[pos+1] = 0.17082039;
// vertices[pos+2] = 0.0;
//
// vertices[pos+3] = -1.0;
// vertices[pos+4] = -1.0;
// vertices[pos+5] = -1.0;
//
// vertices[pos+6] = -1.0;
// vertices[pos+7] = -1.0;
// vertices[pos+8] = 1.0;
//
// vertices[pos+9] = 0.0;
// vertices[pos+10] = 0.61803399;
// vertices[pos+11] = 1.61803399;
//
// vertices[pos+12] = 0.61803399;
// vertices[pos+13] = 1.61803399;
// vertices[pos+14] = 0.0;
//
// vertices[pos+15] = 0.0;
// vertices[pos+16] = 0.61803399;
// vertices[pos+17] = -1.61803399;
//
// vertices[pos+18] = -1.0;
// vertices[pos+19] = -1.0;
// vertices[pos+20] = -1.0;
//
//}
//void GeneratePentagon(GLfloat*& vertices, int offset){
// int i = offset;
// //TODO: change these into vec3s or smth like that
//
// //Using some points to make center the math is kinda wack idk man
// vec3 p1 = { -1.0,-1.0,-1.0};
// vec3 p2 = { -1.0,-1.0,1.0};
// vec3 p3 = { 0.0,1.0/phi,phi};
// vec3 u = p2 - p1;
// vec3 v = p3 - p1;
// vec3 n = glm::cross(u,v) / glm::length(glm::cross(u,v));
// GLfloat plane_constant = glm::dot(n, p1);
// vec3 center = n * plane_constant;
//
// //hard coding in sample pentagon
// vertices[i++] = 0.0;//center.x;
// vertices[i++] = 0.0;//center.y;
// vertices[i++] = 0.0;//center.z;
//
// vertices[i++] = -1.0 - center.x;
// vertices[i++] = -1.0 - center.y;
// vertices[i++] = -1.0 - center.z;
//
// vertices[i++] = -1.0 - center.x;
// vertices[i++] = -1.0 - center.y;
// vertices[i++] = 1.0 - center.z;
//
// vertices[i++] = 0.0 - center.x;
// vertices[i++] = 1.0/phi - center.y;
// vertices[i++] = phi - center.z;
//
// vertices[i++] = 1.0/phi - center.x;
// vertices[i++] = phi - center.y;
// vertices[i++] = 0.0 - center.z;
//
// vertices[i++] = 0.0 - center.x;
// vertices[i++] = 1.0/phi - center.y;
// vertices[i++] = -phi - center.z;
//
// vertices[i++] = -1.0 - center.x;
// vertices[i++] = -1.0 - center.y;
// vertices[i++] = -1.0 - center.z;
//}
//void rotateNewPentagon(GLfloat*& vertices, int offset, GLfloat angle, vec3 axis){
// mat3 rotation = mat3(1.0);
// rotation[0] = cos(angle) + (axis.x * axis.x)(1 - cos(angle));
// rotation[1] = axis.x * axis.y * (1 - cos(angle)) - axis.z * sin(angle);
// rotation[2] = axis.x * axis.z * (1 - cos(angle)) + axis.y * sin(angle);
//
// rotation[3] = axis.y * axis.x * (1 - cos(angle)) + axis.z * sin(angle);
// rotation[4] = cos(angle) + (axis.y * axis.y)(1 - cos(angle));
// rotation[5] = axis.y * axis.z * (1 - cos(angle)) - axis.x * sin(angle);
//
// rotation[6] = axis.z * axis.x * (1 - cos(angle)) - axis.y * sin(angle);
// rotation[7] = axis.z * axis.y * (1 - cos(angle)) + axis.x * sin(angle);
// rotation[8] = cos(angle) + (axis.z * axis.z)(1 - cos(angle));
//
//}
//void rotateNewPentagon(GLfloat*& vertices, int offset, int rotation){
// int j = offset;
// for(int i = 0; i < 21; i+=3){
// vec3 p = {vertices[i], vertices[i+1], vertices[i+2]};
// p = rotations[rotation] * p;
// vertices[j++] = p.x ;
// vertices[j++] = p.y ;
// vertices[j++] = p.z ;
// }
//}
vec3 GetNormalizedSideVector(GLfloat*& vertices, int p1, int p2);
void RotatenewPentagon(GLfloat*& vertices, int offset, int start_offset, vec3 axis , vec3 p0);
void GenerateDodec(GLfloat*& vertices);