Skip to main content

Drawable

Struct Drawable 

Source
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: usize

Nodes 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.

Implementations§

Source§

impl Drawable

Source

pub const NO_CELL: u32 = u32::MAX

The entry of Drawable::node_cells for a node that belongs to no single cell - a surface node, shared between the cells around it.

Trait Implementations§

Source§

impl Clone for Drawable

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Drawable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Drawable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Drawable

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Drawable

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more