第一次上传
This commit is contained in:
18
PublicFunctions/Basic.cpp
Normal file
18
PublicFunctions/Basic.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "Basic.h"
|
||||
/**
|
||||
* @brief map 映射函数,把x的值,映射到out_min到out_max的范围内
|
||||
* @param x 需要映射的值
|
||||
* @param in_min x有可能的最小值
|
||||
* @param in_max x有可能的最大值
|
||||
* @param out_min 输出的最小值
|
||||
* @param out_max 输出的最大值
|
||||
* @return 映射结果
|
||||
*/
|
||||
M_d64 map(M_d64 x, M_d64 in_min, M_d64 in_max, M_d64 out_min, M_d64 out_max) {
|
||||
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||
}
|
||||
void Sleep(M_u16 msec){
|
||||
QTime _Timer = QTime::currentTime().addMSecs(msec);
|
||||
while( QTime::currentTime() < _Timer )
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
}
|
||||
Reference in New Issue
Block a user