pub struct Part {
pub id: &'static str,
pub shape: Shape,
pub pos: [f64; 3],
pub angle: f64,
pub flat: bool,
pub color: [f32; 3],
pub highlight: f32,
pub heat: Option<f32>,
}Fields§
§id: &'static str§shape: Shape§pos: [f64; 3]§angle: f64Rotation about the depth axis in radians, from +x towards +z: what turns a pulley’s spoke.
flat: boolLaid flat (lay_flat): the box or cylinder, after angle, turned a quarter turn about x, its y axis to -z and its
z axis to +y. A segment is never flat: its ends give its direction.
color: [f32; 3]§highlight: f32-1..1, drawn as a colour shift: belt tension below or above pretension.
heat: Option<f32>Temperature rise as a share of the part’s rated limit, where it is computed: drawn from cold to hot in place of the part’s colour. Set by the simulation, not by the machine.
Implementations§
Source§impl Part
impl Part
pub fn new( id: &'static str, shape: Shape, pos: [f64; 3], color: [f32; 3], ) -> Self
pub fn turned(self, angle: f64) -> Self
pub fn highlighted(self, highlight: f32) -> Self
Sourcepub fn lay_flat(&mut self)
pub fn lay_flat(&mut self)
Turns the part, drawn upright, a quarter turn about the x axis through the origin: (x, y, z) to (x, z, -y). Seen
from above it then looks as it looked from the front, a wheel facing up, its angle turning from +x towards +y.
For a wheel of a belt in the x-y plane (an H-bot’s): draw it upright at (x, y) in the x-z plane at depth -z, then
lay it flat.