MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / vec3Normalize

Function vec3Normalize

src/math/index.ts:78–82  ·  view source on GitHub ↗
(v: Vec3)

Source from the content-addressed store, hash-verified

76}
77
78export function vec3Normalize(v: Vec3): Vec3 {
79 const len = vec3Length(v);
80 if (len === 0) return { x: 0, y: 0, z: 0 };
81 return { x: v.x / len, y: v.y / len, z: v.z / len };
82}
83
84export function vec3Dot(a: Vec3, b: Vec3): number {
85 return a.x * b.x + a.y * b.y + a.z * b.z;

Callers 1

rayIntersectsTriangleFunction · 0.85

Calls 1

vec3LengthFunction · 0.85

Tested by

no test coverage detected