pub struct Triangle {
pub a: u32,
pub b: u32,
pub c: u32,
pub ab_edge: usize,
pub bc_edge: usize,
pub ca_edge: usize,
/* private fields */
}Expand description
A main triangle on the base shape of a subdivided shape.
Main triangles are those which are part of the definition of the base shape, rather than created by subdivision.
The specification of the library expects a, b, and c
to be in a counter-clockwise winding.
Fields§
§a: u32§b: u32§c: u32§ab_edge: usize§bc_edge: usize§ca_edge: usizeImplementations§
Source§impl Triangle
impl Triangle
Sourcepub const fn new(
a: u32,
b: u32,
c: u32,
ab_edge: usize,
bc_edge: usize,
ca_edge: usize,
) -> Self
pub const fn new( a: u32, b: u32, c: u32, ab_edge: usize, bc_edge: usize, ca_edge: usize, ) -> Self
Creates a new Triangle given the necessary data.
-
The fields
a,b, andcare the indices intoBaseShape::initial_points()which are the vertices of this triangle. Note that this crate assumes points are in a counter-clockwise ordering. -
The fields
ab_edge,bc_edge,ca_edgemark the index of the edge whicha/b,b/c, andc/aborder respectively. While theoretically you could give each triangle its own edge, sharing edges between triangles saves on memory footprint and performance.There is no explicit list of edges; they are defined by how they are used here. However, the total number of edges must be specified in
BaseShape::EDGES, and all edge indices from 0 toEDGES - 1must be used.