slew_rate: pass vector by const ref

This commit is contained in:
bresch 2024-03-07 15:20:18 +01:00 committed by Silvan Fuhrer
parent d32680f87f
commit bc9df1a2d4
1 changed files with 4 additions and 4 deletions

View File

@ -56,13 +56,13 @@ public:
* Set maximum rate of change for the value * Set maximum rate of change for the value
* @param slew_rate maximum rate of change * @param slew_rate maximum rate of change
*/ */
void setSlewRate(const Type slew_rate) { _slew_rate = slew_rate; } void setSlewRate(const Type &slew_rate) { _slew_rate = slew_rate; }
/** /**
* Set value ignoring slew rate for initialization purpose * Set value ignoring slew rate for initialization purpose
* @param value new applied value * @param value new applied value
*/ */
void setForcedValue(const Type value) { _value = value; } void setForcedValue(const Type &value) { _value = value; }
/** /**
* Get value from last update of the slew rate * Get value from last update of the slew rate
@ -76,7 +76,7 @@ public:
* @param deltatime time in seconds since last update * @param deltatime time in seconds since last update
* @return actual value that complies with the slew rate * @return actual value that complies with the slew rate
*/ */
Type update(const Type new_value, const float deltatime) Type update(const Type &new_value, const float deltatime)
{ {
// Limit the rate of change of the value // Limit the rate of change of the value
const Type dvalue_desired = new_value - _value; const Type dvalue_desired = new_value - _value;
@ -92,7 +92,7 @@ protected:
}; };
template<> template<>
inline matrix::Vector3f SlewRate<matrix::Vector3f>::update(const matrix::Vector3f new_value, const float deltatime) inline matrix::Vector3f SlewRate<matrix::Vector3f>::update(const matrix::Vector3f &new_value, const float deltatime)
{ {
// Limit the rate of change of the value // Limit the rate of change of the value
const matrix::Vector3f dvalue_desired = new_value - _value; const matrix::Vector3f dvalue_desired = new_value - _value;