Skip to main content

Module serialization

Module serialization 

Source
Expand description

JSON serialization for face records and face matches.

Provides two output formats controlled by the --diagonal flag:

§Default format (lo/hi)

Face bounds use ascending lo/hi keys. Every match includes a permutation_index (0-7) indicating which PERMUTATION_MATRICES entry transforms face B to match face A.

{
  "block1": { "block_index": 0, "lo": [0,0,0], "hi": [0,101,33] },
  "block2": { "block_index": 30, "lo": [0,0,0], "hi": [0,101,33] },
  "permutation_index": 3
}

§Diagonal format (--diagonal)

  • In-plane matches (perm 0-3): block2’s lb/ub encodes traversal direction. permutation_index: -1 (direction is fully in the bounds).
  • Cross-plane matches (perm 4-7): ascending lb/ub bounds with the actual permutation_index, since lb/ub can’t encode a swap.
{
  "block1": { "block_index": 0, "lb": [0,0,0], "ub": [0,101,33] },
  "block2": { "block_index": 30, "lb": [0,101,33], "ub": [0,0,0] },
  "permutation_index": -1
}

Functions§

face_match_to_diagonal_json
Convert a FaceMatch to diagonal JSON format.
face_match_to_json
Convert a FaceMatch to JSON (lo/hi + permutation_index 0-7).
face_record_to_diagonal_json
Convert a FaceRecord to JSON with ascending lb/ub bounds.
face_record_to_json
Convert a FaceRecord to JSON with ascending lo/hi bounds.
permutation_matrices_json
Serialize the 8 permutation matrices as a JSON array (for inclusion in output headers).