Improve math module (#396)
* Improve math module - Mark almost everything constexpr - Equality (a == b) is now exact, down to the bit level. If you want approximate equality use the new ApproxEqual method/static method - Rename Nz::Extend to Nz::Extent - Removed Make[] and Set[] methods in favor of their static counterpart and operator=
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
namespace Nz
|
||||
{
|
||||
template<typename T>
|
||||
PidController<T>::PidController(float p, float i, float d) :
|
||||
constexpr PidController<T>::PidController(float p, float i, float d) :
|
||||
m_lastError(0),
|
||||
m_integral(0),
|
||||
m_dFactor(d),
|
||||
@@ -17,7 +17,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T PidController<T>::Update(const T& currentError, float elapsedTime)
|
||||
constexpr T PidController<T>::Update(const T& currentError, float elapsedTime)
|
||||
{
|
||||
m_integral += currentError * elapsedTime;
|
||||
T deriv = (currentError - m_lastError) / elapsedTime;
|
||||
|
||||
Reference in New Issue
Block a user