Main Page   Class List   Class Members  

  • Main Page
  • User's Guide
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

sdk/extensions/authoring/source/VHACD/inc/btMinMax.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans  http://continuousphysics.com/Bullet/
00003 
00004 This software is provided 'as-is', without any express or implied warranty.
00005 In no event will the authors be held liable for any damages arising from the use of this software.
00006 Permission is granted to anyone to use this software for any purpose, 
00007 including commercial applications, and to alter it and redistribute it freely, 
00008 subject to the following restrictions:
00009 
00010 1. 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.
00011 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00012 3. This notice may not be removed or altered from any source distribution.
00013 */
00014 
00015 #ifndef BT_GEN_MINMAX_H
00016 #define BT_GEN_MINMAX_H
00017 
00018 #include "btScalar.h"
00019 
00020 template <class T>
00021 SIMD_FORCE_INLINE const T& btMin(const T& a, const T& b)
00022 {
00023     return a < b ? a : b;
00024 }
00025 
00026 template <class T>
00027 SIMD_FORCE_INLINE const T& btMax(const T& a, const T& b)
00028 {
00029     return a > b ? a : b;
00030 }
00031 
00032 template <class T>
00033 SIMD_FORCE_INLINE const T& btClamped(const T& a, const T& lb, const T& ub)
00034 {
00035     return a < lb ? lb : (ub < a ? ub : a);
00036 }
00037 
00038 template <class T>
00039 SIMD_FORCE_INLINE void btSetMin(T& a, const T& b)
00040 {
00041     if (b < a) {
00042         a = b;
00043     }
00044 }
00045 
00046 template <class T>
00047 SIMD_FORCE_INLINE void btSetMax(T& a, const T& b)
00048 {
00049     if (a < b) {
00050         a = b;
00051     }
00052 }
00053 
00054 template <class T>
00055 SIMD_FORCE_INLINE void btClamp(T& a, const T& lb, const T& ub)
00056 {
00057     if (a < lb) {
00058         a = lb;
00059     }
00060     else if (ub < a) {
00061         a = ub;
00062     }
00063 }
00064 
00065 #endif //BT_GEN_MINMAX_H
Copyright © 2015-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com