glTF Triangle Strips: Preserve Alternating Vertex Order in a Drone Model Review
Expand a small decoded TRIANGLE_STRIP index sequence, retain alternating triangle order, and report repeated-index triangles without repairing the source model.

Identify the primitive mode before interpreting a face list
A model review can go wrong before any coordinates are examined if every index sequence is treated as independent groups of three. A glTF primitive using TRIANGLE_STRIP has a different assembly rule from TRIANGLES. Consecutive windows overlap, and their triangle order alternates. In a drone-model handoff, that distinction can explain why a simple index grouping script produces an unexpected face count or inconsistent orientation. Preserve the received model and identify the selected primitive before using a summary as evidence that geometry changed.
This tutorial expands five invented decoded indices into three ordered triangles. It does not open a glTF asset, decode an accessor, calculate a surveyed area, or establish that NiVO software exports this format. The catalogue photograph supplies separate product context. The example isolates topology assembly after the indices and position count have already been obtained correctly. Its output is a reproducible index explanation, with no claim that the resulting surface is valid, complete, correctly georeferenced, or acceptable for a project.
Read the normative strip equation and its input scope
Khronos defines mode five as TRIANGLE_STRIP, while omitted mode defaults to four, TRIANGLES. A strip requires at least three entries. Its triangle at zero-based position i uses entries i, i plus one plus i modulo two, and i plus two minus i modulo two. Thus the constructed sequence zero, one, two, three, four yields ordered triples zero-one-two, one-three-two, and two-three-four. This explicit order follows the specification equation rather than a viewer-specific face-list convention.
The integers supplied to the function below are already decoded vertex indices. They are not the JSON accessor reference stored in primitive.indices. The position count supplies an exclusive bound for each index. Retain the accessor and primitive identities separately in a real investigation so those layers cannot be confused. This teaching function deliberately requires explicit mode five; it does not guess a strip from the number of entries or reinterpret an omitted mode. That choice makes an incorrect input assumption fail visibly instead of generating a plausible but unrelated list.

Product context only; this photograph does not depict the constructed examples in this article.
Expand a small strip while retaining every input position
Run this Python function locally. It accepts a list or tuple containing three through sixty-four integer entries, together with a position count between one and sixty-four. These size limits define a small teaching profile, not the glTF format capacity. Boolean values are rejected even though Python treats them as integers in some contexts. Each supplied index must be non-negative and below the stated position count. The function creates new triangle tuples and returns their sequence without changing the caller input.
The printed example should contain three triples: zero-one-two, one-three-two, and two-three-four, with an empty repeated-index diagnostic. Five is not divisible by three, but that is not an error for this strip. Do not impose the independent-TRIANGLES count rule on it. Conversely, a sequence containing six entries would describe four strip triangles under this function, rather than two independent triangles. Keep the mode and scope attached to either total when comparing reports from a producing application and receiving viewer.
def expand_strip(indices, position_count, mode):
if type(mode) is not int or mode != 5:
raise ValueError("Expected explicit TRIANGLE_STRIP mode 5")
if type(position_count) is not int or not 1 <= position_count <= 64:
raise ValueError("Teaching profile: 1..64 positions")
if type(indices) not in (list, tuple) or not 3 <= len(indices) <= 64:
raise ValueError("Teaching profile: 3..64 decoded index entries")
if any(type(x) is not int or not 0 <= x < position_count for x in indices):
raise ValueError("Index outside the supplied position range")
triangles = []
for i in range(len(indices) - 2):
a, b, c = indices[i:i + 3]
triangles.append((a, c, b) if i % 2 else (a, b, c))
repeated = [i for i, triangle in enumerate(triangles)
if len(set(triangle)) < 3]
return {"triangles": triangles, "repeated_index_triangles": repeated}
# Constructed indices, not actual model geometry.
print(expand_strip([0, 1, 2, 3, 4], 5, 5))Test the odd triangle before trusting an orientation comparison
Inspect the second triple explicitly. A naive sliding window would report one-two-three, while the documented assembly produces one-three-two. Those orders contain the same references but reverse orientation. A comparison that sorts every triple numerically would erase that distinction. Preserve the ordered entries in the diagnostic and choose a comparison appropriate to the actual question. Matching unordered vertex membership can answer one question while failing to establish matching orientation, so a report should say which relationship it tested.
Use a separate constructed coordinate arrangement when testing the implementation: positions at zero-zero, one-zero, zero-one, one-one, and zero-two. The three documented triples have consistent signed orientation in that illustrative plane, while the naive second window reverses it. This is an independent check of the assembly logic, not a geometry calculation performed by the published function. Real model transforms, material behavior, normals, and receiving-tool conventions require their own investigation before a visual difference is attributed to an exporter or to changed survey observations.
Report repeated references without deleting strip entries
Try a supplied strip containing zero, one, one, two, three. The function retains three triangle positions and marks the first two as containing repeated indices. It does not delete the repeated entry, restart the strip, or reset the alternating position. Removing an entry before assembly would change subsequent windows and can change their order. Preserve the original sequence while explaining the finding. Any authorized conversion or cleanup should be a separate operation whose changed topology is reviewed with its own before-and-after evidence.
Khronos advises against degenerate primitives and forbids maximum component-type index values that can trigger primitive restart in some graphics APIs. This example introduces no restart marker and accepts only the small explicit position range. It does not inspect the accessor component type or binary buffer. Repeated-index detection is also narrower than a complete degeneracy check: distinct indices may refer to coincident or collinear coordinates. An empty diagnostic therefore does not establish positive area, watertightness, correct normals, or a usable reconstructed surface.
Keep each primitive input separate when building a larger review tool. Concatenating two received strips and calling this function once would invent windows across their boundary and could change the alternating position for the second strip. Instead, retain the primitive identity beside each independent result. Test that arrangement with two short constructed strips before summarizing a complete mesh. The function accepts one sequence only, so a multi-primitive total requires a separate, explicitly scoped aggregation rather than an assumed continuation of the same strip.
Deliver the assembly trace alongside broader model checks
For an actual handoff investigation, retain the asset identity, selected mesh and primitive, explicit or defaulted mode, index accessor identity, decoded sequence, position accessor count, and tool versions. Include a small ordered-triple trace with triangle positions and unresolved repeated-reference findings. If another report summarizes the entire scene, separate that scope from the single primitive inspected here. Keep binary layout, dependencies, coordinate interpretation, and geometry validation results attached to the methods that actually checked them.
In a NiVO-related model discussion, this approach explains why five strip entries form three ordered triangles and why the middle triple differs from a naive window. It makes no product-performance or survey-acceptance claim. Preserve the unchanged model and continue the independent receiving checks required for its intended use. The useful outcome is a precise topology explanation that another reviewer can reproduce, with the original order and all unresolved findings still available rather than hidden by a convenient grouping or repair.



