CodePhys is a teaching project, so the bar for a change is simple: the physics
must stay correct and checkable, and the architecture must stay clean. The
authoritative rules live in CLAUDE.md and
docs/design/DESIGN.md; this file summarises what a
contribution needs.
- Cite the source next to the equation. Keep the textbook citation
(
// College Physics 2e §7.2) and, for non-trivial methods, add the primary source fromdocs/REFERENCES.md/REFERENCES.bib(e.g. velocity Verlet → Swope et al. 1982). - Validate against closed-form solutions and conservation laws. New physics
needs a headless test in
tests/checking it against an exact result (projectile range, SHM/pendulum period, Kepler's third law) or an invariant (energy, momentum, angular momentum). Seetests/test_physics.cpp. - SI units everywhere internally. The UI converts for display only; name
boundary variables with unit suffixes (
v0_mps,angle_rad). - Don't over-claim. Use precise language — a symplectic integrator has bounded energy drift, it does not exactly conserve energy (Hairer, Lubich & Wanner 2006).
physics/has zero non-stdlib includes. No GLFW, OpenGL, or UI.- One runtime dependency: GLFW. Build/test-only vendored deps (
doctest,glad) are allowed. - Layering, downward only:
app → scenes → {physics, render, ui};render → physics::math;ui → render;platform → GLFW. - Cross-platform: must build and run identically on Windows (MSVC) and
Linux/WSL2 (GCC/Clang); no platform code outside
platform/.
Non-trivial work develops through OpenSpec (openspec/): propose a change
(/opsx:propose), apply it (/opsx:apply), then sync/archive. See CLAUDE.md.
# Linux / WSL2
cmake --preset linux-gcc && cmake --build --preset linux-gcc
ctest --preset linux-gcc
# Windows (MSVC)
cmake --preset windows-msvc && cmake --build --preset windows-msvc --config RelWithDebInfo
ctest --preset windows-msvcThe test suite runs headless (no window or GPU) via doctest + CTest, and is
green on both compilers in CI (.github/workflows/ci.yml).
What it covers:
| Test file | Checks |
|---|---|
tests/test_math.cpp |
vector/matrix/quaternion algebra, unit conversions |
tests/test_physics.cpp |
projectile range, Kepler orbit + angular-momentum conservation, integrator convergence order, symplectic energy stability, momentum conservation |
Per CLAUDE.md: commits are authored solely by the human
committer — never add an AI co-author trailer or "Generated with …" line.
Commit only when asked; never push without asking.
C++20; snake_case files, PascalCase types, camelCase members/functions;
formatting via .clang-format.