-
Created by Unknown User (jarisav) on 20.3.2013
You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
Version 1
Next »
#include "srmath.h"
Srmath::Srmath(QObject *parent) :
QObject(parent)
{
}
double Srmath::Saturate(double in,double limit)
{
if(in>limit){
return limit;
}
else if(in<-limit){
return -limit;
}
else return in;
}
bool Srmath::AbsSmaller(double input,double limit)
{
if(Abs(input)<Abs(limit))return true;
else return false;
}
bool Srmath::AbsLarger(double input,double limit)
{
if(Abs(input)>Abs(limit))return true;
else return false;
}
// molempien arvojen oltava samanmerkkisia, ehto toteutuu kun tullaan nollasta ylä- tai alarajalle
bool Srmath::AbsLargerAndSameSign(double input,double limit)
{
return (Abs(input) > Abs(limit))&&((input*limit)>0);
}
//! jos tulo on absoluuttisesti suurempi kuin raja, funktio nostaa rajaa
double Srmath::RaiseAbsLimit(double input,double *limit)
{
if(Abs(input)>Abs(*limit)){
*limit=Abs(input);
}
return *limit;
}
double Srmath::LowerAbsLimit(double input,double *limit)
{
if(Abs(input)<Abs(*limit)){
*limit=Abs(input);
}
return *limit;
}
You must log in to comment.