Skip to content

Commit

Permalink
Fix GTX_norm cyclic include
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe-lunarg committed Mar 5, 2024
1 parent 49942a6 commit 2e4f01a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
1 change: 0 additions & 1 deletion glm/gtx/norm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

// Dependency:
#include "../geometric.hpp"
#include "../gtx/quaternion.hpp"
#include "../gtx/component_wise.hpp"

#ifndef GLM_ENABLE_EXPERIMENTAL
Expand Down
28 changes: 16 additions & 12 deletions test/gtx/gtx_norm.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/norm.hpp>
#include <glm/ext/scalar_relational.hpp>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>

static int test_lMaxNorm()
{
int Error(0);

{
float norm = glm::lMaxNorm(glm::vec3(-1, -2, -3));
Error += glm::epsilonEqual(norm, 3.f, 0.00001f) ? 0 : 1;
Error += glm::equal(norm, 3.f, 0.00001f) ? 0 : 1;
}

{
float norm = glm::lMaxNorm(glm::vec3(2, 3, 1));
Error += glm::epsilonEqual(norm, 3.f, 0.00001f) ? 0 : 1;
Error += glm::equal(norm, 3.f, 0.00001f) ? 0 : 1;
}

return Error;
Expand All @@ -26,44 +30,44 @@ static int test_lxNorm()
unsigned int depth_1 = 1;
float normA = glm::lxNorm(glm::vec3(2, 3, 1), depth_1);
float normB = glm::l1Norm(glm::vec3(2, 3, 1));
Error += glm::epsilonEqual(normA, normB, 0.00001f) ? 0 : 1;
Error += glm::epsilonEqual(normA, 6.f, 0.00001f) ? 0 : 1;
Error += glm::equal(normA, normB, 0.00001f) ? 0 : 1;
Error += glm::equal(normA, 6.f, 0.00001f) ? 0 : 1;
}

{
unsigned int depth_1 = 1;
float normA = glm::lxNorm(glm::vec3(-1, -2, -3), depth_1);
float normB = glm::l1Norm(glm::vec3(-1, -2, -3));
Error += glm::epsilonEqual(normA, normB, 0.00001f) ? 0 : 1;
Error += glm::epsilonEqual(normA, 6.f, 0.00001f) ? 0 : 1;
Error += glm::equal(normA, normB, 0.00001f) ? 0 : 1;
Error += glm::equal(normA, 6.f, 0.00001f) ? 0 : 1;
}

{
unsigned int depth_2 = 2;
float normA = glm::lxNorm(glm::vec3(2, 3, 1), depth_2);
float normB = glm::l2Norm(glm::vec3(2, 3, 1));
Error += glm::epsilonEqual(normA, normB, 0.00001f) ? 0 : 1;
Error += glm::epsilonEqual(normA, 3.741657387f, 0.00001f) ? 0 : 1;
Error += glm::equal(normA, normB, 0.00001f) ? 0 : 1;
Error += glm::equal(normA, 3.741657387f, 0.00001f) ? 0 : 1;
}

{
unsigned int depth_2 = 2;
float normA = glm::lxNorm(glm::vec3(-1, -2, -3), depth_2);
float normB = glm::l2Norm(glm::vec3(-1, -2, -3));
Error += glm::epsilonEqual(normA, normB, 0.00001f) ? 0 : 1;
Error += glm::epsilonEqual(normA, 3.741657387f, 0.00001f) ? 0 : 1;
Error += glm::equal(normA, normB, 0.00001f) ? 0 : 1;
Error += glm::equal(normA, 3.741657387f, 0.00001f) ? 0 : 1;
}

{
unsigned int oddDepth = 3;
float norm = glm::lxNorm(glm::vec3(2, 3, 1), oddDepth);
Error += glm::epsilonEqual(norm, 3.301927249f, 0.00001f) ? 0 : 1;
Error += glm::equal(norm, 3.301927249f, 0.00001f) ? 0 : 1;
}

{
unsigned int oddDepth = 3;
float norm = glm::lxNorm(glm::vec3(-1, -2, -3), oddDepth);
Error += glm::epsilonEqual(norm, 3.301927249f, 0.00001f) ? 0 : 1;
Error += glm::equal(norm, 3.301927249f, 0.00001f) ? 0 : 1;
}

return Error;
Expand Down

0 comments on commit 2e4f01a

Please sign in to comment.