Fixed error: comparing floating point with == or != is unsafe

This commit is contained in:
Groove 2018-07-28 21:35:59 +02:00
parent b0f06b31a4
commit 2e3fc5da83
3 changed files with 7 additions and 4 deletions

View File

@ -14,8 +14,10 @@
#pragma once
// Dependency:
#include "../glm.hpp"
#include "../gtx/transform.hpp"
#include "../gtc/epsilon.hpp"
#include "../ext/vector_relational.hpp"
#include "../glm.hpp"
#ifndef GLM_ENABLE_EXPERIMENTAL
# error "GLM: GLM_GTX_rotate_vector is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."

View File

@ -177,8 +177,8 @@ namespace glm
vec<3, T, Q> const& Up
)
{
if(all(equal(Normal, Up)))
return mat<4, 4, T, Q>(T(1));
if(all(equal(Normal, Up, epsilon<T>())))
return mat<4, 4, T, Q>(static_cast<T>(1));
vec<3, T, Q> RotationAxis = cross(Up, Normal);
T Angle = acos(dot(Normal, Up));

View File

@ -1,6 +1,7 @@
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtc/constants.hpp>
#include <glm/gtx/rotate_vector.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/ext/vector_relational.hpp>
int test_rotate()
{