Skip to main content

PaintNode

Enum PaintNode 

Source
pub enum PaintNode {
    Leaf(u8),
    Split {
        special: u8,
        children: Vec<PaintNode>,
    },
}
Expand description

A node of a version 2 tree.

Variants§

§

Leaf(u8)

A piece of the triangle, with its value.

§

Split

A triangle split into 2, 3 or 4 children (1, 2 or 3 sides split), named from its special corner, 0 to 2.

Fields

§special: u8

The corner the split is named from: see PaintNode::pieces.

§children: Vec<PaintNode>

The children, first to last: 2, 3 or 4 of them.

Implementations§

Source§

impl PaintNode

Source

pub fn max_value(&self) -> u8

The largest value in the tree.

Source

pub fn pieces(&self) -> Vec<PaintPiece>

The pieces of the triangle, depth first and each node’s children first to last, with their corners as weights over the triangle’s corners (section 10.1). A split node with corners C0, C1, C2 and special corner s takes P0 = Cs, P1 = Cs+1, P2 = Cs+2, indices modulo 3, and Mij the midpoint of Pi and Pj; its children are:

1 side split   (P0, P1, M12), (M12, P2, P0)
2 sides split  (P0, M01, M20), (M01, P1, M20), (P1, P2, M20)
3 sides split  (P0, M01, M20), (M01, P1, M12), (M12, P2, M20), (M01, M12, M20)

The pieces depend on the tree alone, never on neighbouring pieces or triangles: they cover the triangle exactly once, each wound like it.

Source

pub fn from_3mf(digits: &str) -> Option<Self>

Reads the tree of one triangle from the string of hex digits that 3MF files of filament slicers hold for it: one digit per group of 4 bits, the last digit holding the first group. None when the string is not exactly one tree that version 2 allows.

Source

pub fn to_3mf(&self) -> Option<String>

The tree as the string of hex digits a 3MF file holds for its triangle (see PaintNode::from_3mf), in upper case. None for a tree version 2 does not allow.

Trait Implementations§

Source§

impl Clone for PaintNode

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 PaintNode

Source§

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

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

impl Eq for PaintNode

Source§

impl PartialEq for PaintNode

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 PaintNode

Auto Trait Implementations§

§

impl Forget for PaintNode

§

impl Freeze for PaintNode

§

impl Move for PaintNode

§

impl RefUnwindSafe for PaintNode

§

impl Send for PaintNode
where RawVecInner: Send,

§

impl Sync for PaintNode
where RawVecInner: Sync,

§

impl Unpin for PaintNode
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for PaintNode

§

impl UnwindSafe for PaintNode
where RawVecInner: UnwindSafe,

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, 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> Same for T

Source§

type Output = T

Should always be Self
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.