Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Apply vector math primitives for game rendering, collision, orientation, lighting, steering, and geometry predicates. Use when working with dot products, cross products, triple products, normals, projections, signed areas, signed volumes, facing checks, or vector normalization.
.claude/skills/hashgraph-online-game-vector-math-primitives/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 42% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 34% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 6% | 0% |
| case-06 | ✓→✓ | = Same ✓ | 17% | 0% |
| case-07 | ✓→✓ | = Same ✓ | 25% | 0% |
Use this skill when game code depends on vector operations whose geometric meaning matters. Prefer clear primitives and named intent over opaque formula paste.
Primary source: Geometry for Programmers by Oleksandr Kaleniuk (https://www.manning.com/books/geometry-for-programmers), transformed and paraphrased, especially chapters 2 and 9.
volume, distance, facing, or interpolation.
handedness, normalization, and zero-length vectors.
the caller truly needs magnitude.
normal, signed_area2,light_factor, plane_distance, facing, projection_t.
parallel vectors, and zero-length inputs.
Use dot products for:
If both vectors are normalized, the dot product is the cosine of the angle between them. Clamp before inverse cosine if a display angle is needed.
Use cross products for:
For 2D, use the scalar a.x * b.y - a.y * b.x instead of constructing fake 3D vectors unless the codebase already uses a 3D type.
Use the scalar triple product for:
Keep the sign when side matters. Take absolute value only for unsigned volume or distance.
required. Dot thresholds are usually cheaper.
predicates.
Other measured skills in the registry, with their headline benchmark lift.