Photon Common Library 2.0.0-beta
A physically based renderer.
|
Basic math utilities. For more math functions, see Engine
project's math.h
.
More...
#include "Common/assertion.h"
#include <type_traits>
#include <bit>
#include <concepts>
#include <limits>
Go to the source code of this file.
Namespaces | |
namespace | ph |
The root for all renderer implementations. | |
namespace | ph::math |
Functions | |
template<typename T > | |
constexpr bool | ph::math::is_power_of_2 (const T value) |
Determines whether value is a power-of-2 number. | |
template<std::size_t BASE, typename T > | |
constexpr bool | ph::math::is_power_of (const T value) |
Determines whether value is a power-of-BASE number. Checks the equality BASE^n == value , where n is an integer. | |
template<std::integral T> | |
T | ph::math::ceil_div (const T numerator, const T denominator) |
Divide numerator by denominator and round up to integer. Both inputs must be positive integer. Specifically, numerator >= 0 and denominator > 0. | |
template<std::integral T> | |
T | ph::math::next_multiple (const T value, const T multiple) |
Get the next number that is an integer multiple of multiple . Specifically, get the minimum number x = C * multiple >= value where C is an integer >= 0. Currently supports positive integers only. | |
template<std::integral T> | |
T | ph::math::next_power_of_2_multiple (const T value, const T multiple) |
Same as next_multiple(T, T) except that multiple must be a power of 2 number. | |
Basic math utilities. For more math functions, see Engine
project's math.h
.