quaternion: assert angles are less than a full rotation
This commit is contained in:
parent
0624a3ad00
commit
16f460a2d2
@ -23,6 +23,8 @@ template <typename T>
|
||||
quaternion<T>
|
||||
quaternion<T>::angle_axis (const T radians, const vector<3,T> axis)
|
||||
{
|
||||
CHECK (radians < cruft::pi<T> * 2);
|
||||
CHECK (radians > -cruft::pi<T> * 2);
|
||||
CHECK (is_normalised (axis));
|
||||
|
||||
auto w = std::cos (radians / 2);
|
||||
@ -39,6 +41,8 @@ template <typename T>
|
||||
quaternion<T>
|
||||
quaternion<T>::from_euler (vector<3,T> angles)
|
||||
{
|
||||
CHECK (all (angles > -cruft::pi<T> * 2));
|
||||
CHECK (all (angles < cruft::pi<T> * 2));
|
||||
auto half = angles / 2;
|
||||
|
||||
auto c = std::cos (half);
|
||||
|
Loading…
Reference in New Issue
Block a user