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

master
Groove ago%!(EXTRA string=7 years)
parent b0f06b31a4
commit 2e3fc5da83
  1. 4
      glm/gtx/rotate_vector.hpp
  2. 4
      glm/gtx/rotate_vector.inl
  3. 3
      test/gtx/gtx_rotate_vector.cpp

@ -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."

@ -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));

@ -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()
{

Loading…
Cancel
Save