move glm utilities into numeric.hpp; misc cleanup

This commit is contained in:
2019-09-13 23:05:31 -04:00
parent ac072710fc
commit f0d1ac84b9
4 changed files with 23 additions and 24 deletions

View File

@@ -6,14 +6,11 @@ add_executable(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME}
PRIVATE glad glm glfw)
target_include_directories(${PROJECT_NAME}
PRIVATE include)
add_custom_command(
TARGET cosets POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/src/shaders
${CMAKE_CURRENT_BINARY_DIR}/shaders
TARGET cosets POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/src/shaders
${CMAKE_CURRENT_BINARY_DIR}/shaders
)
add_executable(coxeter src/tc.cpp)

View File

@@ -5,22 +5,7 @@
#include <glm/gtx/string_cast.hpp>
#include <iomanip>
glm::vec4 round(glm::vec4 f, int prec) {
auto dec = (float) pow(10, prec);
auto res = glm::trunc(f * dec + 0.5f) / dec;
return res;
}
template<int N>
using vecn = glm::vec<N, float, glm::defaultp>;
float dot(int n, glm::vec4 a, glm::vec4 b) {
float sum = 0;
for (int i = 0; i < n; ++i) {
sum += a[i] * b[i];
}
return sum;
}
#include "util/numeric.hpp"
template<int N>
std::vector<glm::vec4> mirror(const float (&arr)[N][N]) {

View File

@@ -98,7 +98,7 @@ struct Row {
this->to = cos;
}
bool learn(Table *table) {
[[nodiscard]] bool learn(Table *table) {
if (r - l == 0) {
return false;
}

View File

@@ -0,0 +1,17 @@
#pragma once
#include <glm/glm.hpp>
glm::vec4 round(glm::vec4 f, int prec) {
auto dec = (float) pow(10, prec);
auto res = glm::trunc(f * dec + 0.5f) / dec;
return res;
}
float dot(int n, glm::vec4 a, glm::vec4 b) {
float sum = 0;
for (int i = 0; i < n; ++i) {
sum += a[i] * b[i];
}
return sum;
}