Code Quality: Landing Autopilot Cleanup

Issues: #987, #990, #992, #994, #995

Summary

Pure refactoring of maneuver_landing.py — no behavioral changes.

Changes

#987 — Replace inline magnitude calculations with vec_mag()

math_utils.vec_mag() exists but is not used in maneuver_landing.py. Replace inline math.sqrt(x*x + y*y + z*z) patterns on 3-tuples with vec_mag().

Exceptions (keep inline):

  • Quaternion magnitudes (4-component)
  • Cases where unpacked scalars would require constructing a throwaway tuple

#990 — Standardize epsilon thresholds

Define module-level constants:

  • _EPS = 1e-10 — general near-zero guard
  • _EPS_RATE = 1e-6 — descent rate threshold (physically distinct)

Replace bare 1e-10 and 1e-12 literals.

#992 — Use named constant for micro-gravity guard

Replace max(g_local, 0.01) with max(g_local, MICRO_G_HOVER_THRESHOLD). The constant already exists at module level.

#994 — Clean up cross-product derivation comments

Replace 6 lines of confused intermediate derivation (lines 831-846) with a clean 2-line summary of the final cross-product results.

#995 — Move PAD_SURFACE_OFFSET to module level

Move from local variable inside function to module-level constant section.

Verification

Existing game-engine test suite (964 tests) must pass unchanged.


Back to top

Galaxy — Kubernetes-based multiplayer space game

This site uses Just the Docs, a documentation theme for Jekyll.