pub struct Drawable {
pub points: Vec<Point>,
pub triangles: Vec<[u32; 3]>,
pub lines: Vec<[u32; 2]>,
pub dropped: usize,
pub triangle_cells: Vec<u32>,
pub node_cells: Vec<u32>,
}Expand description
What a viewer needs: the points, and how to join them.
Both index lists at once because a representation can have some of each - a wellbore frame is stations and markers - and a caller that had to ask twice would walk the patches twice.
Fields§
§points: Vec<Point>Every patch’s points, concatenated - and every one of them a location.
triangles: Vec<[u32; 3]>Triples into points.
lines: Vec<[u32; 2]>Pairs into points: the segments of every polyline.
dropped: usizeNodes left out because they hold no location - a NaN corner of a grid
with holes, the padding of a short parametric line.
Counted rather than swallowed: a representation whose nodes are all undefined comes back empty, and empty is exactly what a reader that found nothing also returns. This is what tells the two apart.
triangle_cells: Vec<u32>The cell each triangle was cut from - triangle_cells[i] for
triangles[i] - in the numbering of Geometry::cell_count, which is
the numbering a per-cell property’s values line up against.
This is what lets a viewer paint a flat colour per cell: three.js colours vertices, so an aplat needs the geometry de-indexed - each triangle its own three vertices - and each new vertex needs to know which cell’s value it wears. Deriving this table outside the merge would mean re-deriving the fan of a polygon, the split of a quad and the row order of a lattice, and agreeing with them forever - the exact pair of readers this repository refuses.
Empty when the mapping does not exist, never guessed: a volume is drawn by its boundary skin, and a boundary face is a face, not a cell - naming one per triangle would line a property’s values up against elements they were not measured on. Empty and full are the two honest states; a caller that finds it empty refuses per-cell painting by name, exactly as it did before this field existed.
node_cells: Vec<u32>The cell each node belongs to, where that is unique - one entry per
point, Drawable::NO_CELL where it is not.
The unique case is a polyline: every node of a run belongs to that run
and no other, so painting a PolylineSetRepresentation per cell - one
colour a polyline - needs no de-indexing at all: segments of one run
share vertices and share a colour, and two runs never share a vertex.
A surface’s node is the opposite - shared between cells, which is
exactly why faces go through Drawable::triangle_cells and a
de-index instead. NO_CELL there is the honest entry, and a viewer’s
out-of-range guard turns it into the transparent it already gives a
missing value.