42 static constexpr Basis sIdentity(
54 Basis basis{ .Z = forward };
63 const Vec3
Z = forward;
67 const Vec3
X = Normalized(CrossProduct(
Y,
Z));
68 Y = CrossProduct(
Z,
X);
83 const Vec3 taxyz = t * axis;
84 const Vec3 sAxis = s * axis;
87 const Vec3 t_ax_a = axis * taxyz.X;
88 const Vec3 t_ay_a = axis * taxyz.Y;
89 const Vec3 t_az_a = axis * taxyz.Z;
92 .X = t_ax_a + Vec3{ c, sAxis.Z, -sAxis.Y },
93 .Y = t_ay_a + Vec3{ -sAxis.Z, c, sAxis.X },
94 .Z = t_az_a + Vec3{ sAxis.Y, -sAxis.X, c }
102 DotProduct(pWorld,
X),
103 DotProduct(pWorld,
Y),
104 DotProduct(pWorld,
Z)
109 [[nodiscard]] JPL_INLINE Vec3
Transform(
const Vec3& vector)
const noexcept
121 const simd inX = inOutX;
122 const simd inY = inOutY;
123 const simd inZ = inOutZ;
157 [[nodiscard]] JPL_INLINE
static Basis<Vec3> MakeBasis(
const Vec3& forward)
noexcept
159 return Basis<Vec3>::MakeFrom(forward);
165 [[nodiscard]] JPL_INLINE
static Basis<Vec3> MakeBasis(
const Vec3& forward,
const Vec3& up)
noexcept
std::remove_cvref_t< decltype(GetX(std::declval< Vec3 >()))> FloatOf
Definition Vec3Math.h:36
void CreateOrthonormalBasis(const Vec3 &normal, Vec3 &tangent, Vec3 &bitangent) noexcept
Definition Vec3Math.h:84
JPL_INLINE constexpr T FMA(T a, T b, T c) noexcept
Inlined fuse multiply-add. Compiler in some circumstances is more eager to optimize this than std::fm...
Definition Math.h:186
JPL_INLINE constexpr bool IsNearlyEqual(T a, T b, T tolerance=JPL_FLOAT_EPS_V< T >) noexcept
Definition Math.h:152
JPL_INLINE constexpr auto Abs(const T &value) noexcept
Standard abs is not constexpr in C++20.
Definition Math.h:87
JPL_INLINE std::pair< T, T > SinCos(T value) noexcept
Definition Math.h:164
Definition AcousticMaterial.h:36
JPL_INLINE auto GetX(const Vec3Type &v) noexcept
Definition Vec3Traits.h:35
JPL_INLINE auto GetZ(const Vec3Type &v) noexcept
Definition Vec3Traits.h:37
JPL_INLINE auto GetY(const Vec3Type &v) noexcept
Definition Vec3Traits.h:36
Orthonormal basis (column-major)
Definition MinimalBasis.h:35
JPL_INLINE Vec3 InverseTransform(const Vec3 &pWorld) const noexcept
Apply rotation world -> local.
Definition MinimalBasis.h:99
JPL_INLINE Vec3 Transform(const Vec3 &vector) const noexcept
Apply rotation local -> world.
Definition MinimalBasis.h:109
Vec3 X
Definition MinimalBasis.h:38
static const Basis & Identity() noexcept
Definition MinimalBasis.h:40
Vec3 Z
Definition MinimalBasis.h:38
Internal::FloatOf< Vec3 > Float
Definition MinimalBasis.h:36
Vec3 Y
Definition MinimalBasis.h:38
JPL_INLINE void Transform(simd &inOutX, simd &inOutY, simd &inOutZ) const noexcept
Definition MinimalBasis.h:117
static Basis Rotation(const Vec3 &axis, Float angleRad) noexcept
Definition MinimalBasis.h:78
JPL_INLINE Basis Transform(const Basis &otherBasis) const noexcept
Compose orientations: apply 'this' basis mapping to the other's axes.
Definition MinimalBasis.h:131
JPL_INLINE Basis InverseTransform(const Basis &otherBasis) const noexcept
Re-express 'other' in 'this' local frame.
Definition MinimalBasis.h:141
static Basis FromUpAndForward(const Vec3 &up, const Vec3 &forward) noexcept
Creates a basis from the given up and forward normalized unit vectors.
Definition MinimalBasis.h:60
static JPL_INLINE Basis FromForward(const Vec3 &forward) noexcept
Definition MinimalBasis.h:52
Minimal 4-wide 32-bit float vector implementation for SIMD.
Definition SIMD.h:60