You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#pragma once |
|
|
|
#include "math.hpp" |
|
#include <math.h> |
|
|
|
|
|
namespace matrix |
|
{ |
|
|
|
template<typename Type> |
|
Type wrap_pi(Type x) |
|
{ |
|
if (!isfinite(Type(x))) { |
|
return x; |
|
} |
|
|
|
while (x >= (Type)M_PI) { |
|
x -= (Type)(2.0 * M_PI); |
|
|
|
} |
|
|
|
while (x < (Type)(-M_PI)) { |
|
x += (Type)(2.0 * M_PI); |
|
|
|
} |
|
|
|
return x; |
|
} |
|
|
|
|
|
};
|
|
|