mirror of
https://github.com/g-truc/glm.git
synced 2024-11-14 06:04:34 +00:00
Merge branch '0.9.2' into 0.9.3
This commit is contained in:
commit
cda930bb7a
@ -50,7 +50,7 @@ namespace rotate_vector
|
|||||||
T const & angle,
|
T const & angle,
|
||||||
detail::tvec3<T> const & normal)
|
detail::tvec3<T> const & normal)
|
||||||
{
|
{
|
||||||
return glm::gtx::transform::::rotate(angle, normal) * v;
|
return glm::gtx::transform::rotate(angle, normal) * v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -141,7 +141,7 @@ namespace rotate_vector
|
|||||||
|
|
||||||
detail::tvec3<T> RotationAxis = cross(Up, Normal);
|
detail::tvec3<T> RotationAxis = cross(Up, Normal);
|
||||||
T Angle = degrees(acos(dot(Normal, Up)));
|
T Angle = degrees(acos(dot(Normal, Up)));
|
||||||
return rotate(Angle, RotationAxis);
|
return glm::gtx::transform::rotate(Angle, RotationAxis);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace rotate_vector
|
}//namespace rotate_vector
|
||||||
|
@ -55,22 +55,6 @@ GLM_FUNC_QUALIFIER valType orientedAngle
|
|||||||
return Angle;
|
return Angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \todo epsilon is hard coded to 0.01
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER valType orientedAngle
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & x,
|
|
||||||
detail::tvec4<valType> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
valType Angle = degrees(acos(dot(x, y)));
|
|
||||||
detail::tvec4<valType> TransformedVector = glm::gtx::rotate_vector::rotate(y, Angle, glm::core::function::geometric::cross(x, y));
|
|
||||||
if(all(equalEpsilon(x, TransformedVector, valType(0.01))))
|
|
||||||
return -Angle;
|
|
||||||
else
|
|
||||||
return Angle;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
GLM_FUNC_QUALIFIER valType orientedAngleFromRef
|
GLM_FUNC_QUALIFIER valType orientedAngleFromRef
|
||||||
(
|
(
|
||||||
@ -103,22 +87,6 @@ GLM_FUNC_QUALIFIER valType orientedAngleFromRef
|
|||||||
return glm::degrees(Angle);
|
return glm::degrees(Angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER valType orientedAngleFromRef
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & x,
|
|
||||||
detail::tvec4<valType> const & y,
|
|
||||||
detail::tvec3<valType> const & ref
|
|
||||||
)
|
|
||||||
{
|
|
||||||
valType Angle = glm::acos(glm::dot(x, y));
|
|
||||||
|
|
||||||
if(glm::dot(ref, glm::cross(detail::tvec3<valType>(x), detail::tvec3<valType>(y))) < valType(0))
|
|
||||||
return -glm::degrees(Angle);
|
|
||||||
else
|
|
||||||
return glm::degrees(Angle);
|
|
||||||
}
|
|
||||||
|
|
||||||
}//namespace vector_angle
|
}//namespace vector_angle
|
||||||
}//namespace gtx
|
}//namespace gtx
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -38,11 +38,6 @@ int test_vector_angle_orientedAngle()
|
|||||||
float AngleD = glm::orientedAngle(glm::vec3(0, 1, 0), glm::normalize(glm::vec3(1, 1, 0)));
|
float AngleD = glm::orientedAngle(glm::vec3(0, 1, 0), glm::normalize(glm::vec3(1, 1, 0)));
|
||||||
Error += AngleD == -45.f ? 0 : 1;
|
Error += AngleD == -45.f ? 0 : 1;
|
||||||
|
|
||||||
float AngleE = glm::orientedAngle(glm::vec4(1, 0, 0, 0), glm::normalize(glm::vec4(1, 1, 0, 0)));
|
|
||||||
Error += AngleE == 45.f ? 0 : 1;
|
|
||||||
float AngleF = glm::orientedAngle(glm::vec4(0, 1, 0, 0), glm::normalize(glm::vec4(1, 1, 0, 0)));
|
|
||||||
Error += AngleF == -45.f ? 0 : 1;
|
|
||||||
|
|
||||||
return Error;
|
return Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user