You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both the Python and Rust implementations encode all 8 orientations as a 3-bit ``permutation_index`` into an array of 2×2 signed matrices (``PERMUTATION_MATRICES``):
66
59
67
-
Direction (forward/reverse) is encoded in the ``lb/ub`` values, not in the orientation vector. The ``verify.py`` module's ``_generate_permutations()`` tests all 8 combinations (4 direct + 4 transposed) to confirm the match.
60
+
.. code-block:: text
68
61
69
-
For a detailed analysis with diagrams, see the `Root Cause Analysis <https://github.com/nasa/Plot3D_utilities/blob/main/docs/notes/unverified_connectivity_findings.md>`_ document.
**Rust version**: The `plot3d-rs <https://github.com/pjuangph/plot3d-rs>`_ crate mirrors this logic but stores orientation as flags: ``Orientation { swapped, u_reversed, v_reversed }``. Both representations encode the same 8 permutations.
64
+
.. list-table:: The 8 Permutation Matrices
65
+
:header-rows: 1
66
+
:widths: 8 8 8 8 8 20 20
67
+
68
+
* - Index
69
+
- Binary
70
+
- u_rev
71
+
- v_rev
72
+
- swap
73
+
- Matrix
74
+
- Effect
75
+
* - 0
76
+
- ``000``
77
+
- no
78
+
- no
79
+
- no
80
+
- ``[[ 1, 0],[ 0, 1]]``
81
+
- identity
82
+
* - 1
83
+
- ``001``
84
+
- yes
85
+
- no
86
+
- no
87
+
- ``[[-1, 0],[ 0, 1]]``
88
+
- flip u
89
+
* - 2
90
+
- ``010``
91
+
- no
92
+
- yes
93
+
- no
94
+
- ``[[ 1, 0],[ 0,-1]]``
95
+
- flip v
96
+
* - 3
97
+
- ``011``
98
+
- yes
99
+
- yes
100
+
- no
101
+
- ``[[-1, 0],[ 0,-1]]``
102
+
- flip both
103
+
* - 4
104
+
- ``100``
105
+
- no
106
+
- no
107
+
- yes
108
+
- ``[[ 0, 1],[ 1, 0]]``
109
+
- transpose
110
+
* - 5
111
+
- ``101``
112
+
- yes
113
+
- no
114
+
- yes
115
+
- ``[[ 0,-1],[ 1, 0]]``
116
+
- transpose + flip u
117
+
* - 6
118
+
- ``110``
119
+
- no
120
+
- yes
121
+
- yes
122
+
- ``[[ 0, 1],[-1, 0]]``
123
+
- transpose + flip v
124
+
* - 7
125
+
- ``111``
126
+
- yes
127
+
- yes
128
+
- yes
129
+
- ``[[ 0,-1],[-1, 0]]``
130
+
- transpose + both
131
+
132
+
In **Python**, the ``PERMUTATION_MATRICES`` constant is defined in ``connectivity.py`` and ``_orient_vec_to_permutation()`` converts the legacy orientation vector to a ``permutation_index``.
133
+
134
+
In **Rust**, the ``PERMUTATION_MATRICES`` constant is in ``face_record.rs`` and each ``FaceMatch`` carries an ``Orientation { permutation_index, plane }`` set by ``verify_connectivity``.
72
135
73
136
The ``u`` and ``v`` names are abstract — they map to concrete i/j/k axes depending on which axis is constant:
74
137
@@ -91,6 +154,52 @@ The ``u`` and ``v`` names are abstract — they map to concrete i/j/k axes depen
91
154
92
155
So ``u_reversed: true`` means the outer-loop axis runs opposite direction on block2 vs block1, and ``v_reversed: true`` means the inner-loop axis runs opposite.
93
156
157
+
Legacy Orientation Vector
158
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
159
+
160
+
The older Python ``_compute_orientation()`` in ``connectivity.py`` produces an orientation vector that maps each face1 axis to a face2 axis:
Direction (forward/reverse) is encoded in the ``lb/ub`` values, not in the orientation vector. The ``_orient_vec_to_permutation()`` function converts this vector to a ``permutation_index`` for the unified system. The verification modules (``verify_connectivity`` / ``verify_periodicity``) test all 8 permutations to confirm the match.
173
+
174
+
For a detailed analysis with diagrams, see the `Root Cause Analysis <https://github.com/nasa/Plot3D_utilities/blob/main/docs/notes/unverified_connectivity_findings.md>`_ document.
175
+
176
+
177
+
Directed Diagonal for GHT_CONN Export
178
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
179
+
180
+
The GlennHT connectivity file (``.ght_conn``) uses a **directed diagonal** convention where each face is specified by two corners ``(IMIN, JMIN, KMIN)`` and ``(IMAX, JMAX, KMAX)``. For cross-plane matches, the traversal direction is encoded by allowing the "max" corner to be less than the "min" corner on reversed axes. For example:
181
+
182
+
.. code-block:: text
183
+
184
+
1 1 1 1 25 409 1
185
+
2 409 1 1 1 1 25
186
+
187
+
Here block 2's i-axis runs 409 → 1 (reversed), encoding the cross-plane orientation without a separate permutation matrix.
188
+
189
+
When connectivity is computed in **Python** (via ``connectivity_fast``), the ``lb``/``ub`` values already encode the directed diagonal from the point-match traversal order.
190
+
191
+
When connectivity is computed in **Rust** (via the ``connectivity-finder`` binary in grid-packed), the JSON output uses ascending ``lo``/``hi`` bounds with a ``permutation_index`` (0-7). Use ``reconstruct_directed_diagonal()`` to convert these to directed ``lb``/``ub`` before exporting:
192
+
193
+
.. code-block:: python
194
+
195
+
from plot3d.connectivity import reconstruct_directed_diagonal
196
+
197
+
# face_match has ascending lb/ub + permutation_index from Rust JSON
0 commit comments