include
twist_mux
utils.h
Go to the documentation of this file.
1
/*********************************************************************
2
* Software License Agreement (CC BY-NC-SA 4.0 License)
3
*
4
* Copyright (c) 2014, PAL Robotics, S.L.
5
* All rights reserved.
6
*
7
* This work is licensed under the Creative Commons
8
* Attribution-NonCommercial-ShareAlike 4.0 International License.
9
*
10
* To view a copy of this license, visit
11
* http://creativecommons.org/licenses/by-nc-sa/4.0/
12
* or send a letter to
13
* Creative Commons, 444 Castro Street, Suite 900,
14
* Mountain View, California, 94041, USA.
15
*********************************************************************/
16
17
/*
18
* @author Enrique Fernandez
19
* @author Siegfried Gevatter
20
*/
21
22
#ifndef UTILS_H
23
#define UTILS_H
24
25
// This could be taken from #include <boost/algorithm/clamp.hpp>
26
// but it seems that all versions of Boost have it.
27
35
template
<
typename
T>
36
static
T
clamp
(T x, T min, T max)
37
{
38
if
( x < min) x = min;
39
else
if
(max < x) x = max;
40
return
x;
41
}
42
43
#endif // UTILS_H
44
clamp
static T clamp(T x, T min, T max)
Clamp a value to the range [min, max].
Definition:
utils.h:36
twist_mux
Author(s): Enrique Fernandez
, Siegfried-A. Gevatter Pujals
autogenerated on Wed Oct 26 2022 02:18:09