Skip to content

ludus::foundation::math

Ludus Wiki · API overview · Browse API

Namespace

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

Enumerations

HitResult

enum class HitResult : uint8

Related types: uint8

Miss

Miss = 0

Hit

Hit = 1

Declared in modules/foundation/math/include/ludus/foundation/math/geometry.hpp

FrustumMode

enum class FrustumMode : uint8

Related types: uint8

FinitePerspectiveOrOrthographic

FinitePerspectiveOrOrthographic = 0

InfiniteReverseZPerspective

InfiniteReverseZPerspective = 1

Declared in modules/foundation/math/include/ludus/foundation/math/geometry.hpp

FrustumRelation

enum class FrustumRelation : uint8

Related types: uint8

Outside

Outside = 0

Intersecting

Intersecting = 1

Inside

Inside = 2

Declared in modules/foundation/math/include/ludus/foundation/math/geometry.hpp

ProjectedEllipseKind

enum class ProjectedEllipseKind : core::uint8
How the great circle of a polygon edge bounds the projected polygon (paper section 3.7, supplement A.2).
The paper encodes inner ellipses in the sign bit of u.x and degenerate ones as an infinite u.x. Ludus stores the kind explicitly because its Metal and WGSL shader targets do not guarantee signed zeros or infinities.

Related types: core::uint8

Outer

Outer = 0
The edge runs counterclockwise around the zenith; its normal has a positive z.

Inner

Inner = 1
The edge runs clockwise around the zenith; its normal has a negative z.

Degenerate

Degenerate = 2
The great circle passes through the zenith; it encloses no area and counts as outer.

Declared in modules/foundation/math/include/ludus/foundation/math/projected_solid_angle.hpp

RandomDomainOwner

enum class RandomDomainOwner : core::uint8
Which ID range a manifest draws from.

Related types: core::uint8

Game

Game
Game or content manifests: RANDOM_GAME_DOMAIN_FIRST through RANDOM_GAME_DOMAIN_LAST.

Engine

Engine
Engine modules: RANDOM_ENGINE_DOMAIN_FIRST through the largest uint32.

Declared in modules/foundation/math/include/ludus/foundation/math/random_domains.hpp

MathStatus

enum class MathStatus : uint8
Checked math result; failure preserves outputs. A geometric miss can still be Success.

Related types: uint8

Success

Success = 0
The operation succeeded; outputs are written and meaningful.

NonFiniteInput

NonFiniteInput
An input was NaN or infinite where a finite value is required.

InvalidArgument

InvalidArgument
An input violated a documented domain precondition that is not purely a finiteness problem (e.g. a negative length threshold, reversed interval bounds or a zero sampling bound).

Degenerate

Degenerate
The input is mathematically degenerate for this operation (e.g. a zero-length vector to normalize, coincident eye/target, a basis that is not a rotation, a singular linear block).

IllConditioned

IllConditioned
The operation is numerically ill-conditioned beyond the policy threshold (e.g. an inverse whose reciprocal condition estimate or residual fails).

OutOfRange

OutOfRange
A finite, well-formed input produced a result that is not representable in the output type (overflow / narrowing to non-finite).

SizeMismatch

SizeMismatch
Two spans that must match in length did not (batch APIs).

Declared in modules/foundation/math/include/ludus/foundation/math/status.hpp

Constants and variables

RandomKeyDerivationVersion

constexpr uint32 ludus::foundation::math::RandomKeyDerivationVersion = 1
Frozen identifiers to store in the owner's replay/content manifest.
Changing any formula, constants, packing or mapping requires a new version/API.

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

RandomAddressLayoutVersion

constexpr uint32 ludus::foundation::math::RandomAddressLayoutVersion = 1

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

RandomBoundedMappingVersion

constexpr uint32 ludus::foundation::math::RandomBoundedMappingVersion = 1

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

RandomMaxDimension

constexpr uint32 ludus::foundation::math::RandomMaxDimension = 0xffffu
Largest RandomAddress::Dimension in address layout v1 (the field is 16 bits wide).
Multi-sample consumers that compute dimensions must prove or check their range against this value instead of narrowing a wider value. The GPU port in FoundationMath's math.slang mirrors it.

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

RandomBoundedAttemptCount

constexpr uint32 ludus::foundation::math::RandomBoundedAttemptCount = 0x10000u
Attempts (0 through 65535) that TrySampleBounded evaluates before returning OutOfRange.

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

MIN_LINEARLY_TRANSFORMED_COSINE_DETERMINANT

constexpr float32 ludus::foundation::math::MIN_LINEARLY_TRANSFORMED_COSINE_DETERMINANT = 2.3283064365386963e-10F
Smallest accepted determinant of the scaled inverse transform (2^-32).
TryMakeLinearlyTransformedCosine scales M^-1 so its largest-magnitude entry lies in [1, 2). A smaller determinant means the distribution is nearly a delta or a great circle, and its density would leave single precision.

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/linearly_transformed_cosine.hpp

METROPOLIS_VERSION

constexpr uint32 ludus::foundation::math::METROPOLIS_VERSION = 1
Version of the symmetric primary-sample mutations and RB holding-time recurrence.

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/metropolis.hpp

MIN_PROJECTED_POLYGON_VERTICES

constexpr uint32 ludus::foundation::math::MIN_PROJECTED_POLYGON_VERTICES = 3
Fewest vertices of a polygon, before and after clipping.

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/projected_solid_angle.hpp

MAX_PROJECTED_POLYGON_INPUT_VERTICES

constexpr uint32 ludus::foundation::math::MAX_PROJECTED_POLYGON_INPUT_VERTICES = 7
Largest convex polygon accepted before horizon clipping (paper supplement A.1).

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/projected_solid_angle.hpp

MAX_PROJECTED_POLYGON_VERTICES

constexpr uint32 ludus::foundation::math::MAX_PROJECTED_POLYGON_VERTICES = MAX_PROJECTED_POLYGON_INPUT_VERTICES + 1
Largest polygon after clipping to z >= 0; clipping adds at most one vertex (supplement A.6).

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/projected_solid_angle.hpp

PROJECTED_POLYGON_ITERATION_COUNT

constexpr uint32 ludus::foundation::math::PROJECTED_POLYGON_ITERATION_COUNT = 2
Tangent-line iterations per decentral sample; two give backward errors near 1e-5 (paper section 3.6).

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/projected_solid_angle.hpp

RANDOM_GAME_DOMAIN_FIRST

constexpr uint32 ludus::foundation::math::RANDOM_GAME_DOMAIN_FIRST = 1u
First domain ID a game or content manifest may assign.

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/random_domains.hpp

RANDOM_GAME_DOMAIN_LAST

constexpr uint32 ludus::foundation::math::RANDOM_GAME_DOMAIN_LAST = 0x00ffffffu
Last domain ID a game or content manifest may assign.

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/random_domains.hpp

RANDOM_ENGINE_DOMAIN_FIRST

constexpr uint32 ludus::foundation::math::RANDOM_ENGINE_DOMAIN_FIRST = 0x01000000u
First engine-owned domain ID; engine IDs are conventionally four ASCII characters such as BAKE.

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/random_domains.hpp

kPi

constexpr float64 ludus::foundation::math::kPi = 3.14159265358979323846

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

kTau

constexpr float64 ludus::foundation::math::kTau = 6.28318530717958647692

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

kHalfPi

constexpr float64 ludus::foundation::math::kHalfPi = 1.57079632679489661923

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

kPiF

constexpr float32 ludus::foundation::math::kPiF = 3.14159265358979323846f

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

kTauF

constexpr float32 ludus::foundation::math::kTauF = 6.28318530717958647692f

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

kHalfPiF

constexpr float32 ludus::foundation::math::kHalfPiF = 1.57079632679489661923f

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

SHADING_NORMAL_MINIMUM_OUTGOING_COSINE

constexpr float32 ludus::foundation::math::SHADING_NORMAL_MINIMUM_OUTGOING_COSINE = 0.01F
Cosine with the outgoing direction below which ClipShadingNormalToOutgoingHemisphere moves a normal.
Peters 2021, section 6.1 gives no margin. Ludus keeps the clipped normal this far inside the hemisphere because the standard BSDF is zero for an outgoing direction on the shading horizon. After renormalization the clipped cosine is at least SHADING_NORMAL_MINIMUM_OUTGOING_COSINE / sqrt(1 + SHADING_NORMAL_MINIMUM_OUTGOING_COSINE^2). FoundationMath's shaders/shading_normal.slang declares the same value.

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/shading_normal.hpp

STOCHASTIC_PAIRWISE_MIS_VERSION

constexpr uint32 ludus::foundation::math::STOCHASTIC_PAIRWISE_MIS_VERSION = 1
Version of the shared stochastic pairwise MIS arithmetic and input contracts.

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/stochastic_pairwise_mis.hpp

WEIGHTED_RESERVOIR_SELECTION_VERSION

constexpr uint32 ludus::foundation::math::WEIGHTED_RESERVOIR_SELECTION_VERSION = 1
Frozen identifier of the reservoir's selection arithmetic, for replay/content manifests.
Changing the selection rule, weight/ticket classification, subnormal flush or contribution-weight formula requires a new version. FoundationMath's shaders/weighted_reservoir.slang mirrors it.

Related types: uint32

Declared in modules/foundation/math/include/ludus/foundation/math/weighted_reservoir.hpp

WEIGHTED_RESERVOIR_MINIMUM_WEIGHT

constexpr float32 ludus::foundation::math::WEIGHTED_RESERVOIR_MINIMUM_WEIGHT = 0x1p-102f
Smallest weight the reservoir accepts as positive, 2^-102 = 2^24 times FP32's smallest normal value.
Smaller nonnegative weights, subnormals included, count as zero. Above it, Ticket * sum stays normal wherever it can approach the weight, so FP32 rounding and GPU subnormal flushing cannot change a selection, and the first positive candidate is always selected. The bias is at most this value per candidate.

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/weighted_reservoir.hpp

Functions

TryMakeRandomKey

MathStatus ludus::foundation::math::TryMakeRandomKey(uint64 rootSeed, uint32 domainId, RandomKey &out) noexcept
Domain IDs are persistent, nonzero numeric IDs assigned by the owner.
Within one root seed, different IDs derive distinct keys; statistical independence and collision freedom between different roots are not promised.

Related types: uint64 · uint32 · MathStatus · RandomKey

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

TryMakeRandomAddress

MathStatus ludus::foundation::math::TryMakeRandomAddress(RandomAddressInput input, RandomAddress &out) noexcept
Use this checked boundary BEFORE narrowing external event/dimension values.
Scope is a stable entity/chunk ID; Event is an explicit occurrence counter; Dimension is a stable semantic slot. Do not use pointers, thread IDs, job indices or a shared incrementing draw count. Outputs are unchanged on failure.

Related types: MathStatus · RandomAddress · RandomAddressInput

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

SampleUInt32

uint32 ludus::foundation::math::SampleUInt32(RandomKey key, RandomAddress address) noexcept
Pure Philox4x32-10, attempt zero, selected lane.
Repeating an address repeats the result. There is no mutable state, initialization, cache or allocation.

Related types: uint32 · RandomAddress · RandomKey

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

SampleFloat01

float32 ludus::foundation::math::SampleFloat01(RandomKey key, RandomAddress address) noexcept
High 24 bits times 2^-24: [0,1), exactly one raw sample, identical to PCG v1's float conversion.
This does not make downstream FP simulation deterministic.

Related types: float32 · RandomAddress · RandomKey

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

TrySampleBlock

MathStatus ludus::foundation::math::TrySampleBlock(RandomKey key, RandomAddress address, RandomBlock &out) noexcept
Four consecutive dimensions in one Philox evaluation.
Dimension must be a multiple of four (max 65532); no silent rounding to a different address.

Related types: MathStatus · RandomAddress · RandomBlock · RandomKey

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

TryPrepareBound32

MathStatus ludus::foundation::math::TryPrepareBound32(uint32 bound, PreparedBound32 &out)

Related types: PreparedBound32 · uint32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

TrySampleBounded

MathStatus ludus::foundation::math::TrySampleBounded(RandomKey key, RandomAddress address, uint32 bound, uint32 &out) noexcept

Related types: uint32 · MathStatus · RandomAddress · RandomKey

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

TrySampleBounded

MathStatus ludus::foundation::math::TrySampleBounded(RandomKey key, RandomAddress address, PreparedBound32 bound, uint32 &out) noexcept

Related types: PreparedBound32 · uint32 · MathStatus · RandomAddress · RandomKey

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

TryTransformPoints

MathStatus ludus::foundation::math::TryTransformPoints(const Affine3 &transform, std::span< const Vector3 > input, std::span< Vector3 > output) noexcept
Transform a batch of points by an Affine3.
Spans must match in length (SizeMismatch otherwise). Validates the affine and every input point before writing anything; if any transformed point would be non-finite, the whole batch is rejected (OutOfRange) with outputs unchanged. Empty matching spans succeed. Exact in-place supported; partial overlap rejected (InvalidArgument).

Related types: MathStatus · Affine3 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/batch.hpp

TryClassifySpheres

MathStatus ludus::foundation::math::TryClassifySpheres(const Frustum &frustum, std::span< const Sphere > input, float32 margin, std::span< FrustumRelation > output) noexcept
Classify a batch of spheres against a frustum with a caller margin.
Spans must match in length. Validates the margin and every sphere before writing; input and output must be disjoint. Empty matching spans succeed.

Related types: float32 · MathStatus · FrustumRelation · Frustum · Sphere

Declared in modules/foundation/math/include/ludus/foundation/math/batch.hpp

TryEvaluateCubic

MathStatus ludus::foundation::math::TryEvaluateCubic(const CubicBezier1 &curve, float64 u, float32 &out) noexcept
Allocation-free checked operations.
All controls must be finite; u is finite and in [0,1]. Outputs are unchanged on failure. Arithmetic uses float64 intermediates, with rounded float32 results; these are not certified bounds. Endpoints are preserved exactly, including signed zero. Derivatives are with respect to normalized u, not time or distance. Position-only evaluation can succeed when a derivative cannot be represented (sample returns OutOfRange).

Related types: float32 · float64 · MathStatus · CubicBezier1

Declared in modules/foundation/math/include/ludus/foundation/math/cubic.hpp

TryEvaluateCubic

MathStatus ludus::foundation::math::TryEvaluateCubic(const CubicBezier2 &curve, float64 u, Vector2 &out) noexcept
Evaluate a 2D cubic position at u, with the contract of the scalar overload.

Returns

NonFiniteInput, InvalidArgument for u outside [0,1], OutOfRange if the position overflows float32.

Related types: float64 · MathStatus · CubicBezier2 · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/cubic.hpp

TryEvaluateCubic

MathStatus ludus::foundation::math::TryEvaluateCubic(const CubicBezier3 &curve, float64 u, Vector3 &out) noexcept
Evaluate a 3D cubic position at u, with the contract of the scalar overload.

Returns

NonFiniteInput, InvalidArgument for u outside [0,1], OutOfRange if the position overflows float32.

Related types: float64 · MathStatus · CubicBezier3 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/cubic.hpp

TryEvaluateCubic

MathStatus ludus::foundation::math::TryEvaluateCubic(const CubicBezier1 &curve, float64 u, CubicSample1 &out) noexcept
Evaluate a scalar cubic value and its first/second derivatives per normalized u.

Returns

OutOfRange when any of the three results overflows float32; out is then unchanged.

Related types: float64 · MathStatus · CubicBezier1 · CubicSample1

Declared in modules/foundation/math/include/ludus/foundation/math/cubic.hpp

TryEvaluateCubic

MathStatus ludus::foundation::math::TryEvaluateCubic(const CubicBezier2 &curve, float64 u, CubicSample2 &out) noexcept
Evaluate a 2D cubic position and its first/second derivatives per normalized u.

Returns

OutOfRange when any of the three results overflows float32; out is then unchanged.

Related types: float64 · MathStatus · CubicBezier2 · CubicSample2

Declared in modules/foundation/math/include/ludus/foundation/math/cubic.hpp

TryEvaluateCubic

MathStatus ludus::foundation::math::TryEvaluateCubic(const CubicBezier3 &curve, float64 u, CubicSample3 &out) noexcept
Evaluate a 3D cubic position and its first/second derivatives per normalized u.

Returns

OutOfRange when any of the three results overflows float32; out is then unchanged.

Related types: float64 · MathStatus · CubicBezier3 · CubicSample3

Declared in modules/foundation/math/include/ludus/foundation/math/cubic.hpp

TryFromHermite

MathStatus ludus::foundation::math::TryFromHermite(const CubicHermite1 &hermite, float64 domainWidth, CubicBezier1 &out) noexcept
Hermite derivatives are per unit of the external domain.
Its finite, positive width h gives B1 = Start + h*StartDerivative/3 and B2 = End - h*EndDerivative/3.

Related types: float64 · MathStatus · CubicBezier1 · CubicHermite1

Declared in modules/foundation/math/include/ludus/foundation/math/cubic.hpp

TryFromHermite

MathStatus ludus::foundation::math::TryFromHermite(const CubicHermite2 &hermite, float64 domainWidth, CubicBezier2 &out) noexcept
Convert a 2D Hermite span over an external domain of width domainWidth to Bezier controls.

Returns

NonFiniteInput, InvalidArgument for a nonpositive width, OutOfRange if a control overflows float32.

Related types: float64 · MathStatus · CubicBezier2 · CubicHermite2

Declared in modules/foundation/math/include/ludus/foundation/math/cubic.hpp

TryFromHermite

MathStatus ludus::foundation::math::TryFromHermite(const CubicHermite3 &hermite, float64 domainWidth, CubicBezier3 &out) noexcept
Convert a 3D Hermite span over an external domain of width domainWidth to Bezier controls.

Returns

NonFiniteInput, InvalidArgument for a nonpositive width, OutOfRange if a control overflows float32.

Related types: float64 · MathStatus · CubicBezier3 · CubicHermite3

Declared in modules/foundation/math/include/ludus/foundation/math/cubic.hpp

TrySplitCubic

MathStatus ludus::foundation::math::TrySplitCubic(const CubicBezier1 &curve, float64 u, CubicBezier1 &outLeft, CubicBezier1 &outRight) noexcept
Left/right cover [0,u]/[u,1], each with its own normalized parameter.
Child derivatives therefore scale by u and 1-u, respectively. At endpoints one child is constant. Input may alias either output; outputs must be distinct.

Related types: float64 · MathStatus · CubicBezier1

Declared in modules/foundation/math/include/ludus/foundation/math/cubic.hpp

TrySplitCubic

MathStatus ludus::foundation::math::TrySplitCubic(const CubicBezier2 &curve, float64 u, CubicBezier2 &outLeft, CubicBezier2 &outRight) noexcept
Split a 2D cubic at u into normalized children, with the contract of the scalar overload.

Returns

NonFiniteInput; InvalidArgument for u outside [0,1] or identical outputs; OutOfRange when a child control overflows float32. Both outputs are unchanged on failure.

Related types: float64 · MathStatus · CubicBezier2

Declared in modules/foundation/math/include/ludus/foundation/math/cubic.hpp

TrySplitCubic

MathStatus ludus::foundation::math::TrySplitCubic(const CubicBezier3 &curve, float64 u, CubicBezier3 &outLeft, CubicBezier3 &outRight) noexcept
Split a 3D cubic at u into normalized children, with the contract of the scalar overload.

Returns

NonFiniteInput; InvalidArgument for u outside [0,1] or identical outputs; OutOfRange when a child control overflows float32. Both outputs are unchanged on failure.

Related types: float64 · MathStatus · CubicBezier3

Declared in modules/foundation/math/include/ludus/foundation/math/cubic.hpp

TryComputeLinearDragStep

MathStatus ludus::foundation::math::TryComputeLinearDragStep(float64 rate, float64 dt, LinearDragStep &out) noexcept
Finite nonnegative rate/dt.
Zero rate gives {1, dt}; tiny rates retain displacement precision. Outputs are unchanged on failure; no allocation.

Related types: float64 · MathStatus · LinearDragStep

Declared in modules/foundation/math/include/ludus/foundation/math/dynamics.hpp

TrySweepRadialBand

MathStatus ludus::foundation::math::TrySweepRadialBand(Vector3d start, Vector3d end, Vector3d origin, float64 radiusStart, float64 radiusEnd, float64 halfWidth, RadialSweepContact &out) noexcept
Earliest overlap of a linearly moving point and a radial band whose radius interpolates from radiusStart to radiusEnd over the SAME normalized interval.
halfWidth includes any hull radius. Supports expansion/shrinkage and initial overlap. Finite coordinates, nonnegative finite radii/width required. A miss is Success with Hit=false. Numeric range failures leave out unchanged. Use Z=0 for 2D annuli. This is geometry, not a force or fluid integrator.

Related types: float64 · MathStatus · RadialSweepContact · Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/dynamics.hpp

TryIntersectEllipticalConeTriangle

bool ludus::foundation::math::TryIntersectEllipticalConeTriangle(const EllipticalCone &cone, const ConeTriangle &triangle, ConeTriangleIntersection &outIntersection) noexcept
Intersect an elliptical conic frustum with a two-sided triangle, without allocation. Computes candidates on the triangle vertices, edges, cone/plane section and clip planes.

Returns

False for invalid/nonfinite inputs or an unrepresentable intermediate; preserves outIntersection. A valid degenerate triangle is a miss. A valid miss returns true and clears outIntersection.

Note

CPU uses float64; the matching Slang primitive uses float32. Grazing/tangent inputs need tolerance-aware comparisons.

Related types: ConeTriangle · ConeTriangleIntersection · EllipticalCone

Declared in modules/foundation/math/include/ludus/foundation/math/elliptical_cone.hpp

TryTestEllipticalConeBounds

bool ludus::foundation::math::TryTestEllipticalConeBounds(const EllipticalCone &cone, Vector3d minimumWorld, Vector3d maximumWorld, bool &outMayIntersect) noexcept
Conservatively test a world-space AABB against the cone, for BVH pruning.

Returns

False for invalid cone/bounds; preserves outMayIntersect. Otherwise writes the overlap possibility. Uses axial clips and eight supporting side planes. False positives are permitted; false negatives are not intended. No scene traversal, allocation or shared state. Bounds with any minimum greater than maximum are empty.

Related types: EllipticalCone · Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/elliptical_cone.hpp

MakePointEnclosure

constexpr Enclosure ludus::foundation::math::MakePointEnclosure(float64 value) noexcept
Enclosure of one exactly known value.
ParameterDescription
value
Finite value; the result is valid only when it is finite.

Related types: float64 · Enclosure

Declared in modules/foundation/math/include/ludus/foundation/math/enclosure.hpp

IsValidEnclosure

bool ludus::foundation::math::IsValidEnclosure(Enclosure enclosure) noexcept
Whether both bounds are finite and Lower <= Upper.

Related types: Enclosure

Declared in modules/foundation/math/include/ludus/foundation/math/enclosure.hpp

NextFloat64Up

float64 ludus::foundation::math::NextFloat64Up(float64 value) noexcept
Next float64 toward positive infinity (IEEE nextafter); NaN stays NaN, +infinity stays +infinity.

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/enclosure.hpp

NextFloat64Down

float64 ludus::foundation::math::NextFloat64Down(float64 value) noexcept
Next float64 toward negative infinity (IEEE nextafter); NaN stays NaN, -infinity stays -infinity.

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/enclosure.hpp

TryAddOutward

MathStatus ludus::foundation::math::TryAddOutward(Enclosure left, Enclosure right, Enclosure &outEnclosure) noexcept
Enclose a + b for every a in left and b in right.

Returns

NonFiniteInput for a nonfinite bound, InvalidArgument for Lower > Upper, OutOfRange when a bound overflows. outEnclosure is unchanged on failure. An exact float64 sum is not widened.

Related types: MathStatus · Enclosure

Declared in modules/foundation/math/include/ludus/foundation/math/enclosure.hpp

TrySubtractOutward

MathStatus ludus::foundation::math::TrySubtractOutward(Enclosure left, Enclosure right, Enclosure &outEnclosure) noexcept
Enclose a - b for every a in left and b in right, with the TryAddOutward contract.

Related types: MathStatus · Enclosure

Declared in modules/foundation/math/include/ludus/foundation/math/enclosure.hpp

TryMultiplyOutward

MathStatus ludus::foundation::math::TryMultiplyOutward(Enclosure left, Enclosure right, Enclosure &outEnclosure) noexcept
Enclose a * b for every a in left and b in right.
Each candidate endpoint product is widened by one unit on both sides unless an operand is exactly zero, so products are never claimed to be exact.

Returns

The TryAddOutward statuses; outEnclosure is unchanged on failure.

Related types: MathStatus · Enclosure

Declared in modules/foundation/math/include/ludus/foundation/math/enclosure.hpp

TrySquareOutward

MathStatus ludus::foundation::math::TrySquareOutward(Enclosure value, Enclosure &outEnclosure) noexcept
Enclose a * a for every a in value; the lower bound is 0 when value contains 0.

Returns

The TryAddOutward statuses; outEnclosure is unchanged on failure.

Related types: MathStatus · Enclosure

Declared in modules/foundation/math/include/ludus/foundation/math/enclosure.hpp

TrySquareRootOutward

MathStatus ludus::foundation::math::TrySquareRootOutward(Enclosure value, Enclosure &outEnclosure) noexcept
Enclose the square root of every a in value.

Returns

The TryAddOutward statuses, and InvalidArgument when value.Lower < 0. The lower bound is never negative. outEnclosure is unchanged on failure.

Related types: MathStatus · Enclosure

Declared in modules/foundation/math/include/ludus/foundation/math/enclosure.hpp

TryComputeGaussianAxes

bool ludus::foundation::math::TryComputeGaussianAxes(Vector3 diagonal, Vector3 cross, GaussianAxes &outAxes) noexcept
Factor a symmetric 3D covariance, including singular planar/linear distributions.
ParameterDescription
diagonal
Variances XX, YY, ZZ in squared input units.
cross
Covariances XY, XZ, YZ in squared input units.
outAxes
Written only on success; unchanged for nonfinite or indefinite inputs.

Returns

True if the covariance is positive semidefinite within relative float32 roundoff.

Note

Negative variances/Schur pivots within 1e-5 times the largest absolute diagonal are clamped to zero. Unresolved off-diagonals at a zero pivot must be within that same tolerance. Uses a Cholesky square root, not principal eigenvectors. All operations are allocation-free.

Related types: GaussianAxes · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/gaussian.hpp

EmptyAabb2

constexpr Aabb2 ludus::foundation::math::EmptyAabb2() noexcept

Related types: Aabb2

Declared in modules/foundation/math/include/ludus/foundation/math/geometry.hpp

EmptyAabb3

constexpr Aabb3 ludus::foundation::math::EmptyAabb3() noexcept

Related types: Aabb3

Declared in modules/foundation/math/include/ludus/foundation/math/geometry.hpp

IsEmpty

constexpr bool ludus::foundation::math::IsEmpty(const Aabb2 &b) noexcept

Related types: Aabb2

Declared in modules/foundation/math/include/ludus/foundation/math/geometry.hpp

IsEmpty

constexpr bool ludus::foundation::math::IsEmpty(const Aabb3 &b) noexcept

Related types: Aabb3

Declared in modules/foundation/math/include/ludus/foundation/math/geometry.hpp

IsFinite

constexpr bool ludus::foundation::math::IsFinite(const Aabb2 &b) noexcept

Related types: Aabb2

Declared in modules/foundation/math/include/ludus/foundation/math/geometry.hpp

IsFinite

constexpr bool ludus::foundation::math::IsFinite(const Aabb3 &b) noexcept

Related types: Aabb3

Declared in modules/foundation/math/include/ludus/foundation/math/geometry.hpp

TryMakeLinearlyTransformedCosine

MathStatus ludus::foundation::math::TryMakeLinearlyTransformedCosine(const Matrix3 &inverseTransform, LinearlyTransformedCosine &outDistribution) noexcept
Make an LTC from its inverse transform M^-1, the matrix that maps the LTC back to a clamped cosine.
The matrix acts on column vectors in the tangent frame of ProjectedPolygonInput: the shading point at the origin and the shading normal along +z. Tabulated isotropic BRDF fits are usually stated in a frame whose x-z plane contains the view direction; the caller composes that rotation into M^-1. Only the direction of M^-1 w matters, so any positive multiple of M^-1 describes the same distribution.
ParameterDescription
inverseTransform
M^-1, with a positive determinant (Peters 2021, section 4.1, requires |M| > 0).
outDistribution
The scaled representation; written only on success.

Returns

Success; NonFiniteInput for a nonfinite entry; Degenerate for a zero matrix, a largest-magnitude entry of at least 2^127 or a determinant that is not positive (a singular matrix or one that mirrors the hemisphere); IllConditioned when the scaled determinant is below MIN_LINEARLY_TRANSFORMED_COSINE_DETERMINANT. outDistribution is unchanged on failure.

Related types: MathStatus · LinearlyTransformedCosine · Matrix3

Declared in modules/foundation/math/include/ludus/foundation/math/linearly_transformed_cosine.hpp

EvaluateLinearlyTransformedCosine

float32 ludus::foundation::math::EvaluateLinearlyTransformedCosine(const LinearlyTransformedCosine &distribution, Vector3 directionTangent) noexcept
Density of an LTC at one direction, per steradian over the whole sphere.
ParameterDescription
distribution
Output of TryMakeLinearlyTransformedCosine.
directionTangent
Unit tangent-space direction.

Returns

p(w) as defined on LinearlyTransformedCosine; zero where (M^-1 w).z <= 0, for a nonfinite or zero direction, or where single precision cannot represent the density.

Related types: float32 · LinearlyTransformedCosine · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/linearly_transformed_cosine.hpp

TryPrepareLinearlyTransformedCosinePolygon

MathStatus ludus::foundation::math::TryPrepareLinearlyTransformedCosinePolygon(const ProjectedPolygonInput &polygon, const LinearlyTransformedCosine &distribution, LinearlyTransformedCosinePolygon &outPolygon) noexcept
Transform a convex polygon by M^-1, clip it to z >= 0 and prepare it for integration and sampling.
The original polygon is not clipped to its own horizon (Peters 2021, section 4.1): the LTC may be positive below the shading horizon and zero in parts above it, so a sample can point below the horizon, where the caller's BRDF evaluates to zero. A transformed polygon below z = 0, or one whose plane contains the shading point, succeeds with an empty TransformedPolygon.
ParameterDescription
polygon
Convex polygon in tangent space; see ProjectedPolygonInput.
distribution
Output of TryMakeLinearlyTransformedCosine.
outPolygon
Prepared state; written only on success.

Returns

The status of TryPrepareProjectedSolidAnglePolygon for the transformed vertices: Success, NonFiniteInput for a nonfinite coordinate (before or after the transform) or InvalidArgument for a vertex count outside [MIN_PROJECTED_POLYGON_VERTICES, MAX_PROJECTED_POLYGON_INPUT_VERTICES]. outPolygon is unchanged on failure.

Related types: MathStatus · LinearlyTransformedCosine · LinearlyTransformedCosinePolygon · ProjectedPolygonInput

Declared in modules/foundation/math/include/ludus/foundation/math/linearly_transformed_cosine.hpp

GetLinearlyTransformedCosinePolygonIntegral

float32 ludus::foundation::math::GetLinearlyTransformedCosinePolygonIntegral(const LinearlyTransformedCosinePolygon &polygon) noexcept
The LTC's integral over the polygon, in [0, 1] (Heitz et al. 2016, Equations 3 and 10).
It equals the projected solid angle of the transformed, clipped polygon divided by pi. Heitz et al. multiply it by the BRDF's norm to approximate the polygon's unshadowed shading.
ParameterDescription
polygon
Output of TryPrepareLinearlyTransformedCosinePolygon.

Returns

The integral; zero when the clip is empty.

Related types: float32 · LinearlyTransformedCosinePolygon

Declared in modules/foundation/math/include/ludus/foundation/math/linearly_transformed_cosine.hpp

TryApproximateClampedCosinePolygonIntegral

MathStatus ludus::foundation::math::TryApproximateClampedCosinePolygonIntegral(const ProjectedPolygonInput &polygon, ApproximatePolygonIntegral &outIntegral) noexcept
Approximate the clamped-cosine (diffuse form factor) integral of a convex polygon clipped to z >= 0.
The cost is one normalization, one cross product and one fitted edge integral per vertex, with no clipping. A polygon whose plane contains the origin, including one with a zero vertex, succeeds with every output zero.
ParameterDescription
polygon
Convex polygon in tangent space; see ProjectedPolygonInput.
outIntegral
The approximation; written only on success.

Returns

Success; NonFiniteInput for a nonfinite coordinate or InvalidArgument for a vertex count outside [MIN_PROJECTED_POLYGON_VERTICES, MAX_PROJECTED_POLYGON_INPUT_VERTICES]. outIntegral is unchanged on failure.

Related types: MathStatus · ApproximatePolygonIntegral · ProjectedPolygonInput

Declared in modules/foundation/math/include/ludus/foundation/math/linearly_transformed_cosine.hpp

TryApproximateLinearlyTransformedCosinePolygonIntegral

MathStatus ludus::foundation::math::TryApproximateLinearlyTransformedCosinePolygonIntegral(const ProjectedPolygonInput &polygon, const LinearlyTransformedCosine &distribution, ApproximatePolygonIntegral &outIntegral) noexcept
Approximate GetLinearlyTransformedCosinePolygonIntegral without clipping or preparing the polygon.
Applies TryApproximateClampedCosinePolygonIntegral to the polygon transformed by M^-1, as Hill and Heitz do for their specular term (slide 63). Only the transformed polygon's horizon matters, as for TryPrepareLinearlyTransformedCosinePolygon.
ParameterDescription
polygon
Convex polygon in tangent space; see ProjectedPolygonInput.
distribution
Output of TryMakeLinearlyTransformedCosine.
outIntegral
The approximation in the LTC's cosine space; written only on success.

Returns

Success; NonFiniteInput for a nonfinite coordinate before or after the transform, or InvalidArgument for an invalid vertex count. outIntegral is unchanged on failure.

Related types: MathStatus · ApproximatePolygonIntegral · LinearlyTransformedCosine · ProjectedPolygonInput

Declared in modules/foundation/math/include/ludus/foundation/math/linearly_transformed_cosine.hpp

TrySampleLinearlyTransformedCosinePolygon

MathStatus ludus::foundation::math::TrySampleLinearlyTransformedCosinePolygon(const LinearlyTransformedCosinePolygon &polygon, Vector2 randomNumbers, Vector3 &outDirectionTangent) noexcept
Map two uniform random numbers to a direction in the polygon distributed proportionally to the LTC.
Samples the transformed polygon in projected solid angle, maps the sample back with M and normalizes it (Heitz et al. 2016, Algorithm 1; Peters 2021, section 4.1). The mapping is continuous in both random numbers. The direction may lie below the shading horizon; see TryPrepareLinearlyTransformedCosinePolygon.

Warning

When the integral is negligible (the tests observe it below 1e-6), the transformed polygon is a sliver whose single-precision projected solid angle sample can be inaccurate, as the paper reports for tiny, distant polygons (Peters 2021, section 3.7). Such a sample may miss the polygon. A caller that finds the light from the sampled direction then sees no hit and adds nothing, and its MIS weight is proportional to the negligible integral.
ParameterDescription
polygon
Output of TryPrepareLinearlyTransformedCosinePolygon.
randomNumbers
Uniform random numbers, each in [0, 1].
outDirectionTangent
Unit tangent-space direction; written only on success.

Returns

Success; NonFiniteInput or InvalidArgument for random numbers outside [0, 1]; Degenerate when the clip is empty; IllConditioned when single precision cannot represent the sample. outDirectionTangent is unchanged on failure.

Related types: MathStatus · LinearlyTransformedCosinePolygon · Vector2 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/linearly_transformed_cosine.hpp

EvaluateLinearlyTransformedCosinePolygonDensity

float32 ludus::foundation::math::EvaluateLinearlyTransformedCosinePolygonDensity(const LinearlyTransformedCosinePolygon &polygon, Vector3 directionTangent) noexcept
Solid-angle density of TrySampleLinearlyTransformedCosinePolygon for one direction.
The density is p(w) divided by the polygon integral. The direction must lie in the polygon's solid angle: it was sampled from this polygon, for example by another technique of the same light, or a ray in this direction hits the polygon. No containment test is performed.
ParameterDescription
polygon
Output of TryPrepareLinearlyTransformedCosinePolygon.
directionTangent
Unit tangent-space direction.

Returns

Density per steradian; zero where (M^-1 w).z <= 0, for a nonfinite or zero direction, for an empty clip, or where single precision cannot represent the density.

Related types: float32 · LinearlyTransformedCosinePolygon · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/linearly_transformed_cosine.hpp

operator*

constexpr Vector3 ludus::foundation::math::operator*(const Matrix3 &m, Vector3 v) noexcept

Related types: Matrix3 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

operator*

constexpr Matrix3 ludus::foundation::math::operator*(const Matrix3 &a, const Matrix3 &b) noexcept

Related types: Matrix3

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

Transpose

constexpr Matrix3 ludus::foundation::math::Transpose(const Matrix3 &m) noexcept

Related types: Matrix3

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

IsFinite

constexpr bool ludus::foundation::math::IsFinite(const Matrix3 &m) noexcept

Related types: Matrix3

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

operator*

constexpr Vector4 ludus::foundation::math::operator*(const Matrix4 &m, Vector4 v) noexcept

Related types: Matrix4 · Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

operator*

constexpr Matrix4 ludus::foundation::math::operator*(const Matrix4 &a, const Matrix4 &b) noexcept

Related types: Matrix4

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

Transpose

constexpr Matrix4 ludus::foundation::math::Transpose(const Matrix4 &m) noexcept

Related types: Matrix4

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

IsFinite

constexpr bool ludus::foundation::math::IsFinite(const Matrix4 &m) noexcept

Related types: Matrix4

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

ToMatrix3

Matrix3 ludus::foundation::math::ToMatrix3(Quaternion q) noexcept
Matrix3 from a UNIT quaternion (trusted unit input). Matches Rotate(q,v).

Related types: Matrix3 · Quaternion

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

TryToRotation

MathStatus ludus::foundation::math::TryToRotation(const Matrix3 &basis, RotationExtractionPolicy policy, Quaternion &out) noexcept
Extract a unit rotation; reject scale, shear, reflection and degenerate/nonfinite bases. Validate the result's rotation action; failure preserves out.

Related types: MathStatus · Matrix3 · Quaternion · RotationExtractionPolicy

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

TryToRotation

MathStatus ludus::foundation::math::TryToRotation(const Matrix3 &basis, Quaternion &out) noexcept
Extract a unit rotation using the default tolerance policy; failure preserves out.

Related types: MathStatus · Matrix3 · Quaternion

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

TryInverse

MathStatus ludus::foundation::math::TryInverse(const Matrix3 &m, InversePolicy policy, Matrix3 &out) noexcept
Fixed-stack scaled-pivot Gauss-Jordan with condition/residual policy.
Returns output unchanged on failure (IllConditioned / Degenerate / OutOfRange / NonFiniteInput). In-place inversion is supported.

Related types: MathStatus · InversePolicy · Matrix3

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

TryInverse

MathStatus ludus::foundation::math::TryInverse(const Matrix4 &m, InversePolicy policy, Matrix4 &out) noexcept

Related types: MathStatus · InversePolicy · Matrix4

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

TryInverse

MathStatus ludus::foundation::math::TryInverse(const Matrix3 &m, Matrix3 &out) noexcept

Related types: MathStatus · Matrix3

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

TryInverse

MathStatus ludus::foundation::math::TryInverse(const Matrix4 &m, Matrix4 &out) noexcept

Related types: MathStatus · Matrix4

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

TryComputeSymmetricMetropolisAcceptance

MathStatus ludus::foundation::math::TryComputeSymmetricMetropolisAcceptance(float32 currentTarget, float32 proposedTarget, float32 &outAcceptance) noexcept
Compute min(1, proposedTarget/currentTarget) for a symmetric proposal kernel. Both unnormalized targets must be finite, positive normal FP32 values. This restriction preserves support even at zero-radiance paths. Failure preserves outAcceptance.

Returns

Success, NonFiniteInput, or InvalidArgument for a nonpositive/subnormal target.

Related types: float32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/metropolis.hpp

TryComputeJumpRestoreRates

MathStatus ludus::foundation::math::TryComputeJumpRestoreRates(float32 target, float32 restorationScale, JumpRestoreRates &outRates) noexcept
Compute the competing-event probabilities without forming an overflowing rate. Both inputs must be finite, positive normal FP32 values. No allocation/thread affinity.

Returns

Success, NonFiniteInput, InvalidArgument or OutOfRange if the mean underflows; failure preserves outRates.

Related types: float32 · MathStatus · JumpRestoreRates

Declared in modules/foundation/math/include/ludus/foundation/math/metropolis.hpp

TrySampleJumpRestoreHoldingTime

MathStatus ludus::foundation::math::TrySampleJumpRestoreHoldingTime(float32 ticket, float32 meanHoldingTime, float32 &outTime) noexcept
Sample Exp(1/meanHoldingTime) with an independent uniform ticket in [0,1). meanHoldingTime must be finite and in (0,1], matching the unit local-rate event law. Uses -log(1-ticket)*meanHoldingTime; a zero ticket gives zero time, never infinity.

Returns

Success, NonFiniteInput, InvalidArgument or OutOfRange; failure preserves outTime.

Related types: float32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/metropolis.hpp

TryMutateMetropolisPrimary

MathStatus ludus::foundation::math::TryMutateMetropolisPrimary(float32 current, float32 ticket, float32 radius, bool isLargeStep, float32 &outSample) noexcept
Wrap a symmetric uniform small step on [0,1), or return ticket for a large step. Inputs are finite, current/ticket in [0,1), and radius in (0,0.5]. Large-step choice must be independent of the state. The mixture then needs no proposal-density ratio.

Returns

Success, NonFiniteInput or InvalidArgument; failure preserves outSample.

Related types: float32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/metropolis.hpp

TryAdvanceMetropolisTour

MathStatus ludus::foundation::math::TryAdvanceMetropolisTour(float32 acceptance, MetropolisTour &inoutTour) noexcept
Include one proposal in the paper's truncated holding-time estimate: P *= 1 - acceptance; holding += P. Call before testing that proposal's acceptance. The accepting proposal is included. This practical truncation is biased; see Holl et al., section 5.4. No extra proposals are generated.

Returns

Success, NonFiniteInput, InvalidArgument or OutOfRange. Failure preserves the tour.

Related types: float32 · MathStatus · MetropolisTour

Declared in modules/foundation/math/include/ludus/foundation/math/metropolis.hpp

TryAddWeightedRadiance

MathStatus ludus::foundation::math::TryAddWeightedRadiance(Vector3 radiance, float32 weight, WeightedRadiance &inoutAccumulation) noexcept
Add one finite, nonnegative RGB sample with a finite, nonnegative weight. A zero weight is a successful no-op. Computes compensated FP32 numerator and denominator transactionally; negative samples, invalid state and overflow reject.

Returns

Success, NonFiniteInput, InvalidArgument or OutOfRange; failure preserves the accumulator.

Related types: float32 · MathStatus · Vector3 · WeightedRadiance

Declared in modules/foundation/math/include/ludus/foundation/math/metropolis.hpp

TryResolveWeightedRadiance

MathStatus ludus::foundation::math::TryResolveWeightedRadiance(const WeightedRadiance &accumulation, Vector3 &outRadiance) noexcept
Resolve numerator/denominator, returning black for an empty accumulator.

Returns

Success, NonFiniteInput, InvalidArgument or OutOfRange; failure preserves outRadiance.

Related types: MathStatus · Vector3 · WeightedRadiance

Declared in modules/foundation/math/include/ludus/foundation/math/metropolis.hpp

TryEvaluatePatch

MathStatus ludus::foundation::math::TryEvaluatePatch(const BicubicBezierPatch &patch, PatchParameter parameter, Vector3 &out) noexcept
Allocation-free, transactional outputs.
All controls and parameters must be finite; U,V are in [0,1]. Corners preserve stored values exactly. Rounded float32 results use float64 intermediates, without a certified error bound. Partials are with respect to normalized U,V. Position-only evaluation does not require representable partials; full samples return OutOfRange if needed.

Related types: MathStatus · BicubicBezierPatch · PatchParameter · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/patch.hpp

TryEvaluatePatch

MathStatus ludus::foundation::math::TryEvaluatePatch(const BicubicBezierPatch &patch, PatchParameter parameter, PatchSample &out) noexcept
Evaluate the position and all first/second partials, with the contract of the position overload.

Returns

OutOfRange when any of the six results overflows float32; out is then unchanged.

Related types: MathStatus · BicubicBezierPatch · PatchParameter · PatchSample

Declared in modules/foundation/math/include/ludus/foundation/math/patch.hpp

TrySplitPatch

MathStatus ludus::foundation::math::TrySplitPatch(const BicubicBezierPatch &patch, PatchParameter parameter, PatchSubdivision &out) noexcept
Four normalized children cover the low/high U and V intervals.
Input may alias a child of out. No adjacency, mesh tessellation or seam policy is implied.

Related types: MathStatus · BicubicBezierPatch · PatchParameter · PatchSubdivision

Declared in modules/foundation/math/include/ludus/foundation/math/patch.hpp

TryPatchNormal

MathStatus ludus::foundation::math::TryPatchNormal(const PatchSample &sample, PatchNormalPolicy policy, Vector3 &out) noexcept
Geometric normal normalize(Cross(DU,DV)), using only finite DU/DV.
Exact zero partials or parallel partials return Degenerate; nonzero partials at/below the policy thresholds return IllConditioned. No universal epsilon is imposed. A singular normal does not invalidate the position. Output may alias DU/DV.

Related types: MathStatus · PatchNormalPolicy · PatchSample · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/patch.hpp

TryMakeRelative

MathStatus ludus::foundation::math::TryMakeRelative(Vector3d position, Vector3d origin, float64 maxAbsComponent, Vector3 &out) noexcept
TryMakeRelative: out = narrow(position - origin).
Requires finite inputs and a positive finite maxAbsComponent (local distance units). Each component of the double difference must be finite and within [-maxAbsComponent, maxAbsComponent] before casting; the narrowed result is re-checked for finiteness. There is no default range on purpose. Output unchanged on failure.

Related types: float64 · MathStatus · Vector3 · Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/precision.hpp

TryClipProjectedPolygonToUpperHemisphere

MathStatus ludus::foundation::math::TryClipProjectedPolygonToUpperHemisphere(const ProjectedPolygonInput &polygon, ProjectedPolygonInput &outPolygon) noexcept
Clip a finite convex polygon to the receiver horizon z >= 0 before another transform.
ParameterDescription
polygon
Three to MAX_PROJECTED_POLYGON_INPUT_VERTICES tangent-space vertices.
outPolygon
Clipped directions with a positive common scale removed, or VertexCount zero for an empty/all-zero polygon. Absolute vertex distances are not retained.

Returns

Success; InvalidArgument for an invalid count or a clipped result too large for ProjectedPolygonInput; NonFiniteInput for a nonfinite position. Failure preserves output.

Related types: MathStatus · ProjectedPolygonInput

Declared in modules/foundation/math/include/ludus/foundation/math/projected_solid_angle.hpp

TryPrepareProjectedSolidAnglePolygon

MathStatus ludus::foundation::math::TryPrepareProjectedSolidAnglePolygon(const ProjectedPolygonInput &polygon, ProjectedSolidAnglePolygon &outPolygon) noexcept
Clip a convex polygon to z >= 0 and prepare it for projected solid angle sampling.
A polygon entirely below the horizon, or one whose plane contains the shading point, succeeds with ProjectedSolidAngle == 0 so a caller can skip the light.
ParameterDescription
polygon
Convex polygon in tangent space; see ProjectedPolygonInput.
outPolygon
Prepared state; written only on success.

Returns

Success, NonFiniteInput for a nonfinite coordinate, or InvalidArgument for a vertex count outside [MIN_PROJECTED_POLYGON_VERTICES, MAX_PROJECTED_POLYGON_INPUT_VERTICES]. outPolygon is unchanged on failure.

Related types: MathStatus · ProjectedPolygonInput · ProjectedSolidAnglePolygon

Declared in modules/foundation/math/include/ludus/foundation/math/projected_solid_angle.hpp

TrySampleProjectedSolidAnglePolygon

MathStatus ludus::foundation::math::TrySampleProjectedSolidAnglePolygon(const ProjectedSolidAnglePolygon &polygon, Vector2 randomNumbers, Vector3 &outDirectionTangent) noexcept
Map two uniform random numbers to a direction uniformly distributed in projected solid angle.
The mapping is continuous in both random numbers, so stratification carries over (paper section 3.2 and Fig. 13). Decentral samples run PROJECTED_POLYGON_ITERATION_COUNT tangent-line iterations; single-precision rounding dominates their error (paper section 3.6 and Fig. 6).
ParameterDescription
polygon
Output of TryPrepareProjectedSolidAnglePolygon.
randomNumbers
Uniform random numbers, each in [0, 1].
outDirectionTangent
Unit tangent-space direction with z >= 0; written only on success.

Returns

Success; NonFiniteInput or InvalidArgument for random numbers outside [0, 1]; Degenerate when ProjectedSolidAngle is zero; IllConditioned when single precision cannot represent the sample, which the paper observes only for extreme tiny, distant polygons (section 3.7, Fig. 7b). outDirectionTangent is unchanged on failure.

Related types: MathStatus · ProjectedSolidAnglePolygon · Vector2 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/projected_solid_angle.hpp

EvaluateProjectedSolidAnglePolygonDensity

float32 ludus::foundation::math::EvaluateProjectedSolidAnglePolygonDensity(const ProjectedSolidAnglePolygon &polygon, Vector3 directionTangent) noexcept
Solid-angle density of TrySampleProjectedSolidAnglePolygon for one direction.
The density is cos(theta) / ProjectedSolidAngle. The direction must lie in the polygon's solid angle: it was sampled from this polygon (for example by another technique of the same light) or a ray in this direction hits the polygon. No containment test is performed.
ParameterDescription
polygon
Output of TryPrepareProjectedSolidAnglePolygon.
directionTangent
Unit tangent-space direction.

Returns

Density per steradian; zero below the horizon, for a nonfinite direction or an empty polygon.

Related types: float32 · ProjectedSolidAnglePolygon · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/projected_solid_angle.hpp

TryLookAt

MathStatus ludus::foundation::math::TryLookAt(Vector3 eye, Vector3 target, Vector3 upHint, Matrix4 &outView) noexcept
TryLookAt: right-handed view matrix. backward z = normalize(eye - target), right x = normalize(cross(upHint, z)), y = cross(z, x).
Coincident eye/target or a parallel/zero upHint fails Degenerate. No hidden up-axis repair; for roll continuity the caller supplies its previous orientation instead.

Related types: MathStatus · Matrix4 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/projection.hpp

TryPerspectiveReverseZ

MathStatus ludus::foundation::math::TryPerspectiveReverseZ(float32 verticalFovRadians, float32 aspect, float32 nearPlane, float32 farPlane, Matrix4 &out) noexcept
Finite reverse-Z perspective. aspect > 0, near > 0, far > near, verticalFov in (0, Pi).
Depth 1 at z=-near, 0 at z=-far. Invalid/degenerate inputs fail; coefficients that are not representable fail OutOfRange.

Related types: float32 · MathStatus · Matrix4

Declared in modules/foundation/math/include/ludus/foundation/math/projection.hpp

TryPerspectiveReverseZInfinite

MathStatus ludus::foundation::math::TryPerspectiveReverseZInfinite(float32 verticalFovRadians, float32 aspect, float32 nearPlane, Matrix4 &out) noexcept
Infinite reverse-Z perspective (far at infinity).
Named factory, NOT a far=infinity sentinel. aspect > 0, near > 0, verticalFov in (0, Pi). A finite camera point at z<0 has depth near/(-z).

Related types: float32 · MathStatus · Matrix4

Declared in modules/foundation/math/include/ludus/foundation/math/projection.hpp

TryOrthographicReverseZ

MathStatus ludus::foundation::math::TryOrthographicReverseZ(float32 left, float32 right, float32 bottom, float32 top, float32 nearPlane, float32 farPlane, Matrix4 &out) noexcept
Finite reverse-Z orthographic. left<right, bottom<top, 0<=near<far.
All inputs finite and correctly ordered; an interval too narrow to produce representable coefficients fails OutOfRange. Zero extents are not clamped.

Related types: float32 · MathStatus · Matrix4

Declared in modules/foundation/math/include/ludus/foundation/math/projection.hpp

TryNdcToFramebuffer

MathStatus ludus::foundation::math::TryNdcToFramebuffer(Vector3 ndc, Viewport viewport, Vector2 &out) noexcept
NDC -> pixel-edge coordinates: px = x + (ndc.x+1)*w/2, py = y + (1-ndc.y)*h/2.
Pixel centres are at +0.5; this does not snap to centres or apply DPR. NDC outside [-1,1] maps outside the rectangle (callers clip). Fails on non-finite NDC or a non-positive/non-finite viewport.

Related types: MathStatus · Vector2 · Vector3 · Viewport

Declared in modules/foundation/math/include/ludus/foundation/math/projection.hpp

TryFramebufferToNdc

MathStatus ludus::foundation::math::TryFramebufferToNdc(Vector2 pixel, Viewport viewport, Vector2 &out) noexcept
Pixel-edge coordinates -> NDC x,y (inverse of the X/Y mapping above).
Depth is not inverted here (callers that need z supply it). Same validation.

Related types: MathStatus · Vector2 · Viewport

Declared in modules/foundation/math/include/ludus/foundation/math/projection.hpp

QuaternionIdentity

constexpr Quaternion ludus::foundation::math::QuaternionIdentity() noexcept
QuaternionIdentity — explicit identity factory for readable call sites.

Related types: Quaternion

Declared in modules/foundation/math/include/ludus/foundation/math/quaternion.hpp

operator*

constexpr Quaternion ludus::foundation::math::operator*(Quaternion a, Quaternion b) noexcept
Hamilton product. a*b composes rotations: apply b, then a.
Does NOT normalise (repeated composition renormalises at an explicit boundary via TryNormalize).

Related types: Quaternion

Declared in modules/foundation/math/include/ludus/foundation/math/quaternion.hpp

Conjugate

constexpr Quaternion ludus::foundation::math::Conjugate(Quaternion q) noexcept
Conjugate negates the vector part.
For a UNIT quaternion this is the inverse rotation; it is not a general non-unit inverse (not provided in v1).

Related types: Quaternion

Declared in modules/foundation/math/include/ludus/foundation/math/quaternion.hpp

Dot

constexpr float32 ludus::foundation::math::Dot(Quaternion a, Quaternion b) noexcept

Related types: float32 · Quaternion

Declared in modules/foundation/math/include/ludus/foundation/math/quaternion.hpp

IsFinite

constexpr bool ludus::foundation::math::IsFinite(Quaternion q) noexcept

Related types: Quaternion

Declared in modules/foundation/math/include/ludus/foundation/math/quaternion.hpp

TryNormalize

MathStatus ludus::foundation::math::TryNormalize(Quaternion q, Quaternion &out) noexcept
Checked normalization of a quaternion (same contract as vector TryNormalize; zero fails Degenerate, non- finite fails NonFiniteInput).
Output unchanged on failure; in-place aliasing supported.

Related types: MathStatus · Quaternion

Declared in modules/foundation/math/include/ludus/foundation/math/quaternion.hpp

TryFromAxisAngle

MathStatus ludus::foundation::math::TryFromAxisAngle(Vector3 axis, float32 angleRadians, Quaternion &out) noexcept
TryFromAxisAngle: finite non-zero axis (normalised internally), finite angle in radians (the physical rotation angle, not a half-angle).
Builds (axis*sin(angle/2), cos(angle/2)) via double intermediates and returns a checked unit quaternion. Zero axis -> Degenerate; non-finite -> NonFiniteInput.

Related types: float32 · MathStatus · Quaternion · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/quaternion.hpp

Rotate

Vector3 ludus::foundation::math::Rotate(Quaternion q, Vector3 v) noexcept
Rotate a vector by a UNIT quaternion q.
Equivalent to Matrix3(q)*v. Trusted: q is a caller obligation (asserted in development). No quaternion*point operator exists.

Related types: Quaternion · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/quaternion.hpp

TryRotationBetween

MathStatus ludus::foundation::math::TryRotationBetween(Vector3 from, Vector3 to, Quaternion &out) noexcept
TryRotationBetween: the shortest-arc rotation mapping unit(from) to unit(to).
Robustly normalises both in double; handles equal, opposite and near-opposite directions deterministically (design §6). Zero directions -> Degenerate.

Related types: MathStatus · Quaternion · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/quaternion.hpp

NlerpShortest

Quaternion ludus::foundation::math::NlerpShortest(Quaternion a, Quaternion b, float32 t) noexcept
Shortest-path interpolation.
Trusted unit a,b and finite t in [0,1]. Both negate b when dot(a,b)<0 so the shorter arc is taken; both return a at t=0 and the hemisphere-corrected b at t=1 (the same rotation as b). Nlerp normalises a linear blend; Slerp uses spherical interpolation with a normalised close-angle fallback. Neither divides by zero for identical or opposite-sign inputs.

Related types: float32 · Quaternion

Declared in modules/foundation/math/include/ludus/foundation/math/quaternion.hpp

SlerpShortest

Quaternion ludus::foundation::math::SlerpShortest(Quaternion a, Quaternion b, float32 t) noexcept

Related types: float32 · Quaternion

Declared in modules/foundation/math/include/ludus/foundation/math/quaternion.hpp

SameRotation

bool ludus::foundation::math::SameRotation(Quaternion a, Quaternion b, float32 toleranceRadians) noexcept
SameRotation: do unit a and b represent the same rotation within an angular tolerance in [0, Pi]? Compares the clamped |dot(a,b)| against cos(tol/2) in double.
This is NOT operator== (which stays componentwise). Non-unit inputs or an out-of-range tolerance return false.

Related types: float32 · Quaternion

Declared in modules/foundation/math/include/ludus/foundation/math/quaternion.hpp

TryMakePlane

MathStatus ludus::foundation::math::TryMakePlane(Vector3 normal, Vector3 point, Plane &out) noexcept
TryMakePlane: normalize a finite non-zero normal, D = -dot(normal, point), narrow-checked.
Zero normal -> Degenerate. Output unchanged on failure.

Related types: MathStatus · Plane · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

TryPlaneSignedDistance

MathStatus ludus::foundation::math::TryPlaneSignedDistance(const Plane &plane, Vector3 p, float32 &out) noexcept
Signed distance of p to a plane with a UNIT normal (validated here, since the public fields can be edited): dot(normal, p) + D.
Non-unit/non-finite plane -> a failing status, output unchanged.

Related types: float32 · MathStatus · Plane · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

TryProjectOntoPlane

MathStatus ludus::foundation::math::TryProjectOntoPlane(const Plane &plane, Vector3 p, Vector3 &out) noexcept
Project p onto the plane (p - distance*normal).
Reflect a vector across the plane normal (v - 2*dot(n,v)*n). Both validate a unit-normal finite plane.

Related types: MathStatus · Plane · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

TryReflectVector

MathStatus ludus::foundation::math::TryReflectVector(const Plane &plane, Vector3 v, Vector3 &out) noexcept

Related types: MathStatus · Plane · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

Merge

Aabb3 ludus::foundation::math::Merge(const Aabb3 &a, const Aabb3 &b) noexcept

Related types: Aabb3

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

Merge

Aabb2 ludus::foundation::math::Merge(const Aabb2 &a, const Aabb2 &b) noexcept

Related types: Aabb2

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

Contains

bool ludus::foundation::math::Contains(const Aabb3 &box, Vector3 point) noexcept

Related types: Aabb3 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

Contains

bool ludus::foundation::math::Contains(const Aabb2 &box, Vector2 point) noexcept

Related types: Aabb2 · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

TryTransformAabb

MathStatus ludus::foundation::math::TryTransformAabb(const Affine3 &a, const Aabb3 &box, Aabb3 &out) noexcept
Conservative affine transform of a box: the result encloses the affine image of all eight corners (four in 2D), including reflection/shear, with outward rounding.
Empty input stays empty. Non-finite input -> NonFiniteInput; an endpoint that would round to infinity -> OutOfRange. Output unchanged on failure.

Related types: MathStatus · Aabb3 · Affine3

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

TryTransformAabb

MathStatus ludus::foundation::math::TryTransformAabb(const Affine2 &a, const Aabb2 &box, Aabb2 &out) noexcept

Related types: MathStatus · Aabb2 · Affine2

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

TryOffsetRayOrigin

MathStatus ludus::foundation::math::TryOffsetRayOrigin(const RayOriginOffset &, Vector3 &output) noexcept
Project the supplied error along the oriented geometric normal and round each nonzero normal component outward. Near zero, a minimum normal float32 step avoids a denormal-only offset being lost by GPU arithmetic. No global scene epsilon or primitive-ID rejection. This requires a valid supplied error bound and cannot preserve gaps smaller than the representable/error interval. Unit-vector squared lengths must be within 1e-5; invalid/nonfinite/range errors preserve output. No allocation; precise FoundationMath implementation only.

Related types: MathStatus · RayOriginOffset · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

IsValidInterval

bool ludus::foundation::math::IsValidInterval(const RayInterval &interval) noexcept
Validate a RayInterval: finite minT >= 0, maxT >= minT (maxT may be +inf).

Related types: RayInterval

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

TryRayAabb

MathStatus ludus::foundation::math::TryRayAabb(const Ray3 &ray, const Aabb3 &box, const RayInterval &interval, RayHit &out) noexcept
Ray/AABB slab test. direction must be finite and non-zero (individual zero components are valid).
Returns Success with Hit/Miss, or a failing status for invalid ray/interval/box. On Hit, EntryT/ExitT are clipped to the interval; an inside start returns EntryT = interval.MinT (no fabricated surface).

Related types: MathStatus · Aabb3 · Ray3 · RayHit · RayInterval

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

TryRaySphere

MathStatus ludus::foundation::math::TryRaySphere(const Ray3 &ray, const Sphere &sphere, const RayInterval &interval, RayHit &out) noexcept
Ray/Sphere.
Cancellation-resistant quadratic; tangent counts as a Hit; a start inside returns EntryT = interval.MinT. Negative radius / non-finite -> failing status. Returns the intersection of the sphere's closed inside interval with the query interval.

Related types: MathStatus · Ray3 · RayHit · RayInterval · Sphere

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

TryClosestPointsSegments

MathStatus ludus::foundation::math::TryClosestPointsSegments(Vector3 p0, Vector3 p1, Vector3 q0, Vector3 q1, SegmentClosest &out) noexcept
Segment 1 = [p0,p1], segment 2 = [q0,q1].
Handles zero-length segments and parallel/degenerate cases; evaluates the interior stationary candidate and all four endpoint projections, selecting the minimum squared distance (ties: lower S then lower T). Non-finite endpoints -> NonFiniteInput. Not an exact topology claim; near-parallel locations may jump while distance stays useful.

Related types: MathStatus · SegmentClosest · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

TryExtractFrustum

MathStatus ludus::foundation::math::TryExtractFrustum(const Matrix4 &worldToClip, FrustumMode mode, Frustum &out) noexcept
Extract six inward normalized planes from a world-to-clip Matrix4 in the named mode.
Finite perspective/orthographic keeps all six active; infinite reverse-Z perspective marks the far (depthLower) plane inactive (it must have zero xyz and a positive constant). Invalid/non-finite matrix or a degenerate required plane fails with output unchanged.

Related types: MathStatus · FrustumMode · Frustum · Matrix4

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

TryClassifySphere

MathStatus ludus::foundation::math::TryClassifySphere(const Frustum &frustum, const Sphere &sphere, float32 margin, FrustumRelation &out) noexcept
Conservative classification with a caller margin >= 0.
A sphere is Outside only if some active inward distance < -(radius + margin); Inside only if every active distance > radius + margin; otherwise Intersecting. The computation adds a documented roundoff allowance so culling never produces a false negative (never culls an object that is actually inside/intersecting) within the tested range. Empty boxes are Outside. Non-finite inputs / negative margin / radius fail with output unchanged.

Related types: float32 · MathStatus · FrustumRelation · Frustum · Sphere

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

TryClassifyAabb

MathStatus ludus::foundation::math::TryClassifyAabb(const Frustum &frustum, const Aabb3 &box, float32 margin, FrustumRelation &out) noexcept

Related types: float32 · MathStatus · FrustumRelation · Aabb3 · Frustum

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

IsRandomDomainInRange

constexpr bool ludus::foundation::math::IsRandomDomainInRange(uint32 id, RandomDomainOwner owner) noexcept
Whether a domain ID lies in the owner's range.

Related types: uint32 · RandomDomainOwner

Declared in modules/foundation/math/include/ludus/foundation/math/random_domains.hpp

CheckRandomDomains

template <usize Count>
constexpr RandomDomainCheck ludus::foundation::math::CheckRandomDomains(const RandomDomain(&domains)[Count], RandomDomainOwner owner) noexcept
Check a manifest: every ID in the owner's range, unique, and every label present.
Usable in constant expressions, so a checked-in manifest can assert itself with static_assert(CheckRandomDomains(DOMAINS, RandomDomainOwner::Game).Status == MathStatus::Success). The comparison is quadratic in the entry count, which suits hand-maintained manifests.
ParameterDescription
domains
The manifest entries, in any order.
owner
The range every entry must use.

Returns

Success, or InvalidArgument with the index of the first entry that is out of range, has a null label or repeats an earlier ID.

Related types: RandomDomainOwner · RandomDomain · RandomDomainCheck

Declared in modules/foundation/math/include/ludus/foundation/math/random_domains.hpp

TryConvertToFloat32

bool ludus::foundation::math::TryConvertToFloat32(float64 value, float32 &outValue) noexcept
Convert a finite binary64 value to binary32 after checking the destination's finite range. Normal floating-point rounding applies, including underflow to signed zero. No allocation/state.
ParameterDescription
value
Finite input to narrow; NaN, infinities and finite range overflow reject.
outValue
Converted value on true; preserved on false.

Returns

Whether the input was finite and within the finite binary32 range.

Related types: float32 · float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

ComputeErrorFunction

float32 ludus::foundation::math::ComputeErrorFunction(float32 value) noexcept
Evaluate the real error function, 2/sqrt(PI) times the integral of exp(-t*t) from 0 to value. Preserves signed zero, propagates NaN, and maps infinities to signed one. No allocation.

Note

CPU uses platform libm; math.slang provides an independently evaluated binary32 approximation. Compare with an absolute tolerance that includes polynomial and backend rounding.

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

ComputeErrorFunction

float64 ludus::foundation::math::ComputeErrorFunction(float64 value) noexcept
Evaluate the real error function, 2/sqrt(PI) times the integral of exp(-t*t) from 0 to value. Preserves signed zero, propagates NaN, and maps infinities to signed one. No allocation.

Note

CPU uses platform libm; math.slang provides an independently evaluated binary32 approximation. Compare with an absolute tolerance that includes polynomial and backend rounding.

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

DegreesToRadians

constexpr float32 ludus::foundation::math::DegreesToRadians(float32 degrees) noexcept

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

RadiansToDegrees

constexpr float32 ludus::foundation::math::RadiansToDegrees(float32 radians) noexcept

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

DegreesToRadians

constexpr float64 ludus::foundation::math::DegreesToRadians(float64 degrees) noexcept

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

RadiansToDegrees

constexpr float64 ludus::foundation::math::RadiansToDegrees(float64 radians) noexcept

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Abs

constexpr float32 ludus::foundation::math::Abs(float32 value) noexcept

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Abs

constexpr float64 ludus::foundation::math::Abs(float64 value) noexcept

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Min

template <typename ScalarType>
constexpr ScalarType ludus::foundation::math::Min(ScalarType a, ScalarType b) noexcept

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Max

template <typename ScalarType>
constexpr ScalarType ludus::foundation::math::Max(ScalarType a, ScalarType b) noexcept

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Clamp

template <typename ScalarType>
constexpr ScalarType ludus::foundation::math::Clamp(ScalarType value, ScalarType lo, ScalarType hi) noexcept
Clamp value into the inclusive interval [lo, hi].
Finite operands and ordered bounds are caller obligations. Reversed bounds trigger a development assertion; there is no checked-domain status result.

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

IsFinite

constexpr bool ludus::foundation::math::IsFinite(float32 value) noexcept
True for a finite value; false for NaN and either infinity.

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

IsFinite

constexpr bool ludus::foundation::math::IsFinite(float64 value) noexcept
True for a finite value; false for NaN and either infinity.

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

IsNaN

constexpr bool ludus::foundation::math::IsNaN(float32 value) noexcept

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

IsNaN

constexpr bool ludus::foundation::math::IsNaN(float64 value) noexcept

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Sqrt

float32 ludus::foundation::math::Sqrt(float32 value) noexcept

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Sqrt

float64 ludus::foundation::math::Sqrt(float64 value) noexcept

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Sin

float32 ludus::foundation::math::Sin(float32 radians) noexcept

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Sin

float64 ludus::foundation::math::Sin(float64 radians) noexcept

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Cos

float32 ludus::foundation::math::Cos(float32 radians) noexcept

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Cos

float64 ludus::foundation::math::Cos(float64 radians) noexcept

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Atan2

float32 ludus::foundation::math::Atan2(float32 y, float32 x) noexcept

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Atan2

float64 ludus::foundation::math::Atan2(float64 y, float64 x) noexcept

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Exp

float64 ludus::foundation::math::Exp(float64 value) noexcept

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Log

float64 ludus::foundation::math::Log(float64 value) noexcept
Natural logarithm with the platform libm log (NaN for negative input, -infinity at zero).

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Floor

float64 ludus::foundation::math::Floor(float64 value) noexcept

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Ceil

float64 ludus::foundation::math::Ceil(float64 value) noexcept

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Pow

float64 ludus::foundation::math::Pow(float64 base, float64 exponent) noexcept
Raise base to exponent with the platform libm pow (IEEE special cases apply). Offline cookers use it to reproduce reference transfer functions bit for bit.

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

DecodeSrgb

float32 ludus::foundation::math::DecodeSrgb(float32 value) noexcept
Decode a finite [0,1] sRGB channel into linear light with the IEC/W3C piecewise transfer. Output stays in [0,1], with exactly preserved black/white endpoints. Values outside this bounded domain return NaN. No allocation/state. Alpha/data channels must not use this color transfer.

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

EncodeSrgb

float32 ludus::foundation::math::EncodeSrgb(float32 value) noexcept
Encode a finite [0,1] linear-light channel into bounded sRGB. Outside-domain values return NaN; exposure/tone mapping remain the renderer's responsibility.

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

NextFloatDown

float32 ludus::foundation::math::NextFloatDown(float32 value) noexcept
Adjacent float32 toward negative infinity. Finite inputs have the IEEE nextafter result, including subnormals/zero; NaN remains NaN. No allocation/state. Callers retain interval/domain obligations when excluding a visibility endpoint.

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

ComputeStandardNormalQuantile

float64 ludus::foundation::math::ComputeStandardNormalQuantile(float64 probability) noexcept
Inverse cumulative distribution function (quantile) of the standard normal distribution.
Returns the x with Phi(x) = probability, where Phi is the standard normal CDF, by Wichura's rational approximation (Algorithm AS241, PPND16; about 1e-16 relative error in float64). The float32 overload evaluates the same coefficients in float32 arithmetic, as FoundationMath's shader ComputeStandardNormalQuantile does, and is accurate to a few float32 ulp. The domain is the open interval (0, 1): 0, 1, values outside it and NaN return NaN, so a caller that maps a [0, 1) random number must first move it into the open interval. Pure, allocation free.

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

ComputeStandardNormalQuantile

float32 ludus::foundation::math::ComputeStandardNormalQuantile(float32 probability) noexcept
Inverse cumulative distribution function (quantile) of the standard normal distribution.
Returns the x with Phi(x) = probability, where Phi is the standard normal CDF, by Wichura's rational approximation (Algorithm AS241, PPND16; about 1e-16 relative error in float64). The float32 overload evaluates the same coefficients in float32 arithmetic, as FoundationMath's shader ComputeStandardNormalQuantile does, and is accurate to a few float32 ulp. The domain is the open interval (0, 1): 0, 1, values outside it and NaN return NaN, so a caller that maps a [0, 1) random number must first move it into the open interval. Pure, allocation free.

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Lerp

float32 ludus::foundation::math::Lerp(float32 a, float32 b, float32 t) noexcept
Lerp is UNCLAMPED and preserves exactly a at t=0 and b at t=1 for finite inputs (it is not the naive a + t*(b-a), which loses the b endpoint). t outside [0,1] extrapolates and may overflow.
Defined in scalar.cpp.

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

Lerp

float64 ludus::foundation::math::Lerp(float64 a, float64 b, float64 t) noexcept
Lerp is UNCLAMPED and preserves exactly a at t=0 and b at t=1 for finite inputs (it is not the naive a + t*(b-a), which loses the b endpoint). t outside [0,1] extrapolates and may overflow.
Defined in scalar.cpp.

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

SmoothStep01

float32 ludus::foundation::math::SmoothStep01(float32 t) noexcept
SmoothStep01 clamps finite t into [0,1] then returns t*t*(3-2*t).
A NaN t yields NaN. Defined in scalar.cpp.

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

SmoothStep01

float64 ludus::foundation::math::SmoothStep01(float64 t) noexcept
SmoothStep01 clamps finite t into [0,1] then returns t*t*(3-2*t).
A NaN t yields NaN. Defined in scalar.cpp.

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

TrySmoothStep

MathStatus ludus::foundation::math::TrySmoothStep(float32 edge0, float32 edge1, float32 x, float32 &out) noexcept
TrySmoothStep maps x through the Hermite smoothstep over [edge0, edge1], clamping to [0,1].
Rejects non-finite inputs (NonFiniteInput) and equal or reversed bounds (InvalidArgument). On failure *out is unchanged.

Related types: float32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

TrySmoothStep

MathStatus ludus::foundation::math::TrySmoothStep(float64 edge0, float64 edge1, float64 x, float64 &out) noexcept
TrySmoothStep maps x through the Hermite smoothstep over [edge0, edge1], clamping to [0,1].
Rejects non-finite inputs (NonFiniteInput) and equal or reversed bounds (InvalidArgument). On failure *out is unchanged.

Related types: float64 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

NearlyEqual

bool ludus::foundation::math::NearlyEqual(float32 a, float32 b, float32 absTol, float32 relTol) noexcept
NearlyEqual: abs(a-b) <= max(absTol, relTol*max(abs(a),abs(b))).
Negative or non-finite tolerances or operands return false; infinities are never nearly equal (even two identical infinities return false, since the comparison is about finite proximity). float32 uses a float64 intermediate. There is no default tolerance — callers must pass tolerances meaningful for their units.

Related types: float32

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

NearlyEqual

bool ludus::foundation::math::NearlyEqual(float64 a, float64 b, float64 absTol, float64 relTol) noexcept
NearlyEqual: abs(a-b) <= max(absTol, relTol*max(abs(a),abs(b))).
Negative or non-finite tolerances or operands return false; infinities are never nearly equal (even two identical infinities return false, since the comparison is about finite proximity). float32 uses a float64 intermediate. There is no default tolerance — callers must pass tolerances meaningful for their units.

Related types: float64

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

TryApproachExponential

MathStatus ludus::foundation::math::TryApproachExponential(float32 current, float32 target, float32 rate, float32 dt, float32 &out) noexcept
TryApproachExponential: exact first-order exponential decay of current toward a constant target over dt at the given rate.
Requires finite current and target, and finite non-negative rate and dt (else NonFiniteInput / InvalidArgument, output unchanged). rate==0 or dt==0 preserves current. The blend is computed as -expm1(-rate*dt) in float64; a very large rate*dt saturates the blend to 1 without forming an invalid product. This is NOT a spring, velocity model or moving-target integrator.

Related types: float32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

TryApproachExponential

MathStatus ludus::foundation::math::TryApproachExponential(float64 current, float64 target, float64 rate, float64 dt, float64 &out) noexcept
TryApproachExponential: exact first-order exponential decay of current toward a constant target over dt at the given rate.
Requires finite current and target, and finite non-negative rate and dt (else NonFiniteInput / InvalidArgument, output unchanged). rate==0 or dt==0 preserves current. The blend is computed as -expm1(-rate*dt) in float64; a very large rate*dt saturates the blend to 1 without forming an invalid product. This is NOT a spring, velocity model or moving-target integrator.

Related types: float64 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

TryClipShadingNormalToOutgoingHemisphere

MathStatus ludus::foundation::math::TryClipShadingNormalToOutgoingHemisphere(Vector3 normal, Vector3 outgoingDirection, Vector3 &outNormal) noexcept
Clip a unit shading normal to the hemisphere of a unit outgoing direction (Peters 2021, section 6.1).
A normal whose cosine with outgoingDirection is at least SHADING_NORMAL_MINIMUM_OUTGOING_COSINE is returned unchanged. Otherwise the normal moves along outgoingDirection until that cosine is SHADING_NORMAL_MINIMUM_OUTGOING_COSINE and is renormalized, which keeps the result continuous in both inputs; a normal facing directly away becomes outgoingDirection. Callers shade with the result everywhere it stands for the surface: the shading frame, the light sampling techniques and the BSDF.
ParameterDescription
normal
Unit shading normal, for example an interpolated or normal-mapped normal.
outgoingDirection
Unit direction from the surface towards the viewer.
outNormal
The clipped unit normal; unchanged on failure.

Returns

Success; NonFiniteInput for a nonfinite input. Unit length is a precondition that is not detected; inputs that violate it so far that the clipped vector is zero return Degenerate.

Note

Pure function with no allocation or thread affinity.

Related types: MathStatus · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/shading_normal.hpp

IsSuccess

constexpr bool ludus::foundation::math::IsSuccess(MathStatus status) noexcept
IsSuccess — tiny readable predicate for call sites that branch on status.

Related types: MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/status.hpp

TryComputePairwiseConfidenceScale

MathStatus ludus::foundation::math::TryComputePairwiseConfidenceScale(uint32 drawCount, uint32 neighborCount, float32 &outScale) noexcept
Compute the defensive neighbor-confidence scale min(drawCount / neighborCount, 1). Zero neighbors produces zero; drawCount must be positive. Apply this one scale to every neighbor confidence and to their sum before computing either canonical or neighbor MIS.
ParameterDescription
drawCount
Positive number of independent with-replacement draws.
neighborCount
Number of noncanonical proposals in the reuse set; may be zero.
outScale
Written on success; preserved on failure.

Returns

Success or InvalidArgument for zero draws. No allocation or thread affinity.

Related types: float32 · uint32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/stochastic_pairwise_mis.hpp

TryComputePairwiseCanonicalBase

MathStatus ludus::foundation::math::TryComputePairwiseCanonicalBase(float32 confidenceSum, float32 canonicalConfidence, float32 &outWeight) noexcept
Compute the defensive canonical base weight c_c / (c_sum + c_c), equation 18. Confidences are finite, nonnegative and in common arbitrary units; canonicalConfidence must be positive. confidenceSum is the sum of scaled noncanonical confidences.
ParameterDescription
confidenceSum
Sum of all scaled noncanonical confidences; finite and nonnegative.
canonicalConfidence
Finite positive confidence of the destination proposal.
outWeight
Written on success; preserved on failure.

Returns

Success, NonFiniteInput, or InvalidArgument. No allocation or thread affinity.

Related types: float32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/stochastic_pairwise_mis.hpp

TryComputePairwiseNeighborMis

MathStatus ludus::foundation::math::TryComputePairwiseNeighborMis(float32 neighborConfidence, float32 confidenceSum, float32 canonicalConfidence, float32 sourceTargetInDestinationMeasure, float32 destinationTarget, float32 &outWeight) noexcept
Compute a deterministic defensive noncanonical pairwise MIS weight, equation 11a. Targets must be finite, nonnegative densities in the destination measure at the same shifted sample. sourceTargetInDestinationMeasure is p_i(x_i) / abs(J_i_to_c), including source proposal support; it is NOT the untransformed source target for non-unit shifts. Confidences must be finite, 0 <= neighborConfidence <= confidenceSum and canonicalConfidence > 0. Zero neighbor confidence or two zero targets yields zero.
ParameterDescription
neighborConfidence
Scaled confidence of this noncanonical proposal in common confidence units.
confidenceSum
Sum of all scaled noncanonical confidences; finite and nonnegative.
canonicalConfidence
Finite positive confidence of the destination proposal.
sourceTargetInDestinationMeasure
Finite nonnegative source target divided by its forward absolute Jacobian, including inverse proposal support.
destinationTarget
Finite nonnegative destination density at this same shifted sample.
outWeight
Written on success; preserved on failure.

Returns

Success, NonFiniteInput, or InvalidArgument. No allocation or thread affinity.

Note

Callers own shifts, support tests and valid input contribution weights. The formula alone does not establish an unbiased estimator. FP32 rounding/subnormal flushing applies.

Related types: float32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/stochastic_pairwise_mis.hpp

TryComputePairwiseCanonicalTerm

MathStatus ludus::foundation::math::TryComputePairwiseCanonicalTerm(float32 neighborConfidence, float32 confidenceSum, float32 canonicalConfidence, float32 sourceTargetInDestinationMeasure, float32 destinationTarget, float32 &outWeight) noexcept
Compute one canonical pairwise correction beta_i, equation 19, at the canonical sample. Inputs have the same domains and common-measure contract as TryComputePairwiseNeighborMis. For a neighbor unable to propose the canonical sample, pass a zero source target. Add beta_i / (canonicalDrawCount * canonicalSelectionPmf) per independently drawn neighbor to TryComputePairwiseCanonicalBase; repeated draws retain multiplicity.
ParameterDescription
neighborConfidence
Scaled confidence of this noncanonical proposal in common confidence units.
confidenceSum
Sum of all scaled noncanonical confidences; finite and nonnegative.
canonicalConfidence
Finite positive confidence of the destination proposal.
sourceTargetInDestinationMeasure
Finite nonnegative source target divided by its forward absolute Jacobian, including inverse proposal support.
destinationTarget
Finite nonnegative destination density at this same shifted sample.
outWeight
Written on success; preserved on failure.

Returns

Success, NonFiniteInput, or InvalidArgument. No allocation or thread affinity.

Related types: float32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/stochastic_pairwise_mis.hpp

TryComputeStochasticMisWeight

MathStatus ludus::foundation::math::TryComputeStochasticMisWeight(float32 misWeight, float32 selectionPmf, uint32 drawCount, float32 &outWeight) noexcept
Correct one with-replacement draw by its actual selection probability, equation 15. Returns misWeight / (drawCount * selectionPmf). misWeight is finite and nonnegative; selectionPmf is finite in (0,1] and drawCount is positive. Stream each occurrence or multiply by its multiplicity. A proposal must have positive probability wherever its MIS-weighted contribution can be nonzero. Draw coins must be fresh conditional on inputs.
ParameterDescription
misWeight
Finite nonnegative MIS weight.
selectionPmf
Actual probability of this drawn proposal in (0,1].
drawCount
Positive number of independent with-replacement draws.
outWeight
Written on success; preserved on failure.

Returns

Success, NonFiniteInput, InvalidArgument or OutOfRange for overflow.

Note

No allocation or thread affinity; probability/ticket quantization is caller-owned.

Related types: float32 · uint32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/stochastic_pairwise_mis.hpp

TryComputePairwiseShiftedTarget

MathStatus ludus::foundation::math::TryComputePairwiseShiftedTarget(float32 sourceTarget, float32 forwardJacobian, float32 &outTarget) noexcept
Express a source target in the destination measure: p_i(x) / abs(J_i_to_c), equation 10. Inputs are finite and nonnegative. A zero Jacobian denotes a failed partial shift and produces zero support. Callers must also zero support for impossible inverse proposals.
ParameterDescription
sourceTarget
Finite nonnegative density in the source measure.
forwardJacobian
Finite nonnegative absolute Jacobian from source to destination; zero denotes failed shift.
outTarget
Written on success; preserved on failure.

Returns

Success, NonFiniteInput, InvalidArgument or OutOfRange for overflow. No allocation or thread affinity.

Related types: float32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/stochastic_pairwise_mis.hpp

TryComputePairwiseResamplingWeight

MathStatus ludus::foundation::math::TryComputePairwiseResamplingWeight(float32 misWeight, float32 destinationTarget, float32 sourceContributionWeight, float32 forwardJacobian, float32 &outWeight) noexcept
Compute a shifted GRIS resampling weight m * p_c(y) * W_i * abs(J_i_to_c), equation 14. All inputs must be finite and nonnegative. misWeight normally includes the stochastic correction; sourceContributionWeight is a valid input UCW, not a streaming weight sum. forwardJacobian is zero for a failed shift. The caller supplies visibility/support policy.
ParameterDescription
misWeight
Finite nonnegative MIS weight, stochastically corrected when used for resampling.
destinationTarget
Finite nonnegative destination density at this same shifted sample.
sourceContributionWeight
Finite nonnegative input UCW in the source measure.
forwardJacobian
Finite nonnegative absolute Jacobian from source to destination; zero denotes failed shift.
outWeight
Written on success; preserved on failure.

Returns

Success, NonFiniteInput, InvalidArgument or OutOfRange for FP32 intermediate overflow. No allocation or thread affinity.

Related types: float32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/stochastic_pairwise_mis.hpp

TryComputePairwiseContributionWeight

MathStatus ludus::foundation::math::TryComputePairwiseContributionWeight(float32 weightSum, float32 selectedTarget, float32 &outWeight) noexcept
Finalize pairwise GRIS with W = weightSum / selectedTarget, equation 7, WITHOUT dividing by M. weightSum must be finite and nonnegative. An empty sum yields zero without examining selectedTarget; otherwise selectedTarget must be finite and positive, in the destination measure and identical to the target used for the selected candidate's resampling weight.
ParameterDescription
weightSum
Finite nonnegative sum of streamed candidate resampling weights.
selectedTarget
Selected density in the destination measure; positive for a nonempty sum.
outWeight
Written on success; preserved on failure.

Returns

Success, NonFiniteInput, InvalidArgument or OutOfRange for overflow. No allocation or thread affinity.

Related types: float32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/stochastic_pairwise_mis.hpp

CompensatedDot

float64 ludus::foundation::math::CompensatedDot(Vector3d a, Vector3d b) noexcept
Dot product whose three products are added with CompensatedSum in X, Y, Z order.

Related types: float64 · Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/summation.hpp

TransformPoint

constexpr Vector2 ludus::foundation::math::TransformPoint(const Affine2 &a, Vector2 p) noexcept

Related types: Affine2 · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

TransformVector

constexpr Vector2 ludus::foundation::math::TransformVector(const Affine2 &a, Vector2 v) noexcept

Related types: Affine2 · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

Compose

constexpr Affine2 ludus::foundation::math::Compose(const Affine2 &a, const Affine2 &b) noexcept

Related types: Affine2

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

IsFinite

constexpr bool ludus::foundation::math::IsFinite(const Affine2 &a) noexcept

Related types: Affine2

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

TransformPoint

constexpr Vector3 ludus::foundation::math::TransformPoint(const Affine3 &a, Vector3 p) noexcept

Related types: Affine3 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

TransformVector

constexpr Vector3 ludus::foundation::math::TransformVector(const Affine3 &a, Vector3 v) noexcept

Related types: Affine3 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

Compose

constexpr Affine3 ludus::foundation::math::Compose(const Affine3 &a, const Affine3 &b) noexcept

Related types: Affine3

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

IsFinite

constexpr bool ludus::foundation::math::IsFinite(const Affine3 &a) noexcept

Related types: Affine3

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

LinearBlock

constexpr Matrix3 ludus::foundation::math::LinearBlock(const Affine3 &a) noexcept
Linear block of an Affine3 as a Matrix3 (helper for conversions/queries).

Related types: Affine3 · Matrix3

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

TryInverse

MathStatus ludus::foundation::math::TryInverse(const Affine2 &a, InversePolicy policy, Affine2 &out) noexcept
Inverse(A) = { inverse(A.L), -inverse(A.L) * A.t }, evaluating the LINEAR block's condition separately (singular scale -> IllConditioned/Degenerate).
Translation computed in double and narrow-checked. In-place supported.

Related types: MathStatus · Affine2 · InversePolicy

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

TryInverse

MathStatus ludus::foundation::math::TryInverse(const Affine3 &a, InversePolicy policy, Affine3 &out) noexcept

Related types: MathStatus · Affine3 · InversePolicy

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

TryInverse

MathStatus ludus::foundation::math::TryInverse(const Affine2 &a, Affine2 &out) noexcept

Related types: MathStatus · Affine2

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

TryInverse

MathStatus ludus::foundation::math::TryInverse(const Affine3 &a, Affine3 &out) noexcept

Related types: MathStatus · Affine3

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

TryNormalMatrix

MathStatus ludus::foundation::math::TryNormalMatrix(const Affine3 &a, InversePolicy policy, Matrix3 &out) noexcept
NormalMatrix(A) = transpose(inverse(A.L)); singular L fails.

Related types: MathStatus · Affine3 · InversePolicy · Matrix3

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

TryTransformNormal

MathStatus ludus::foundation::math::TryTransformNormal(const Affine3 &a, Vector3 normal, Vector3 &out) noexcept
TryTransformNormal applies the normal matrix then robustly normalises.
A zero-length input normal fails Degenerate; a singular transform fails the inverse. Do NOT use TransformVector for normals under non-uniform scale/shear.

Related types: MathStatus · Affine3 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

ToAffine3

Affine3 ludus::foundation::math::ToAffine3(const TransformTRS &trs) noexcept
Trusted conversion: accepts previously-validated authoring values (unit rotation assumed).
L = Rotation(q) * Diagonal(scale).

Related types: Affine3 · TransformTRS

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

TryToAffine3

MathStatus ludus::foundation::math::TryToAffine3(const TransformTRS &trs, float32 rotationUnitTol, Affine3 &out) noexcept
Checked conversion for imported data: validates finite fields and a unit rotation (within rotationUnitTol).
Output unchanged on failure.

Related types: float32 · MathStatus · Affine3 · TransformTRS

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

ToMatrix4

constexpr Matrix4 ludus::foundation::math::ToMatrix4(const Affine3 &a) noexcept

Related types: Affine3 · Matrix4

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

TransformHomogeneous

constexpr Vector4 ludus::foundation::math::TransformHomogeneous(const Matrix4 &m, Vector4 p) noexcept
Transform a homogeneous point: produces a Vector4; it never silently divides.

Related types: Matrix4 · Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

TryPerspectiveDivide

MathStatus ludus::foundation::math::TryPerspectiveDivide(Vector4 clip, float32 minAbsW, Vector3 &out) noexcept
TryPerspectiveDivide: divide xyz by w.
Rejects non-finite input, w == 0, or abs(w) <= minAbsW (caller-supplied finite non-negative threshold), and a non-representable result (OutOfRange). Negative w is permitted (visibility is a separate operation). Output unchanged on failure.

Related types: float32 · MathStatus · Vector3 · Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

operator+

constexpr Vector2 ludus::foundation::math::operator+(Vector2 a, Vector2 b) noexcept

Related types: Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator-

constexpr Vector2 ludus::foundation::math::operator-(Vector2 a, Vector2 b) noexcept

Related types: Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator-

constexpr Vector2 ludus::foundation::math::operator-(Vector2 v) noexcept

Related types: Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator*

constexpr Vector2 ludus::foundation::math::operator*(Vector2 v, float32 s) noexcept

Related types: float32 · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator*

constexpr Vector2 ludus::foundation::math::operator*(float32 s, Vector2 v) noexcept

Related types: float32 · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator/

constexpr Vector2 ludus::foundation::math::operator/(Vector2 v, float32 s) noexcept

Related types: float32 · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Dot

constexpr float32 ludus::foundation::math::Dot(Vector2 a, Vector2 b) noexcept

Related types: float32 · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Cross

constexpr float32 ludus::foundation::math::Cross(Vector2 a, Vector2 b) noexcept
2D scalar cross (z of the 3D cross of (x,y,0)); signed parallelogram area.

Related types: float32 · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Hadamard

constexpr Vector2 ludus::foundation::math::Hadamard(Vector2 a, Vector2 b) noexcept

Related types: Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator+

constexpr Vector3 ludus::foundation::math::operator+(Vector3 a, Vector3 b) noexcept

Related types: Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator-

constexpr Vector3 ludus::foundation::math::operator-(Vector3 a, Vector3 b) noexcept

Related types: Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator-

constexpr Vector3 ludus::foundation::math::operator-(Vector3 v) noexcept

Related types: Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator*

constexpr Vector3 ludus::foundation::math::operator*(Vector3 v, float32 s) noexcept

Related types: float32 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator*

constexpr Vector3 ludus::foundation::math::operator*(float32 s, Vector3 v) noexcept

Related types: float32 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator/

constexpr Vector3 ludus::foundation::math::operator/(Vector3 v, float32 s) noexcept

Related types: float32 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Dot

constexpr float32 ludus::foundation::math::Dot(Vector3 a, Vector3 b) noexcept

Related types: float32 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Cross

constexpr Vector3 ludus::foundation::math::Cross(Vector3 a, Vector3 b) noexcept
Right-handed cross product: Cross(+X,+Y) = +Z.

Related types: Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Hadamard

constexpr Vector3 ludus::foundation::math::Hadamard(Vector3 a, Vector3 b) noexcept

Related types: Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator+

constexpr Vector4 ludus::foundation::math::operator+(Vector4 a, Vector4 b) noexcept

Related types: Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator-

constexpr Vector4 ludus::foundation::math::operator-(Vector4 a, Vector4 b) noexcept

Related types: Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator-

constexpr Vector4 ludus::foundation::math::operator-(Vector4 v) noexcept

Related types: Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator*

constexpr Vector4 ludus::foundation::math::operator*(Vector4 v, float32 s) noexcept

Related types: float32 · Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator*

constexpr Vector4 ludus::foundation::math::operator*(float32 s, Vector4 v) noexcept

Related types: float32 · Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator/

constexpr Vector4 ludus::foundation::math::operator/(Vector4 v, float32 s) noexcept

Related types: float32 · Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Dot

constexpr float32 ludus::foundation::math::Dot(Vector4 a, Vector4 b) noexcept

Related types: float32 · Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Hadamard

constexpr Vector4 ludus::foundation::math::Hadamard(Vector4 a, Vector4 b) noexcept

Related types: Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator+

constexpr Vector3d ludus::foundation::math::operator+(Vector3d a, Vector3d b) noexcept

Related types: Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator-

constexpr Vector3d ludus::foundation::math::operator-(Vector3d a, Vector3d b) noexcept

Related types: Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator-

constexpr Vector3d ludus::foundation::math::operator-(Vector3d v) noexcept

Related types: Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator*

constexpr Vector3d ludus::foundation::math::operator*(Vector3d v, float64 s) noexcept

Related types: float64 · Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

operator*

constexpr Vector3d ludus::foundation::math::operator*(float64 s, Vector3d v) noexcept

Related types: float64 · Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Hadamard

constexpr Vector3d ludus::foundation::math::Hadamard(Vector3d first, Vector3d second) noexcept
Componentwise binary64 product; does not normalize or change coordinate space.

Related types: Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Dot

constexpr float64 ludus::foundation::math::Dot(Vector3d a, Vector3d b) noexcept

Related types: float64 · Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Cross

constexpr Vector3d ludus::foundation::math::Cross(Vector3d a, Vector3d b) noexcept
Right-handed cross product at double precision: Cross(+X,+Y) = +Z.

Related types: Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

IsFinite

constexpr bool ludus::foundation::math::IsFinite(Vector2 v) noexcept

Related types: Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

IsFinite

constexpr bool ludus::foundation::math::IsFinite(Vector3 v) noexcept

Related types: Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

IsFinite

constexpr bool ludus::foundation::math::IsFinite(Vector4 v) noexcept

Related types: Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

IsFinite

constexpr bool ludus::foundation::math::IsFinite(Vector3d v) noexcept

Related types: Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Lerp

Vector2 ludus::foundation::math::Lerp(Vector2 a, Vector2 b, float32 t) noexcept

Related types: float32 · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Lerp

Vector3 ludus::foundation::math::Lerp(Vector3 a, Vector3 b, float32 t) noexcept

Related types: float32 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Lerp

Vector4 ludus::foundation::math::Lerp(Vector4 a, Vector4 b, float32 t) noexcept

Related types: float32 · Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

LengthSquared

constexpr float32 ludus::foundation::math::LengthSquared(Vector2 v) noexcept
LengthSquared and Dot are ordinary arithmetic and may overflow for extreme inputs (no range-robustness claim).
Length uses scaled components so it does not overflow/underflow spuriously, but may still overflow if the true length exceeds the return type's finite range.

Related types: float32 · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

LengthSquared

constexpr float32 ludus::foundation::math::LengthSquared(Vector3 v) noexcept

Related types: float32 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

LengthSquared

constexpr float32 ludus::foundation::math::LengthSquared(Vector4 v) noexcept

Related types: float32 · Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

LengthSquared

constexpr float64 ludus::foundation::math::LengthSquared(Vector3d v) noexcept

Related types: float64 · Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Length

float32 ludus::foundation::math::Length(Vector2 v) noexcept

Related types: float32 · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Length

float32 ludus::foundation::math::Length(Vector3 v) noexcept

Related types: float32 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Length

float32 ludus::foundation::math::Length(Vector4 v) noexcept

Related types: float32 · Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Length

float64 ludus::foundation::math::Length(Vector3d v) noexcept

Related types: float64 · Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Distance

float32 ludus::foundation::math::Distance(Vector2 a, Vector2 b) noexcept

Related types: float32 · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Distance

float32 ludus::foundation::math::Distance(Vector3 a, Vector3 b) noexcept

Related types: float32 · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

Distance

float64 ludus::foundation::math::Distance(Vector3d a, Vector3d b) noexcept

Related types: float64 · Vector3d

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

TryNormalize

MathStatus ludus::foundation::math::TryNormalize(Vector2 v, float32 minLength, Vector2 &out) noexcept
TryNormalize: requires finite v and finite minLength >= 0.
Fails Degenerate for a zero vector (always) or a vector whose true length is <= minLength; fails NonFiniteInput for non-finite v or minLength; fails InvalidArgument for negative minLength. minLength is a LENGTH, not a squared length; default 0 admits any representable non-zero finite vector. On any failure *out is unchanged (aliasing with v is supported). The unit result is always finite.

Related types: float32 · MathStatus · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

TryNormalize

MathStatus ludus::foundation::math::TryNormalize(Vector3 v, float32 minLength, Vector3 &out) noexcept

Related types: float32 · MathStatus · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

TryNormalize

MathStatus ludus::foundation::math::TryNormalize(Vector4 v, float32 minLength, Vector4 &out) noexcept

Related types: float32 · MathStatus · Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

TryNormalize

MathStatus ludus::foundation::math::TryNormalize(Vector2 v, Vector2 &out) noexcept

Related types: MathStatus · Vector2

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

TryNormalize

MathStatus ludus::foundation::math::TryNormalize(Vector3 v, Vector3 &out) noexcept

Related types: MathStatus · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

TryNormalize

MathStatus ludus::foundation::math::TryNormalize(Vector4 v, Vector4 &out) noexcept

Related types: MathStatus · Vector4

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

TryNormalizeOr

MathStatus ludus::foundation::math::TryNormalizeOr(Vector3 v, float32 minLength, Vector3 fallback, float32 unitTol, Vector3 &out) noexcept
TryNormalizeOr: on a Degenerate v, writes the caller-supplied fallback (which must itself be a finite unit vector within unitTol, else InvalidArgument).
It never invents a default direction. Non-finite v still fails NonFiniteInput. Prefer TryNormalize unless a validated fallback exists.

Related types: float32 · MathStatus · Vector3

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

TryAddReservoirCandidate

MathStatus ludus::foundation::math::TryAddReservoirCandidate(ReservoirCandidate candidate, WeightedReservoir &inoutReservoir, bool &outIsSelected)
Streams the next candidate: adds its weight to the sum and selects it when Ticket * sum < Weight.
A zero-weight candidate is counted but never selected; weights below WEIGHTED_RESERVOIR_MINIMUM_WEIGHT count as zero. The first candidate with a positive weight is always selected, so the reservoir is empty exactly while the sum is zero. A subnormal ticket counts as zero, because GPU arithmetic may flush it. Weight and ticket are classified from their bit patterns, so -0 is a zero weight and a valid zero ticket. Acceptance is quantized by the ticket's resolution (2^-24 for SampleFloat01), a declared approximation.
ParameterDescription
candidate
Weight and ticket of the candidate at stream position GetCandidateCount().
inoutReservoir
Reservoir updated on success and left unchanged on failure.
outIsSelected
Written on success: true when this candidate replaced the selection.

Returns

Success; NonFiniteInput for a NaN or infinite weight or ticket; InvalidArgument for a negative weight or a ticket outside [0,1); OutOfRange when the weight sum would overflow to infinity or the candidate count would exceed 2^32 - 1. Failure leaves both outputs unchanged.

Related types: WeightedReservoir · MathStatus · ReservoirCandidate

Declared in modules/foundation/math/include/ludus/foundation/math/weighted_reservoir.hpp

TryComputeReservoirContributionWeight

MathStatus ludus::foundation::math::TryComputeReservoirContributionWeight(const WeightedReservoir &reservoir, float32 selectedTarget, float32 &outWeight) noexcept
Computes the RIS contribution weight W = w_sum / (M * target(selected)) of a finished stream.
For any integrand g that is zero wherever the target is zero, E[W * g(Y)] equals the sum (or integral) of g. An empty reservoir is a valid zero contribution: outWeight becomes 0 and selectedTarget is not examined. The division is FP32; GPU backends may round it differently within their division accuracy. A subnormal result is flushed to zero, as GPU arithmetic may do.
ParameterDescription
reservoir
Reservoir after the caller streamed all of its candidates.
selectedTarget
Unnormalized target density of the selected candidate, as used in its weight. It must be a finite, positive, normal FP32 value when the reservoir has a selection.
outWeight
Written on success with W, or with zero for an empty reservoir.

Returns

Success; NonFiniteInput for a NaN or infinite target; InvalidArgument for a zero, negative or subnormal target; OutOfRange when M * target or the quotient is not finite. Failure leaves outWeight unchanged.

Related types: WeightedReservoir · float32 · MathStatus

Declared in modules/foundation/math/include/ludus/foundation/math/weighted_reservoir.hpp

Aliases

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

uint16

using ludus::foundation::core::uint16 = std::uint16_t
Exact 16-bit unsigned integer for explicit-width values.

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

uint32

using ludus::foundation::core::uint32 = std::uint32_t
Exact 32-bit unsigned integer for explicit-width values.

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

uint64

using ludus::foundation::core::uint64 = std::uint64_t
Exact 64-bit unsigned integer for explicit-width values.

Declared in modules/foundation/math/include/ludus/foundation/math/addressed_random.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/batch.hpp

float64

using ludus::foundation::core::float64 = double
IEEE binary64 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/enclosure.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/geometry.hpp

float64

using ludus::foundation::core::float64 = double
IEEE binary64 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/geometry.hpp

uint8

using ludus::foundation::core::uint8 = std::uint8_t
Exact 8-bit unsigned integer for explicit-width values.

Declared in modules/foundation/math/include/ludus/foundation/math/geometry.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/linearly_transformed_cosine.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

float64

using ludus::foundation::core::float64 = double
IEEE binary64 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

usize

using ludus::foundation::core::usize = std::size_t
Native unsigned size/index type; matches sizeof and container sizes, not a wire format.

Declared in modules/foundation/math/include/ludus/foundation/math/matrix.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/precision.hpp

float64

using ludus::foundation::core::float64 = double
IEEE binary64 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/precision.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/projected_solid_angle.hpp

uint32

using ludus::foundation::core::uint32 = std::uint32_t
Exact 32-bit unsigned integer for explicit-width values.

Declared in modules/foundation/math/include/ludus/foundation/math/projected_solid_angle.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/projection.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/quaternion.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

float64

using ludus::foundation::core::float64 = double
IEEE binary64 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/queries.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/random.hpp

uint32

using ludus::foundation::core::uint32 = std::uint32_t
Exact 32-bit unsigned integer for explicit-width values.

Declared in modules/foundation/math/include/ludus/foundation/math/random.hpp

uint64

using ludus::foundation::core::uint64 = std::uint64_t
Exact 64-bit unsigned integer for explicit-width values.

Declared in modules/foundation/math/include/ludus/foundation/math/random.hpp

uint32

using ludus::foundation::core::uint32 = std::uint32_t
Exact 32-bit unsigned integer for explicit-width values.

Declared in modules/foundation/math/include/ludus/foundation/math/random_domains.hpp

usize

using ludus::foundation::core::usize = std::size_t
Native unsigned size/index type; matches sizeof and container sizes, not a wire format.

Declared in modules/foundation/math/include/ludus/foundation/math/random_domains.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

float64

using ludus::foundation::core::float64 = double
IEEE binary64 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/scalar.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/shading_normal.hpp

uint8

using ludus::foundation::core::uint8 = std::uint8_t
Exact 8-bit unsigned integer for explicit-width values.

Declared in modules/foundation/math/include/ludus/foundation/math/status.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/stochastic_pairwise_mis.hpp

uint32

using ludus::foundation::core::uint32 = std::uint32_t
Exact 32-bit unsigned integer for explicit-width values.

Declared in modules/foundation/math/include/ludus/foundation/math/stochastic_pairwise_mis.hpp

float64

using ludus::foundation::core::float64 = double
IEEE binary64 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/summation.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/transform.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

float64

using ludus::foundation::core::float64 = double
IEEE binary64 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/vector.hpp

float32

using ludus::foundation::core::float32 = float
IEEE binary32 scalar; does not select rounding, trap or denormal policy.

Declared in modules/foundation/math/include/ludus/foundation/math/weighted_reservoir.hpp

uint32

using ludus::foundation::core::uint32 = std::uint32_t
Exact 32-bit unsigned integer for explicit-width values.

Declared in modules/foundation/math/include/ludus/foundation/math/weighted_reservoir.hpp