code wiki / (root) / nx_symmetry_group.nx

nx_symmetry_group.nx

buildroot/runtime/nx_symmetry_group.nx

10533 B311 linesdepth 6pulls 7 transitivereach 7 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_tier.nx nx_image.nx nx_compose.nx nx_symmetry_group.nx nx_image_feature_extract.nx nx_symmetry_group_test.nx

imports: nx_syscalls.nxnx_tier.nxnx_image.nxnx_compose.nx

imported by: nx_image_feature_extract.nxnx_symmetry_group_test.nx

structs

61struct SymmetryReport

consts

47const NX_SYM_NONE: nx_int = 0
48const NX_SYM_H_BILATERAL: nx_int = 1
49const NX_SYM_V_BILATERAL: nx_int = 2
50const NX_SYM_DIAGONAL: nx_int = 3
51const NX_SYM_ANTIDIAGONAL: nx_int = 4
52const NX_SYM_2_FOLD_ROT: nx_int = 5
53const NX_SYM_4_FOLD_ROT: nx_int = 6
54const NX_SYM_TRANSLATIONAL: nx_int = 7
55const NX_SYM_N_KINDS: nx_int = 8
57const NX_SYM_Q: nx_int = 1024
59const NX_SYM_PRESENT_THR: nx_int = 717 // ~70% Q10

functions

80func nx_sym_diagonal(gray: *Image) -> nx_int
called by 1: nx_symmetry_compute calls 1: nx_image_get
108func nx_sym_antidiagonal(gray: *Image) -> nx_int
called by 1: nx_symmetry_compute calls 1: nx_image_get
139func nx_sym_rot_180(gray: *Image) -> nx_int
called by 1: nx_symmetry_compute calls 1: nx_image_get
168func nx_sym_rot_90(gray: *Image) -> nx_int
called by 1: nx_symmetry_compute calls 1: nx_image_get
202func nx_sym_translational(gray: *Image, out_period: *i64) -> nx_int
called by 1: nx_symmetry_compute calls 1: nx_image_get
246func nx_symmetry_compute(gray: *Image, report: *SymmetryReport) -> nx_int
307func nx_sym_kind_is_valid(kind: nx_int) -> nx_int
called by 1: main