Skip to main content

Module bounds

Module bounds 

Source
Expand description

簇包围球 / AABB / 法向锥计算。

与 TS 权威实现(packages/deep-engine/src/geometry/meshletBounds.ts)逐位对拍: TS 中 Float32Array 元素读出即 f64,全部运算在 f64 下进行,写回时经 Math.fround (round-to-nearest-even 的 f64→f32)。Rust 侧对应:f32 读入 as f64 提升、f64 运算、 写回 as f32。相邻 f32(ulp 步进)用位操作复刻 TS 的 ADJACENT_WORDS 技巧。

Structs§

MeshletBounds
单个簇的渲染剔除包围体。

Functions§

compute_meshlet_bounds
计算簇包围体。vertices 为全局顶点表(与 TS pending.vertices 同序)。
hypot2
V8 Math.hypot(x, y) 双参数形态(同一 MathHypot 算法)。
hypot3
V8 Math.hypot 的逐位复刻(src/builtins/math.tq MathHypot): 取绝对值最大值做缩放,平 f64 方和,再正确舍入 sqrt。
triangle_normal
三角形单位法线;退化(重合顶点或近共线)返回 None。