25 lines
367 B
C++
Executable File
25 lines
367 B
C++
Executable File
//
|
|
// Math.hpp
|
|
// amoeba
|
|
//
|
|
// Created by Timothy Prepscius on 12/30/16.
|
|
// Copyright © 2016 Timothy Prepscius. All rights reserved.
|
|
//
|
|
|
|
#pragma once
|
|
|
|
namespace tjp::core::math {
|
|
|
|
template<typename V, typename L, typename R>
|
|
inline V clamp(const V &v, const L &l, const R &r)
|
|
{
|
|
if (v < l)
|
|
return (V)l;
|
|
if (v > r)
|
|
return (V)r;
|
|
return v;
|
|
}
|
|
|
|
} // namespace
|
|
|