nx_symmetry_group.nx
buildroot/runtime/nx_symmetry_group.nx
about
nx_symmetry_group.nx -- multi-axis symmetry detector.
Generalizes nx_compose_h_symmetry + nx_compose_v_symmetry from
horizontal/vertical bilateral to:
* diagonal mirror (axis x = y)
* anti-diagonal mirror (axis x = -y)
* 180-degree rotational
* 90-degree rotational (square only)
* translational periodic
Returns per-axis Q10 scores + the sealed-enum kind of the dominant
symmetry + a composite verdict. Multiple axes can fire concurrently
(a square checkerboard has H + V + DIAG + 4_FOLD + TRANSLATIONAL all
near max); the report carries them all so downstream tooling sees
the full symmetry group, not just the maximum.
Cross-modal kernel: the algorithms here operate on any indexed
array. Today's signature takes *Image, but the substrate will
later generalize to spectrograms, attention heatmaps, terrain
arrays, palindrome detection over token streams, etc.
Sealed-enum SymmetryKind (gap-2 mitigation via constants):
NX_SYM_NONE 0
NX_SYM_H_BILATERAL 1
NX_SYM_V_BILATERAL 2
NX_SYM_DIAGONAL 3
NX_SYM_ANTIDIAGONAL 4
NX_SYM_2_FOLD_ROT 5
NX_SYM_4_FOLD_ROT 6
NX_SYM_TRANSLATIONAL 7
genealogy_id: weyl_1952_symmetry + tyler_1995_visual_symmetry +
wagemans_1995_psychophysics_symmetry
lineage_id: multi_axis_symmetry_group_q10
dependencies 4 imports · 2 importers
imports: nx_syscalls.nxnx_tier.nxnx_image.nxnx_compose.nx
imported by: nx_image_feature_extract.nxnx_symmetry_group_test.nx
structs
| 61 | struct SymmetryReport |
consts
| 47 | const NX_SYM_NONE: nx_int = 0 |
| 48 | const NX_SYM_H_BILATERAL: nx_int = 1 |
| 49 | const NX_SYM_V_BILATERAL: nx_int = 2 |
| 50 | const NX_SYM_DIAGONAL: nx_int = 3 |
| 51 | const NX_SYM_ANTIDIAGONAL: nx_int = 4 |
| 52 | const NX_SYM_2_FOLD_ROT: nx_int = 5 |
| 53 | const NX_SYM_4_FOLD_ROT: nx_int = 6 |
| 54 | const NX_SYM_TRANSLATIONAL: nx_int = 7 |
| 55 | const NX_SYM_N_KINDS: nx_int = 8 |
| 57 | const NX_SYM_Q: nx_int = 1024 |
| 59 | const NX_SYM_PRESENT_THR: nx_int = 717 // ~70% Q10 |
functions
| 80 | func nx_sym_diagonal(gray: *Image) -> nx_int |
| 108 | func nx_sym_antidiagonal(gray: *Image) -> nx_int |
| 139 | func nx_sym_rot_180(gray: *Image) -> nx_int |
| 168 | func nx_sym_rot_90(gray: *Image) -> nx_int |
| 202 | func nx_sym_translational(gray: *Image, out_period: *i64) -> nx_int |
| 246 | func nx_symmetry_compute(gray: *Image, report: *SymmetryReport) -> nx_int |
| 307 | func nx_sym_kind_is_valid(kind: nx_int) -> nx_int called by 1: main |