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.
Implementations§
Source§impl PaintNode
impl PaintNode
Sourcepub fn pieces(&self) -> Vec<PaintPiece>
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.
Sourcepub fn from_3mf(digits: &str) -> Option<Self>
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.
Sourcepub fn to_3mf(&self) -> Option<String>
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.