Finality Engine
Loading...
Searching...
No Matches
VisibilityMath.h
Go to the documentation of this file.
1
6#pragma once
7#include <glm/glm.hpp>
8#include <algorithm>
9#include <cmath>
10
11namespace FINALITY
12{
13 inline float ConservativeScale(const glm::mat4& transform)
14 {
15 float oneNorm = 0, infinityNorm = 0;
16 for (int i = 0; i < 3; ++i)
17 {
18 float column = 0, row = 0;
19 for (int j = 0; j < 3; ++j)
20 {
21 column += std::abs(transform[i][j]);
22 row += std::abs(transform[j][i]);
23 }
24 oneNorm = std::max(oneNorm,column);
25 infinityNorm = std::max(infinityNorm,row);
26 }
27 return std::sqrt(oneNorm * infinityNorm);
28 }
29}
float ConservativeScale(const glm::mat4 &transform)