Smooth 2D Noise Viewer
Perlin and Value Noise
Helpers.h
Go to the documentation of this file.
1
4
5// MIT License
6//
7// Copyright (c) 2022 Ian Parberry
8//
9// Permission is hereby granted, free of charge, to any person obtaining a copy
10// of this software and associated documentation files (the "Software"), to
11// deal in the Software without restriction, including without limitation the
12// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
13// sell copies of the Software, and to permit persons to whom the Software is
14// furnished to do so, subject to the following conditions:
15//
16// The above copyright notice and this permission notice shall be included in
17// all copies or substantial portions of the Software.
18//
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25// IN THE SOFTWARE.
26
27#ifndef __HELPERS_H__
28#define __HELPERS_H__
29
30#include <string>
31
32const float spline3(float);
33const float spline5(float);
34
35const float lerp(float, float, float);
36const float clamp(float, float, float);
37
38std::wstring to_wstring_f(float x, size_t n);
39const bool isPowerOf2(size_t n);
40
41#endif //__HELPERS_H__
const float clamp(float, float, float)
Clamp between two values.
Definition: Helpers.cpp:67
const bool isPowerOf2(size_t n)
Power of 2 test.
Definition: Helpers.cpp:94
const float lerp(float, float, float)
Linear interpolation.
Definition: Helpers.cpp:56
std::wstring to_wstring_f(float x, size_t n)
Float to fixed precision wstring.
Definition: Helpers.cpp:76
const float spline3(float)
Cubic spline.
Definition: Helpers.cpp:36
const float spline5(float)
Quintic spline.
Definition: Helpers.cpp:45