JPL Spatial
Sound spatialization and propagation library
Loading...
Searching...
No Matches
DirectionEncoding.h File Reference
#include <JPLSpatial/Core.h>
#include <JPLSpatial/ErrorReporting.h>
#include <JPLSpatial/Math/Math.h>
#include <JPLSpatial/Math/Vec3Math.h>
#include <JPLSpatial/Math/Vec3Traits.h>
#include <JPLSpatial/Math/MinimalVec2.h>
#include <JPLSpatial/Math/SIMD.h>
#include <JPLSpatial/Memory/Bits.h>
#include <cmath>
#include <numbers>
#include <concepts>
#include <algorithm>

Go to the source code of this file.

Classes

struct  JPL::Octahedron::Internal::PrecisionType< EncodedType_ >
 
class  JPL::OctahedronEncoding< Precision >
 Forward declaration. More...
 

Namespaces

namespace  JPL
 
namespace  JPL::Octahedron
 Type traits and utilities for octahedron encoder.
 
namespace  JPL::Octahedron::Internal
 
namespace  JPL::UnitTests
 

Concepts

concept  JPL::Octahedron::Internal::AnyOf
 
concept  JPL::Octahedron::CPrecision
 Constraint for valid precision types.
 

Macros

#define JPL_OCTAHEDRON_SPECIAL_CASE_HANDLING   0
 

Typedefs

using JPL::Octahedron::Precision4bits = Internal::PrecisionType< uint8 >
 Available precision types.
 
using JPL::Octahedron::Precision8bits = Internal::PrecisionType< uint16 >
 
using JPL::Octahedron::Precision16bits = Internal::PrecisionType< uint32 >
 
using JPL::Octahedron::Precision32bits = Internal::PrecisionType< uint64 >
 
using JPL::Octahedron8Bit = OctahedronEncoding< Octahedron::Precision4bits >
 Encoder aliases for available encoding precisions.
 
using JPL::Octahedron16Bit = OctahedronEncoding< Octahedron::Precision8bits >
 
using JPL::Octahedron32Bit = OctahedronEncoding< Octahedron::Precision16bits >
 
using JPL::Octahedron64Bit = OctahedronEncoding< Octahedron::Precision32bits >
 

Functions

JPL_INLINE constexpr double JPL::Octahedron::MaxComponentError (size_t bitsPerAxis) noexcept
 Run-time variant of 'cMaxComponentError'.
 
JPL_INLINE constexpr double JPL::Octahedron::MaxVectorError (size_t bitsPerAxis) noexcept
 Run-time variant of 'cMaxVectorError'.
 
template<CVec3 Vec3>
JPL_INLINE constexpr uint32 JPL::ToOctahedron32 (const Vec3 &direction)
 
template<CVec3 Vec3>
JPL_INLINE constexpr Vec3 JPL::FromOctahedron32 (uint32 encodedDirection)
 
constexpr float JPL::ToDiamond (Vec2 dir) noexcept
 "Diamond Encoding" of a 2D unit vector as per:
 
constexpr Vec2 JPL::FromDiamond (float p) noexcept
 Decode scalar [0, 1] to a 2D unit vector.
 
JPL_INLINE simd JPL::ToDiamond (simd x, const simd &y) noexcept
 

Variables

template<size_t BitsPerAxis>
constexpr double JPL::Octahedron::cMaxComponentError = 4.0 / (static_cast<double>((1ULL << BitsPerAxis)) - 1.0)
 
template<size_t BitsPerAxis>
constexpr double JPL::Octahedron::cMaxVectorError = cMaxComponentError<BitsPerAxis> * std::numbers::sqrt3
 

Macro Definition Documentation

◆ JPL_OCTAHEDRON_SPECIAL_CASE_HANDLING

#define JPL_OCTAHEDRON_SPECIAL_CASE_HANDLING   0