Photon Engine 2.0.0-beta
A physically based renderer.
|
Math functions and utilities. More...
Namespaces | |
namespace | constant |
namespace | detail |
namespace | radical_inverse_detail |
namespace | spectral_data |
namespace | table |
Classes | |
class | BvhParams |
class | ColorError |
Error on the color-related functionalities. More... | |
class | DefaultSpectralSampleProps |
class | DeterministicSeeder |
Convenient thread-safe seed provider for RNGs. Do not use this for cryptography. More... | |
class | DynamicLinearTranslation |
class | IndexedKdtreeParams |
class | MathException |
General exception thrown on error related to math functionalities. More... | |
struct | Murmur3BitMixer32 |
class | Pcg32 |
PCG-32 generator. This is the pcg32 generator in O'Neill's original pcg-cpp implementation. References: [1] https://dotat.at/@/2023-06-21-pcg64-dxsm.html [2] https://github.com/imneme/pcg-c-basic [3] https://github.com/wjakob/pcg32. More... | |
class | Pcg64DXSM |
PCG-64 DXSM generator. This is the pcg_engines::cm_setseq_dxsm_128_64 generator in O'Neill's original pcg-cpp implementation. References: [1] https://dotat.at/@/2023-06-21-pcg64-dxsm.html [2] NumPy source code (numpy/numpy/random/src/pcg64/*), version: 308b348bb595bc1b86f9e4bc08be2e3ba5d4f18f. More... | |
class | Random |
Get random values from default RNG. More... | |
class | Real |
class | RigidTransform |
class | StaticAffineTransform |
class | StaticRigidTransform |
class | TAABB2D |
A 2-D Axis-Aligned Bounding Box (AABB). More... | |
class | TAABB3D |
A 3-D Axis-Aligned Bounding Box (AABB). More... | |
class | TAnalyticalIntegrator1D |
class | TArithmeticArray |
class | TArithmeticArrayBase |
class | TBasicTriangle |
Basic 3-D triangle functionalities. More... | |
class | TBinaryBvhNode |
class | TBlackmanHarris2D |
Blackman-Harris window function. A window function similar to Gaussian function in shape. It is defined over \( \left[-radius, radius\right] \) and will take on value 0 at boundaries. The peak of the function is at \( (0, 0) \). More... | |
class | TBvhBuilder |
class | TBvhInfoNode |
General BVH node packed with additional information. This node type is typically used for building other types of BVH or for algorithmic analysis. More... | |
class | TBvhItemInfo |
class | TBvhSimdComputingContext |
A SIMD computing context for BVH. Use isSupported() to check the availability of the required hardware feature. More... | |
class | TChromaticAdaptationDefinition |
Sinkhole for undefined chromatic adaptation routines. Specialize the class to provide definitions for the specified adaptation configuration. Must satisfy CChromaticAdaptationDefinition . More... | |
class | TChromaticAdaptationDefinition< EChromaticAdaptation::Bradford, T > |
class | TChromaticAdaptationDefinition< EChromaticAdaptation::VonKries, T > |
class | TChromaticAdaptationDefinition< EChromaticAdaptation::XYZScaling, T > |
Adapts by simply scale by the corresponding white points–identity CAT matrices are used. More... | |
class | TChromaticAdaptationDefinitionHelper |
class | TColorSpaceDefinition |
Sinkhole for color spaces without definition. Specialize this class to provide definitions for color space. Must satisfy CTristimulusColorSpaceDefinition or CSpectralColorSpaceDefinition . More... | |
class | TColorSpaceDefinition< EColorSpace::ACEScg, T > |
class | TColorSpaceDefinition< EColorSpace::CIE_xyY, T > |
class | TColorSpaceDefinition< EColorSpace::CIE_XYZ, T > |
class | TColorSpaceDefinition< EColorSpace::Linear_sRGB, T > |
Linear sRGB color space definitions. More... | |
class | TColorSpaceDefinition< EColorSpace::Spectral_Smits, T > |
class | TColorSpaceDefinition< EColorSpace::sRGB, T > |
class | TColorSpaceDefinitionHelper |
class | TConstant2D |
class | TDecomposedTransform |
Perform affine transformations in decomposed form. More... | |
class | TDisk |
A 2-D disk with normal facing up (0, 1, 0). More... | |
class | TFraction |
class | TGaussian2D |
class | THeavisideStep2D |
A step function in 2-D, with a specific normal direction. This is a simplified version of general Heaviside step function in 2-D. This class represents 1-D Heaviside in 2-D, dividing the xy-plane into regions of value 0 & 1 (while a general Heaviside step function in 2-D can have the discontinuity along an arbitarary 2-D contour, this class does not support that). Value along the line of discontinuity is 0.5 (for integer types, this would be 0). More... | |
class | THemisphere |
A hemisphere in 3-D space. More... | |
struct | TIndexedItemEndpoint |
class | TIndexedKdtree |
class | TIndexedKdtreeNode |
An indexed kD-tree node with compacted memory layout. More... | |
class | TIndexedPointKdtree |
class | TIndexedVector3 |
class | TLinearDepthFirstBinaryBvh |
class | TLinearDepthFirstWideBvh |
class | TLinearGradient2D |
A linearly increasing/decreasing gradient in a specific direction. Value at (0, 0) is 0. More... | |
class | TLineSegment |
Represents a line segment in space. More... | |
class | TMathFunction2D |
class | TMatrix2 |
Represents a 2x2 matrix. More... | |
class | TMatrix3 |
Represents a 3x3 matrix. More... | |
class | TMatrix4 |
Represents a 4x4 matrix. More... | |
class | TMatrixMxNBase |
A base for general M by N row-major matrices. More... | |
class | TMatrixNBase |
A base for general N dimensional row-major square matrices. More... | |
class | TMitchellNetravaliCubic2D |
Mitchell–Netravali filter function [13]. More... | |
class | TMt19937 |
Standard Mersenne Twister generator. More... | |
class | TOrthonormalBasis3 |
Represents a set of orthonormal basis vectors in 3-D space. More... | |
class | TPiecewiseLinear1D |
class | TPwcDistribution1D |
A 1-D piecewise constant distribution of floating-point type T . The sample weights can be seen as a histogram, and samples are drawn according to each column's relative heights. Each generated sample is guaranteed to have a non-zero PDF. More... | |
class | TPwcDistribution2D |
class | TQuaternion |
Represents a quaternion. More... | |
class | Transform |
class | TSampledSpectrum |
class | TSpectralColorSpaceDefinitionHelper |
class | TSpectrumBase |
Base for spectrum implementations. More... | |
class | TSphere |
A sphere in 3-D space. More... | |
class | TTriangle |
class | TTristimulusColorSpaceDefinitionHelper |
class | TTristimulusSpectrum |
class | TUniformRandomBitGenerator |
class | TUrbg32x2 |
Combining two 32-bit RNGs to form a new 64-bit RNG. If any of the input RNG is not a 32-bit type, this generator will treat it as a 32-bit RNG (e.g., by converting its generated bits to 32-bit). More... | |
class | TVector2 |
Represents a 2-D vector. More... | |
class | TVector3 |
Represents a 3-D vector. More... | |
class | TVector4 |
Represents a 4-D vector. More... | |
class | TVectorN |
class | TVectorNBase |
class | TWatertightTriangle |
class | TWideBvhNode |
Concepts | |
concept | CItemSegmentIntersectionTesterVanilla |
concept | CItemSegmentIntersectionTesterWithIndex |
concept | CItemSegmentIntersectionTester |
concept | CIndexedPointKdtreeItemStorage |
concept | CChromaticAdaptationDefinition |
concept | CSpectralSampleProps |
concept | CColorValuesInterface |
Satisfying this concept makes ImplType usable as color values. | |
concept | CRawColorValues |
Whether ColorValuesType is a raw color values type. | |
concept | CHasColorSpaceProperties |
Basic requirements for a color space definition. | |
concept | CSupportsTristimulusConversions |
Basic requirements a tristimulus color space definition must satisfy in addition to CHasColorSpaceProperties. | |
concept | CSupportsSpectralConversions |
Basic requirements a spectral color space definition must satisfy in addition to CHasColorSpaceProperties. Bound tristimulus color space: A spectral color space must choose a tristimulus color space as its binding space, which will be used by color space operations that cannot operate in the spectral space. The chosen color space is often referred to as "bound space" for simplicity. | |
concept | CTristimulusColorSpaceDefinition |
concept | CSpectralColorSpaceDefinition |
concept | CColorSpaceDefinition |
concept | CURBG |
Typedefs | |
using | ColorValue = real |
template<typename T , std::size_t N> | |
using | TRawColorValues = std::array<T, N> |
template<typename T > | |
using | TTristimulusValues = TRawColorValues<T, 3> |
template<typename T , CSpectralSampleProps SampleProps = DefaultSpectralSampleProps> | |
using | TSpectralSampleValues = TRawColorValues<T, SampleProps::NUM_SAMPLES> |
template<typename T > | |
using | TChromaticityValues = TRawColorValues<T, 2> |
using | TristimulusValues = TTristimulusValues<ColorValue> |
using | SpectralSampleValues = TSpectralSampleValues<ColorValue> |
using | ChromaticityValues = TChromaticityValues<ColorValue> |
template<EColorSpace COLOR_SPACE> | |
using | TColorSpaceDef = TColorSpaceDefinition<COLOR_SPACE, ColorValue> |
Helper alias for TColorSpaceDefinition which uses the ColorValue type. | |
using | LinearSRGBSpectrum = TTristimulusSpectrum<EColorSpace::Linear_sRGB, ColorValue> |
using | ACESSpectrum = TTristimulusSpectrum<EColorSpace::ACEScg, ColorValue> |
using | SampledSpectrum |
using | Spectrum = LinearSRGBSpectrum |
template<typename T , std::size_t N> | |
using | TRawRowVector = std::array<T, N> |
template<typename T , std::size_t M> | |
using | TRawColVector = std::array<T, M> |
template<typename T , std::size_t M, std::size_t N> | |
using | TRawMatrix = std::array<std::array<T, N>, M> |
using | AABB2D = TAABB2D<real> |
using | AABB3D = TAABB3D<real> |
using | Vector2I = TVector2<int32> |
using | Vector2UI = TVector2<uint32> |
using | Vector2R = TVector2<real> |
using | Vector2F = TVector2<float32> |
using | Vector2D = TVector2<float64> |
using | Vector2S = TVector2<std::size_t> |
using | Vector3I = TVector3<int32> |
using | Vector3UI = TVector3<uint32> |
using | Vector3R = TVector3<real> |
using | Vector3F = TVector3<float32> |
using | Vector3D = TVector3<float64> |
using | Vector3S = TVector3<std::size_t> |
using | Vector4R = TVector4<real> |
using | Vector4F = TVector4<float32> |
using | Vector4D = TVector4<float64> |
using | Vector4S = TVector4<std::size_t> |
using | QuaternionR = TQuaternion<real> |
using | QuaternionF = TQuaternion<float32> |
using | QuaternionD = TQuaternion<float64> |
using | Matrix2R = TMatrix2<real> |
using | Matrix2F = TMatrix2<float32> |
using | Matrix2D = TMatrix2<float64> |
using | Matrix3R = TMatrix3<real> |
using | Matrix3F = TMatrix3<float32> |
using | Matrix3D = TMatrix3<float64> |
using | Matrix4R = TMatrix4<real> |
using | Matrix4F = TMatrix4<float32> |
using | Matrix4D = TMatrix4<float64> |
using | Basis3R = TOrthonormalBasis3<real> |
using | Basis3F = TOrthonormalBasis3<float32> |
using | Basis3D = TOrthonormalBasis3<float64> |
Enumerations | |
enum class | EBvhNodeSplitMethod { EqualItems , EqualIntervals , SAH_Buckets_OneAxis , SAH_Buckets_MultiAxis , SAH_EdgeSort_OneAxis } |
enum class | EBvhSplitAxisOrder : uint8f { Unbalanced , Balanced , BalancedPow2 , Single } |
enum class | EEndpoint { MIN , MAX } |
enum class | EColorSpace { Unspecified = 0 , CIE_XYZ , CIE_xyY , Linear_sRGB , sRGB , ACEScg , Spectral_Smits , NUM , Spectral = Spectral_Smits } |
enum class | EReferenceWhite { Unspecified = 0 , A , B , C , D50 , D55 , D60 , D65 , D75 , E , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 , F10 , F11 , F12 , LED_B1 , LED_B2 , LED_B3 , LED_B4 , LED_B5 , LED_BH1 , LED_RGB1 , LED_V1 , LED_V2 , ACES , NUM } |
enum class | EChromaticAdaptation { Unspecified = 0 , XYZScaling , Bradford , VonKries , Default = Bradford } |
Methods to map image appearance between different illumination sources. This kind of mapping is commonly called Chromatic Adaptation Transform (CAT). More... | |
enum class | EColorUsage { Unspecified = 0 , Raw , EMR , ECF } |
enum class | ESpectralResample { Unspecified = 0 , PiecewiseAveraged , Default = PiecewiseAveraged } |
Functions | |
template<std::size_t N, typename Index > | |
class ph::math::TBvhSimdComputingContext | sizeof (float32) *BATCH_SIZE > |
template<EChromaticAdaptation ALGORITHM, typename T > | |
TTristimulusValues< T > | chromatic_adapt (const TTristimulusValues< T > &srcCIEXYZColor, EReferenceWhite srcRefWhite, EReferenceWhite dstRefWhite) |
template<typename T > | |
TMatrix3< T > | create_von_kries_linear_CAT_matrix (const TMatrix3< T > &CIEXYZToConeResponse, const TMatrix3< T > &ConeResponseToCIEXYZ, const EReferenceWhite srcRefWhite, const EReferenceWhite dstRefWhite) |
template<typename T > | |
TMatrix3< T > | create_von_kries_linear_CAT_matrix (const TMatrix3< T > &CIEXYZToConeResponse, const TMatrix3< T > &ConeResponseToCIEXYZ, const TTristimulusValues< T > &srcRefWhite, const TTristimulusValues< T > &dstRefWhite) |
template<typename T = ColorValue> | |
TChromaticityValues< T > | chromaticity_of (const EReferenceWhite refWhite) |
template<typename T = ColorValue> | |
TTristimulusValues< T > | CIEXYZ_of_custom_reference_white (const TChromaticityValues< T > &refWhite) |
template<typename T = ColorValue> | |
TTristimulusValues< T > | CIEXYZ_of (const EReferenceWhite refWhite) |
bool | is_tristimulus (EColorSpace colorSpace) |
Check whether colorSpace is a tristimulus color space. This is a runtime check. For compile-time check, use TColorSpaceDef<?>::isTristimulus() . | |
template<typename InColorValuesType , EColorSpace COLOR_SPACE> | |
constexpr bool | is_compatible () |
Check whether InColorValuesType is suitable to represent values in COLOR_SPACE . | |
template<EColorSpace SRC_COLOR_SPACE, EColorSpace DST_COLOR_SPACE, typename T , EChromaticAdaptation ALGORITHM = EChromaticAdaptation::Default> | |
auto | transform_color (const auto &srcColorValues, EColorUsage usage) |
template<EColorSpace SRC_COLOR_SPACE, typename T , EChromaticAdaptation ALGORITHM = EChromaticAdaptation::Default> | |
T | relative_luminance (const auto &srcColorValues, EColorUsage usage=EColorUsage::EMR) |
template<EColorSpace SRC_COLOR_SPACE, typename T , EColorSpace SPECTRAL_COLOR_SPACE = EColorSpace::Spectral, EChromaticAdaptation ALGORITHM = EChromaticAdaptation::Default> | |
T | estimate_color_energy (const auto &srcColorValues) |
template<EColorSpace SRC_COLOR_SPACE, typename T , EColorSpace SPECTRAL_COLOR_SPACE = EColorSpace::Spectral, EChromaticAdaptation ALGORITHM = EChromaticAdaptation::Default> | |
auto | normalize_color_energy (const auto &srcColorValues) |
template<EColorSpace SRC_COLOR_SPACE, typename T , EColorSpace SPECTRAL_COLOR_SPACE = EColorSpace::Spectral, EChromaticAdaptation ALGORITHM = EChromaticAdaptation::Default> | |
auto | put_color_energy (const auto &srcColorValues, T energyLevel) |
template<typename T > | |
TTristimulusValues< T > | sRGB_nonlinear_to_linear (const TTristimulusValues< T > &nonlinearSRGB) |
Helper for converting from sRGB to linear-sRGB. | |
template<typename T > | |
TTristimulusValues< T > | sRGB_linear_to_nonlinear (const TTristimulusValues< T > &linearSRGB) |
Helper for converting from linear-sRGB to sRGB. | |
template<EColorSpace DST_COLOR_SPACE, typename T > | |
auto | transform_from_sRGB (const TTristimulusValues< T > &nonlinearSRGB, EColorUsage usage) |
Helper for converting from sRGB to any color space. | |
template<EColorSpace DST_COLOR_SPACE, typename T > | |
auto | transform_from_linear_sRGB (const TTristimulusValues< T > &linearSRGB, EColorUsage usage) |
Helper for converting from linear-sRGB to any color space. | |
template<EColorSpace SRC_COLOR_SPACE, typename T > | |
TTristimulusValues< T > | transform_to_sRGB (const auto &srcColorValues, EColorUsage usage) |
Helper for converting any color space to sRGB. | |
template<EColorSpace SRC_COLOR_SPACE, typename T > | |
TTristimulusValues< T > | transform_to_linear_sRGB (const auto &srcColorValues, EColorUsage usage) |
Helper for converting any color space to linear-sRGB. | |
template<typename T , CSpectralSampleProps SampleProps> | |
constexpr T | wavelength_interval_of () noexcept |
template<typename T , CSpectralSampleProps SampleProps> | |
constexpr std::pair< T, T > | wavelength_range_of (std::size_t sampleIndex) noexcept |
template<typename T , CSpectralSampleProps SampleProps = DefaultSpectralSampleProps> | |
T | estimate_samples_energy (const TSpectralSampleValues< T, SampleProps > &srcSamples) |
template<typename T , CSpectralSampleProps SampleProps = DefaultSpectralSampleProps> | |
TSpectralSampleValues< T, SampleProps > | normalize_samples_energy (const TSpectralSampleValues< T, SampleProps > &srcSamples) |
Normalize spectral samples as if they carry energy. Normalized spectral samples, together, represents the expected amount of energy that 1 unit of total energy would distribute on each wavelength interval (implying that the samples should sum to 1). | |
template<typename T , CSpectralSampleProps SampleProps = DefaultSpectralSampleProps> | |
constexpr TSpectralSampleValues< T, SampleProps > | constant_spectral_samples (T constant) |
template<typename T , typename U , CSpectralSampleProps SampleProps = DefaultSpectralSampleProps> | |
TSpectralSampleValues< T, SampleProps > | resample_spectral_samples (const U *wavelengthsNM, const U *values, std::size_t numPoints, ESpectralResample algorithm=ESpectralResample::Default) |
template<typename T , CSpectralSampleProps SampleProps = DefaultSpectralSampleProps> | |
TSpectralSampleValues< T, SampleProps > | resample_black_body (T temperatureK) |
SPD of black-body radiation, with total energy = 1. | |
template<typename T , CSpectralSampleProps SampleProps = DefaultSpectralSampleProps> | |
TSpectralSampleValues< T, SampleProps > | resample_black_body_radiance (T temperatureK) |
SPD of black-body radiation in radiance. If a normalized energy distribution is desired, use resample_black_body() . | |
template<typename T , CSpectralSampleProps SampleProps = DefaultSpectralSampleProps> | |
TSpectralSampleValues< T, SampleProps > | resample_black_body_spectral_radiance (T temperatureK) |
SPD of black-body radiation in spectral radiance. Note that this function is not returning radiance but spectral radiance. The returned spectral radiance has the unit of watt per steradian per square meter per meter (W * sr^-1 * m^-2 * m^-1). If radiance is desired, use resample_black_body_radiance() . If a normalized energy distribution is desired, use resample_black_body() . | |
template<typename T , CSpectralSampleProps SampleProps = DefaultSpectralSampleProps, EReferenceWhite NORMALIZER = EReferenceWhite::D65> | |
TTristimulusValues< T > | spectral_samples_to_CIE_XYZ (const TSpectralSampleValues< T, SampleProps > &srcSamples, EColorUsage usage) |
Converting spectral samples to CIE-XYZ using standard CMFs. | |
template<typename T , CSpectralSampleProps SampleProps> | |
constexpr auto | wavelength_range_of (const std::size_t sampleIndex) noexcept -> std::pair< T, T > |
template<typename T > | |
TVector2< T > | octahedron_unit_vector_encode (const TVector3< T > &unitVec) |
Encode a unit vector using octahedron projection. | |
template<typename T > | |
TVector3< T > | octahedron_unit_vector_decode (const TVector2< T > &encodedVal) |
Decode and get a unit vector using octahedron projection. | |
template<typename T > | |
TVector2< T > | sun_sky_phi_theta (const T solarTime24H, const T julianDate, const T siteLatitudeRadians) |
Locate spherical coordinates of the sun in sky. | |
template<typename Integer > | |
std::size_t | discrete_spatial_hash (Integer x, Integer y, Integer z, std::size_t hashTableSize) |
template<typename Integer > | |
std::size_t | discrete_spatial_hash (Integer x, Integer y, std::size_t hashTableSize) |
template<std::integral T> | |
std::size_t | discrete_spatial_hash (const TVector3< T > &point, std::size_t hashTableSize) |
template<std::floating_point T> | |
std::size_t | discrete_spatial_hash (const TVector3< T > &point, const TVector3< T > &cellSize, std::size_t hashTableSize) |
uint32 | murmur3_bit_mix_32 (uint32 v) |
MurmurHash3's bit mixer. 32-bit version. | |
uint64 | murmur3_bit_mix_64 (uint64 v) |
MurmurHash3's bit mixer. 64-bit version. | |
uint64 | murmur3_v13_bit_mix_64 (uint64 v) |
MurmurHash3's bit mixer. 64-bit version. | |
uint64 | moremur_bit_mix_64 (uint64 v) |
A MurmurHash3-style bit mixer that outperforms the original by quite some margin. 64-bit version. | |
template<typename T , typename BitMixerType = Murmur3BitMixer32> | |
uint32 | murmur3_32 (const T &data, uint32 seed) |
Generate 32-bit hash values using MurmurHash3. Note that there are no collisions when T has <= 32 bits (two distinct inputs will not result in the same output). In general, if there is a way to reverse a function (reversing murmur3_32() is possible), it is guaranteed there cannot be any collisions. Otherwise, it would not be possible to revert. | |
template<typename T , typename BitMixerType > | |
uint32 | murmur3_32 (const T *data, std::size_t dataSize, BitMixerType &&bitMixer, uint32 seed) |
Generate 32-bit hash values using MurmurHash3. This is a lower level variant of MurmurHash3 and can be useful for customizing its behavior, e.g., it can accept arbitrary BitMixerType without requiring it to be default constructible. | |
uint32 | permuted_index (uint32 i, uint32 l, uint32 p) |
Get the permuted index or value in O(1) space and O(1) time. | |
void | form_orthonormal_basis_frisvad (const Vector3R &unitYaxis, Vector3R *const out_unitXaxis, Vector3R *const out_unitZaxis) |
bool | is_same_hemisphere (const Vector3R &vector, const Vector3R &N) |
Checks whether the specified vector is within the hemisphere defined by the normal vector N . N points to the hemisphere's peak, i.e., theta = 0 in spherical coordinates. | |
bool | is_opposite_hemisphere (const Vector3R &vector, const Vector3R &N) |
Checks whether the specified vector is within the hemisphere defined by the normal vector -N . N points to the hemisphere's peak, i.e., theta = 0 in spherical coordinates. | |
template<typename T > | |
auto | matrix2x2 (const T e00, const T e01, const T e10, const T e11) -> std::array< std::array< T, 2 >, 2 > |
template<typename T > | |
T | squared (const T value) |
template<typename T > | |
T | clamp (const T value, const T lowerBound, const T upperBound) |
Clamps a value to [lowerBound, upperBound]. None of value , lowerBound and upperBound can be NaN, or the method's behavior is undefined. | |
template<typename T > | |
T | safe_clamp (const T value, const T lowerBound, const T upperBound) |
Clamps a value to [lowerBound, upperBound], fallback to lowerBound . If a floating-point value is non-finite (e.g., being Inf, NaN), its value is clamped to lowerBound . Neither lowerBound nor upperBound can be NaN, or the method's behavior is undefined. | |
template<typename T > | |
T | safe_rcp (const T value) |
Calculates the reciprocal of a value, fallback to 0. If the resulting reciprocal is non-finite (e.g., being Inf, NaN), 0 will be returned instead. | |
template<typename T > | |
T | to_degrees (const T radians) |
Convert radians to degrees. | |
template<typename T > | |
T | to_radians (const T degrees) |
Convert degrees to radians. | |
template<typename T > | |
int | sign (const T value) |
Extract the sign of value . | |
uint32 | next_power_of_2 (uint32 value) |
Gets the minimum power of 2 value that is >= value . | |
template<typename T > | |
T | log2_floor (const T value) |
Calculate a positive number's base 2 logarithm (floored). | |
template<typename T , std::enable_if_t< std::is_floating_point_v< T >, int > = 0> | |
T | fractional_part (const T value) |
Retrieve the fractional part of value (with the sign unchanged). The result is not guaranteed to be the same as the bit representation of 's fractional part. The result is undefined if input value is NaN or +-Inf. | |
template<typename T , std::enable_if_t< std::is_integral_v< T >, int > = 0> | |
T | wrap (T value, const T lowerBound, const T upperBound) |
Wraps an integer around [lower-bound, upper-bound]. For example, given a bound [-1, 2], 3 will be wrapped to -1. | |
template<typename T > | |
bool | is_even (const T value) |
Checks if a number is even. | |
template<typename T > | |
bool | is_odd (const T value) |
Checks if a number is odd. | |
template<typename NumberType > | |
constexpr NumberType | bytes_to_KiB (const std::size_t numBytes) |
template<typename NumberType > | |
constexpr NumberType | bytes_to_MiB (const std::size_t numBytes) |
template<typename NumberType > | |
constexpr NumberType | bytes_to_GiB (const std::size_t numBytes) |
template<typename NumberType > | |
constexpr NumberType | bytes_to_TiB (const std::size_t numBytes) |
template<typename NumberType > | |
constexpr NumberType | bytes_to_PiB (const std::size_t numBytes) |
std::pair< std::size_t, std::size_t > | ith_evenly_divided_range (const std::size_t rangeIndex, const std::size_t totalSize, const std::size_t numDivisions) |
Gets the i-th evenly divided range. | |
float | fast_rcp_sqrt (float x) |
Computes 1/sqrt(x) in a fast but approximative way. | |
float | fast_sqrt (const float x) |
Computes sqrt(x) in a fast but approximative way. | |
template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>> | |
T | reverse_bits (const T value) |
Get an integral value with reversed bits. | |
template<std::unsigned_integral UIntType, std::integral RangeType> | |
UIntType | set_bits_in_range (const UIntType bits, const RangeType beginBitIdx, const RangeType endBitIdx) |
Set bits in the range to 1. The bits in [beginBitIdx, endBitIdx) will be set to 1, while the rest remain the same. LSB has the bit index 0. | |
template<std::unsigned_integral UIntType, std::integral RangeType> | |
UIntType | clear_bits_in_range (const UIntType bits, const RangeType beginBitIdx, const RangeType endBitIdx) |
Set bits in the range to 0. The bits in [beginBitIdx, endBitIdx) will be set to 0, while the rest remain the same. LSB has the bit index 0. | |
template<typename T , T MIN, T MAX, std::size_t N> | |
std::array< T, N > | evenly_spaced_array () |
template<typename T > | |
std::vector< T > | evenly_spaced_vector (const T min, const T max, const std::size_t n) |
template<std::floating_point FloatType, std::integral IntType> | |
FloatType | normalize_integer (const IntType intVal) |
Transform an integer to the range [0, 1] ([-1, 1] for signed integer). When transforming an unsigned integer, the minimum value the integer can hold will be mapped to 0, while the maximum value will be mapped to 1; the rest of the integer values will be uniformally mapped to the range [0, 1]. Signed integer types follow the same rule, except the mapped range will be [-1, 1]. | |
template<std::integral IntType, std::floating_point FloatType> | |
IntType | quantize_normalized_float (const FloatType floatVal) |
void | uint64_mul (const uint64 lhs, const uint64 rhs, uint64 &out_high64, uint64 &out_low64) |
Multiply two unsigined 64-bit numbers and get a 128-bit result. | |
template<typename T > | |
T | black_body_spectral_radiance_at (const T temperatureK, const T wavelengthNM) |
Get Black-body spectral radiance at specific temperature and wavelength. Note that this function is not returning radiance but spectral radiance. The returned spectral radiance has the unit of watt per steradian per square meter per meter (W * sr^-1 * m^-2 * m^-1). | |
template<typename T > | |
std::vector< T > | black_body_spectral_radiance_curve (const T temperatureK, const T lambdaMinNM, const T lambdaMaxNM, const std::size_t numCurvePoints, std::vector< T > *const out_lambdaValues=nullptr) |
Get a curve for Black-body radiation. Note that this function is not returning radiance but spectral radiance. The returned spectral radiance has the unit of watt per steradian per square meter per meter (W * sr^-1 * m^-2 * m^-1). | |
template<auto BASE, std::floating_point Result, std::integral Value> | |
Result | radical_inverse (const Value value) |
Compute radical inverse of a value. | |
template<auto BASE, std::floating_point Result, std::integral Value, typename DigitPermuter > | |
Result | radical_inverse_permuted (const Value dimIndex, const Value value, DigitPermuter permuter) |
Same as radical_inverse() , with permutation ability. It is guaranteed that no more than radical_inverse_detail::num_meaningful_digits() digits will be processed during the radical inverse. | |
template<typename To , typename From , std::size_t N> | |
std::array< To, N > | sample_cast (const std::array< From, N > &sample) |
template<typename T > | |
bool | pick (const T pickProbability, const T sample) |
Randomly pick a branch with some probability. | |
template<typename T > | |
bool | reused_pick (const T pickProbability, T &sample) |
template<typename T , typename BitsType > | |
T | bits_to_sample (const BitsType &bits) |
Converts input bits to a sample. For standard unsigned integral types, this is effectively normalizing the integer value represented by bits into the range [0, 1]. | |
template<typename IndexPairConsumer > | |
void | shuffle_durstenfeld_index_pairs (const std::size_t beginIndex, const std::size_t endIndex, IndexPairConsumer consumer) |
template<typename RandomIterator , typename Swapper = detail::shuffle::StandardSwapper<typename std::iterator_traits<RandomIterator>::value_type>> | |
void | shuffle_durstenfeld (RandomIterator begin, RandomIterator end, Swapper swapper=Swapper()) |
template<typename TimeType , typename UnitType > | |
auto | duration_to_HMS (const std::chrono::duration< TimeType, UnitType > &totalTime) -> std::array< TimeType, 3 > |
template<typename TimeType > | |
auto | milliseconds_to_HMS (const TimeType &totalTime) -> std::array< TimeType, 3 > |
template<typename TimeType > | |
auto | seconds_to_HMS (const TimeType &totalSeconds) -> std::array< TimeType, 3 > |
template<typename T > | |
T | mean_solar_time_to_solar_time_24H (const T standardTime24H, const T standardMeridianRadians, const T siteLongitudeRadians, const T julianDate) |
Convert mean solar time to solar time. | |
PH_DEFINE_EXTERNAL_LOG_GROUP (StaticRigidTransform, Math) | |
template<typename T , CSpectralSampleProps SampleProps = DefaultSpectralSampleProps> | |
TSpectralSampleValues< T, SampleProps > | resample_illuminant_E () |
SPD of standard illuminants. Any light source which statistically has the same relative SPD as a standard illuminant can be considered a standard light source, and is the reason why the SPD resample functions return a energy-normalized SPD (for convenience, as this is what you want almost always). | |
template<typename T , CSpectralSampleProps SampleProps = DefaultSpectralSampleProps> | |
TSpectralSampleValues< T, SampleProps > | resample_illuminant_D65 () |
SPD of standard illuminants D65, with total energy = 1. | |
template<typename T , std::size_t N> | |
T | summation (const std::array< T, N > &values, T initialValue=0) |
Sum all values within a container together. | |
template<typename T > | |
T | summation (const std::vector< T > &values, T initialValue=0) |
template<typename T , std::size_t EXTENT = std::dynamic_extent> | |
T | summation (TSpanView< T, EXTENT > values, T initialValue=0) |
template<typename T , std::size_t N> | |
T | product (const std::array< T, N > &values, T initialValue=1) |
Multiplies all values within a container together. | |
template<typename T > | |
T | product (const std::vector< T > &values, T initialValue=1) |
template<typename T , std::size_t EXTENT = std::dynamic_extent> | |
T | product (TSpanView< T, EXTENT > values, T initialValue=1) |
template<std::unsigned_integral UIntType> | |
UIntType | flag_bit (const UIntType bitIdx) |
Set a single bit to 1, others remain 0. LSB has the bit index 0. | |
template<std::unsigned_integral UIntType, UIntType BIT_IDX> | |
consteval UIntType | flag_bit () |
uint16 | fp32_to_fp16_bits (const float32 value) |
Convert a 32-bit float to 16-bit representation. | |
float32 | fp16_bits_to_fp32 (const uint16 fp16Bits) |
Convert a 16-bit representation back to 32-bit float. | |
template<typename T , std::size_t N> | |
T | length (const std::array< T, N > &vec) |
Treating input values as a vector and calculates its length. | |
template<typename T > | |
T | length (const std::vector< T > &vec) |
template<typename T , std::size_t EXTENT = std::dynamic_extent> | |
T | length (TSpanView< T, EXTENT > vec) |
template<typename T , std::size_t N> | |
T | length_squared (const std::array< T, N > &vec) |
Treating input values as a vector and calculates its squared length. | |
template<typename T > | |
T | length_squared (const std::vector< T > &vec) |
template<typename T , std::size_t EXTENT = std::dynamic_extent> | |
T | length_squared (TSpanView< T, EXTENT > vec) |
template<typename T , std::size_t N> | |
T | p_norm (const std::array< T, N > &vec) |
Treating input values as a vector and calculates its p-norm. | |
template<typename T > | |
T | p_norm (const std::vector< T > &vec) |
template<std::size_t P, typename T , std::size_t EXTENT = std::dynamic_extent> | |
T | p_norm (TSpanView< T, EXTENT > vec) |
template<typename T , std::size_t N> | |
void | normalize (std::array< T, N > &vec) |
Treating input values as a vector and normalize it. Notice that normalizing a integer typed vector will result in 0-vector most of the time. | |
template<typename T > | |
void | normalize (std::vector< T > &vec) |
template<typename T , std::size_t EXTENT = std::dynamic_extent> | |
void | normalize (TSpan< T, EXTENT > vec) |
template<typename T , std::size_t N> | |
T | dot_product (const std::array< T, N > &vecA, const std::array< T, N > &vecB) |
Treating input values as vectors and calculates their dot product. | |
template<typename T > | |
T | dot_product (const std::vector< T > &vecA, const std::vector< T > &vecB) |
template<typename T , std::size_t EXTENT = std::dynamic_extent> | |
T | dot_product (TSpanView< T, EXTENT > vecA, TSpanView< T, EXTENT > vecB) |
Variables | |
class ph::math::TBvhSimdComputingContext | MaskType |
class ph::math::TBvhSimdComputingContext * | BATCH_SIZE |
Math functions and utilities.
using ph::math::AABB2D = TAABB2D<real> |
using ph::math::AABB3D = TAABB3D<real> |
using ph::math::Basis3D = TOrthonormalBasis3<float64> |
using ph::math::Basis3F = TOrthonormalBasis3<float32> |
using ph::math::Basis3R = TOrthonormalBasis3<real> |
using ph::math::ColorValue = real |
using ph::math::Matrix2D = TMatrix2<float64> |
using ph::math::Matrix2F = TMatrix2<float32> |
using ph::math::Matrix2R = TMatrix2<real> |
using ph::math::Matrix3D = TMatrix3<float64> |
using ph::math::Matrix3F = TMatrix3<float32> |
using ph::math::Matrix3R = TMatrix3<real> |
using ph::math::Matrix4D = TMatrix4<float64> |
using ph::math::Matrix4F = TMatrix4<float32> |
using ph::math::Matrix4R = TMatrix4<real> |
using ph::math::QuaternionD = TQuaternion<float64> |
using ph::math::QuaternionF = TQuaternion<float32> |
using ph::math::QuaternionR = TQuaternion<real> |
using ph::math::Spectrum = LinearSRGBSpectrum |
using ph::math::TChromaticityValues = TRawColorValues<T, 2> |
using ph::math::TColorSpaceDef = TColorSpaceDefinition<COLOR_SPACE, ColorValue> |
Helper alias for TColorSpaceDefinition
which uses the ColorValue
type.
using ph::math::TRawColorValues = std::array<T, N> |
using ph::math::TRawColVector = std::array<T, M> |
using ph::math::TRawMatrix = std::array<std::array<T, N>, M> |
using ph::math::TRawRowVector = std::array<T, N> |
using ph::math::TSpectralSampleValues = TRawColorValues<T, SampleProps::NUM_SAMPLES> |
Properties of spectral sample values (such as wavelength range) are specified in SampleProps
.
using ph::math::TTristimulusValues = TRawColorValues<T, 3> |
using ph::math::Vector2D = TVector2<float64> |
using ph::math::Vector2F = TVector2<float32> |
using ph::math::Vector2I = TVector2<int32> |
using ph::math::Vector2R = TVector2<real> |
using ph::math::Vector2S = TVector2<std::size_t> |
using ph::math::Vector2UI = TVector2<uint32> |
using ph::math::Vector3D = TVector3<float64> |
using ph::math::Vector3F = TVector3<float32> |
using ph::math::Vector3I = TVector3<int32> |
using ph::math::Vector3R = TVector3<real> |
using ph::math::Vector3S = TVector3<std::size_t> |
using ph::math::Vector3UI = TVector3<uint32> |
using ph::math::Vector4D = TVector4<float64> |
using ph::math::Vector4F = TVector4<float32> |
using ph::math::Vector4R = TVector4<real> |
using ph::math::Vector4S = TVector4<std::size_t> |
|
strong |
|
strong |
|
strong |
Methods to map image appearance between different illumination sources. This kind of mapping is commonly called Chromatic Adaptation Transform (CAT).
|
strong |
|
strong |
These can be considered as hints that can be specified while converting data between color spaces. Specifying a hint to a method may result in better-converted data depending on the implementation.
|
strong |
|
strong |
|
strong |
|
inline |
Converts input bits to a sample. For standard unsigned integral types, this is effectively normalizing the integer value represented by bits
into the range [0, 1].
bits | The bits to convert. |
|
inline |
Get Black-body spectral radiance at specific temperature and wavelength. Note that this function is not returning radiance but spectral radiance. The returned spectral radiance has the unit of watt per steradian per square meter per meter (W * sr^-1 * m^-2 * m^-1).
temperatureK | Temperature in Kelvin. |
wavelengthNM | Wavelength of the interest, in nanometers. |
std::vector< T > ph::math::black_body_spectral_radiance_curve | ( | const T | temperatureK, |
const T | lambdaMinNM, | ||
const T | lambdaMaxNM, | ||
const std::size_t | numCurvePoints, | ||
std::vector< T > *const | out_lambdaValues = nullptr ) |
Get a curve for Black-body radiation. Note that this function is not returning radiance but spectral radiance. The returned spectral radiance has the unit of watt per steradian per square meter per meter (W * sr^-1 * m^-2 * m^-1).
lambdaMinNM | Minimum wavelength of the curve data, in nanometers. |
lambdaMaxNM | Maximum wavelength of the curve data, in nanometers. |
numCurvePoints | Number of points for the curve. Evenly spaced in [lambdaMinNM, lambdaMaxNM]. Must be >= 2. |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Clamps a value to [lowerBound, upperBound]. None of value
, lowerBound
and upperBound
can be NaN, or the method's behavior is undefined.
|
inline |
Set bits in the range to 0. The bits in [beginBitIdx, endBitIdx) will be set to 0, while the rest remain the same. LSB has the bit index 0.
|
inlineconstexpr |
|
inline |
|
inline |
|
inline |
Discretized spatial hash for floating point values are done by first quantizing the value to integers according to cell size.
|
inline |
|
inline |
Implements the hash function described in the paper "Optimized Spatial Hashing for Collision Detection of Deformable Objects" by Teschner et al. [15] Note that although they stated in the paper that 73856093, 19349663 and 83492791 are all prime numbers, 19349663 is in fact a composite number (41 * 471943).
Reference: http://www.beosil.com/download/CollisionDetectionHashing_VMV03.pdf
|
inline |
Extending the original 3-D version of discrete_spatial_hash() to 2-D.
|
inline |
Treating input values as vectors and calculates their dot product.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Computes 1/sqrt(x)
in a fast but approximative way.
This method is best known for its implementation in Quake III Arena (1999). Here the implementation follows what described in the referenced paper, which uses a slightly better (in terms of maximal relative error) magic number.
Reference: http://www.lomont.org/Math/Papers/2003/InvSqrt.pdf
|
inline |
Computes sqrt(x)
in a fast but approximative way.
|
inlineconsteval |
|
inline |
Set a single bit to 1, others remain 0. LSB has the bit index 0.
void ph::math::form_orthonormal_basis_frisvad | ( | const Vector3R & | unitYaxis, |
Vector3R *const | out_unitXaxis, | ||
Vector3R *const | out_unitZaxis ) |
|
inline |
Convert a 16-bit representation back to 32-bit float.
|
inline |
Convert a 32-bit float to 16-bit representation.
The implementation of half floats does not contain "safety checks", i.e., according to IEEE 754-2008, +/-65504 is the max representable value of half floats, input values that exceed the max value will not be represented correctly and will cause problems in OpenGL or other APIs. If the input (fp32) is too samll, 0 will be returned.
|
inline |
Retrieve the fractional part of value
(with the sign unchanged). The result is not guaranteed to be the same as the bit representation of 's fractional part. The result is undefined if input value is NaN or +-Inf.
|
inlineconstexpr |
Check whether InColorValuesType
is suitable to represent values in COLOR_SPACE
.
|
inline |
Checks if a number is even.
value | The number to be tested. Should be an integer type. |
|
inline |
Checks if a number is odd.
value | The number to be tested. Should be an integer type. |
Checks whether the specified vector is within the hemisphere defined by the normal vector -N
. N
points to the hemisphere's peak, i.e., theta = 0 in spherical coordinates.
vector
is perpendicular to N
, both this function and is_same_hemisphere()
returns false
. Checks whether the specified vector is within the hemisphere defined by the normal vector N
. N
points to the hemisphere's peak, i.e., theta = 0 in spherical coordinates.
|
inline |
Check whether colorSpace
is a tristimulus color space. This is a runtime check. For compile-time check, use TColorSpaceDef<?>::isTristimulus()
.
|
inline |
Gets the i-th evenly divided range.
Gets the i-th range [beginIndex, endIndex) which is the result of dividing totalSize
into numDivisions
parts as evenly as possible.
|
inline |
Treating input values as a vector and calculates its length.
|
inline |
|
inline |
|
inline |
Treating input values as a vector and calculates its squared length.
|
inline |
|
inline |
|
inline |
Calculate a positive number's base 2 logarithm (floored).
value | Should be > 0, or the behavior of this method is undefined. |
|
inline |
|
inline |
Convert mean solar time to solar time.
The equation is from Appendix A.6 of the paper "A Practical Analytic Model for Daylight" by Preetham et al.,
standardTime24H | Local standard time in decimal hours. |
standardMeridianRadians | Standard meridian used for local standard time, in radians. |
siteLongitudeRadians | Longitude of the site of interest, in radians. |
julianDate | The day of the year as an integer in the range [1, 366]. |
|
inline |
|
inline |
A MurmurHash3-style bit mixer that outperforms the original by quite some margin. 64-bit version.
|
inline |
Generate 32-bit hash values using MurmurHash3. Note that there are no collisions when T
has <= 32 bits (two distinct inputs will not result in the same output). In general, if there is a way to reverse a function (reversing murmur3_32()
is possible), it is guaranteed there cannot be any collisions. Otherwise, it would not be possible to revert.
|
inline |
Generate 32-bit hash values using MurmurHash3. This is a lower level variant of MurmurHash3 and can be useful for customizing its behavior, e.g., it can accept arbitrary BitMixerType
without requiring it to be default constructible.
data | Pointer to a data array of type T . |
dataSize | Number of elements in the data array. |
bitMixer | The finalizer for the hashing algorithm. |
seed | A value for generating the hash. Can be from a RNG or anything you prefer. |
|
inline |
MurmurHash3's bit mixer. 32-bit version.
|
inline |
MurmurHash3's bit mixer. 64-bit version.
|
inline |
MurmurHash3's bit mixer. 64-bit version.
|
inline |
Gets the minimum power of 2 value that is >= value
.
Note that if is
0, then 0 will be returned.
Reference: Stanford CG Lab's webpage: "Bit Twiddling Hacks" by Sean Eron Anderson
|
inline |
Treating input values as a vector and normalize it. Notice that normalizing a integer typed vector will result in 0-vector most of the time.
vec | The vector to be normalized in-place. |
|
inline |
|
inline |
|
inline |
|
inline |
Transform an integer to the range [0, 1] ([-1, 1] for signed integer). When transforming an unsigned integer, the minimum value the integer can hold will be mapped to 0, while the maximum value will be mapped to 1; the rest of the integer values will be uniformally mapped to the range [0, 1]. Signed integer types follow the same rule, except the mapped range will be [-1, 1].
|
inline |
Normalize spectral samples as if they carry energy. Normalized spectral samples, together, represents the expected amount of energy that 1 unit of total energy would distribute on each wavelength interval (implying that the samples should sum to 1).
|
inline |
Decode and get a unit vector using octahedron projection.
encodedVal | The encoded unit vector (in [0, 1] for any bit size) to be decoded. |
|
inline |
Encode a unit vector using octahedron projection.
unitVec | The unit vector to be encoded. Assumed being normalized already. |
|
inline |
Treating input values as a vector and calculates its p-norm.
|
inline |
|
inline |
|
inline |
Get the permuted index or value in O(1) space and O(1) time.
i | The index or value to be permuted. |
l | The size of the permutation vector. |
p | The seed to use for the shuffle. |
ph::math::PH_DEFINE_EXTERNAL_LOG_GROUP | ( | StaticRigidTransform | , |
Math | ) |
|
inline |
Randomly pick a branch with some probability.
pickProbability | The probability for the function to return true . |
sample | The source of randomness. |
true
if the pick is successful.
|
inline |
Multiplies all values within a container together.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Compute radical inverse of a value.
BASE | The base to use. |
value
in decimal.
|
inline |
Same as radical_inverse()
, with permutation ability. It is guaranteed that no more than radical_inverse_detail::num_meaningful_digits()
digits will be processed during the radical inverse.
permuter | Must be callable with <BASE>(digit) and return a permuted digit. |
|
inline |
srcColorValues
. Normally for a tristimulus color, its reference white's relative luminance will be 1. For spectral samples, it is the result of performing an inner product with the luminous efficiency function. For ECF usages, its relative luminance is guaranteed to be within [0, 1].
|
inline |
SPD of black-body radiation, with total energy = 1.
|
inline |
SPD of black-body radiation in radiance. If a normalized energy distribution is desired, use resample_black_body()
.
|
inline |
SPD of black-body radiation in spectral radiance. Note that this function is not returning radiance but spectral radiance. The returned spectral radiance has the unit of watt per steradian per square meter per meter (W * sr^-1 * m^-2 * m^-1). If radiance is desired, use resample_black_body_radiance()
. If a normalized energy distribution is desired, use resample_black_body()
.
|
inline |
SPD of standard illuminants D65, with total energy = 1.
|
inline |
SPD of standard illuminants. Any light source which statistically has the same relative SPD as a standard illuminant can be considered a standard light source, and is the reason why the SPD resample functions return a energy-normalized SPD (for convenience, as this is what you want almost always).
SPD of standard illuminants E, with total energy = 1.
|
inline |
|
inline |
|
inline |
Get an integral value with reversed bits.
Reference: The lookup table method from Stanford CG Lab's webpage: "Bit Twiddling Hacks" by Sean Eron Anderson.
|
inline |
Clamps a value to [lowerBound, upperBound], fallback to lowerBound
. If a floating-point value is non-finite (e.g., being Inf, NaN), its value is clamped to lowerBound
. Neither lowerBound
nor upperBound
can be NaN, or the method's behavior is undefined.
|
inline |
Calculates the reciprocal of a value, fallback to 0. If the resulting reciprocal is non-finite (e.g., being Inf, NaN), 0 will be returned instead.
|
inline |
|
inline |
|
inline |
Set bits in the range to 1. The bits in [beginBitIdx, endBitIdx) will be set to 1, while the rest remain the same. LSB has the bit index 0.
void ph::math::shuffle_durstenfeld | ( | RandomIterator | begin, |
RandomIterator | end, | ||
Swapper | swapper = Swapper() ) |
void ph::math::shuffle_durstenfeld_index_pairs | ( | const std::size_t | beginIndex, |
const std::size_t | endIndex, | ||
IndexPairConsumer | consumer ) |
|
inline |
Extract the sign of value
.
Function is defined only if the provided value is comparable to 0. Note that the input is passed by value.
value
> 0; -1 when value
< 0; 0 when value
== 0. class ph::math::TBvhSimdComputingContext ph::math::sizeof | ( | float32 | ) |
|
inline |
Converting spectral samples to CIE-XYZ using standard CMFs.
NORMALIZER | Pick a reference white as a normalization target. This will ensure a normalized SPD of the associated standard illuminant get the corresponding standard white point defined in CIE-XYZ. This normalization only take place if the color usage is related to illumination. |
|
inline |
|
inline |
Helper for converting from linear-sRGB to sRGB.
|
inline |
Helper for converting from sRGB to linear-sRGB.
|
inline |
Sum all values within a container together.
|
inline |
|
inline |
|
inline |
Locate spherical coordinates of the sun in sky.
The equation is from Appendix A.6 of the paper "A Practical Analytic Model for Daylight" by Preetham et al.,
solarTime24H | Local solar time in decimal hours. |
julianDate | The day of the year as an integer in the range [1, 366]. |
siteLatitudeRadians | Latitude of the site of interest, in radians. |
|
inline |
Convert radians to degrees.
|
inline |
Convert degrees to radians.
|
inline |
srcColorValues | A TTristimulusValues or a TSpectralSampleValues depending on whetherSRC_COLOR_SPACE is tristimulus. |
TTristimulusValues
or a TSpectralSampleValues
depending on whether DST_COLOR_SPACE
is tristimulus.
|
inline |
Helper for converting from linear-sRGB to any color space.
|
inline |
Helper for converting from sRGB to any color space.
|
inline |
Helper for converting any color space to linear-sRGB.
|
inline |
Helper for converting any color space to sRGB.
|
inline |
Multiply two unsigined 64-bit numbers and get a 128-bit result.
[out] | out_high64 | The higher 64 bits of the 128-bit result. |
[out] | out_low64 | The lower 64 bits of the 128-bit result. |
|
inlineconstexprnoexcept |
SampleProps
, in nanometers (nm).
|
inlineconstexprnoexcept |
sampleIndex
, in nanometers (nm).
|
inlineconstexprnoexcept |
sampleIndex
, in nanometers (nm).
|
inline |
Wraps an integer around [lower-bound, upper-bound]. For example, given a bound [-1, 2], 3 will be wrapped to -1.
class ph::math::TBvhSimdComputingContext* ph::math::BATCH_SIZE |
class ph::math::TBvhSimdComputingContext ph::math::MaskType |