tf2 rolling
tf2 maintains the relationship between coordinate frames in a tree structure buffered in time, and lets the user transform points, vectors, etc between any two coordinate frames at any desired point in time.
Loading...
Searching...
No Matches
MinMax.hpp
Go to the documentation of this file.
1/*
2Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/
3
4This software is provided 'as-is', without any express or implied warranty.
5In no event will the authors be held liable for any damages arising from the use of this software.
6Permission is granted to anyone to use this software for any purpose,
7including commercial applications, and to alter it and redistribute it freely,
8subject to the following restrictions:
9
101. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
112. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
123. This notice may not be removed or altered from any source distribution.
13*/
14
15
16
17#ifndef TF2__LINEARMATH__MINMAX_HPP_
18#define TF2__LINEARMATH__MINMAX_HPP_
19
20#include "Scalar.hpp"
21
22template <class T>
23TF2SIMD_FORCE_INLINE const T& tf2Min(const T& a, const T& b)
24{
25 return a < b ? a : b ;
26}
27
28template <class T>
29TF2SIMD_FORCE_INLINE const T& tf2Max(const T& a, const T& b)
30{
31 return a > b ? a : b;
32}
33
34template <class T>
35TF2SIMD_FORCE_INLINE const T& GEN_clamped(const T& a, const T& lb, const T& ub)
36{
37 return a < lb ? lb : (ub < a ? ub : a);
38}
39
40template <class T>
41TF2SIMD_FORCE_INLINE void tf2SetMin(T& a, const T& b)
42{
43 if (b < a)
44 {
45 a = b;
46 }
47}
48
49template <class T>
50TF2SIMD_FORCE_INLINE void tf2SetMax(T& a, const T& b)
51{
52 if (a < b)
53 {
54 a = b;
55 }
56}
57
58template <class T>
59TF2SIMD_FORCE_INLINE void GEN_clamp(T& a, const T& lb, const T& ub)
60{
61 if (a < lb)
62 {
63 a = lb;
64 }
65 else if (ub < a)
66 {
67 a = ub;
68 }
69}
70
71#endif // TF2__LINEARMATH__MINMAX_HPP_
const T & tf2Min(const T &a, const T &b)
Definition MinMax.hpp:23
void tf2SetMax(T &a, const T &b)
Definition MinMax.hpp:50
const T & GEN_clamped(const T &a, const T &lb, const T &ub)
Definition MinMax.hpp:35
void GEN_clamp(T &a, const T &lb, const T &ub)
Definition MinMax.hpp:59
const T & tf2Max(const T &a, const T &b)
Definition MinMax.hpp:29
void tf2SetMin(T &a, const T &b)
Definition MinMax.hpp:41
#define TF2SIMD_FORCE_INLINE
Definition Scalar.hpp:129