#[non_exhaustive]pub enum Shape<'a> {
Line {
a: [f64; 2],
b: [f64; 2],
},
Polyline {
points: &'a [[f64; 2]],
closed: bool,
},
Arc {
center: [f64; 2],
radius: f64,
start: f64,
sweep: f64,
},
Circle {
center: [f64; 2],
radius: f64,
},
Quadratic {
points: &'a [[f64; 2]],
closed: bool,
},
Cubic {
points: &'a [[f64; 2]],
closed: bool,
},
Ellipse {
center: [f64; 2],
radii: [f64; 2],
rotation: f64,
start: f64,
sweep: f64,
},
Spline {
degree: u32,
points: &'a [[f64; 2]],
weights: &'a [f64],
knots: &'a [f64],
closed: bool,
},
Fill {
rings: &'a [&'a [Shape<'a>]],
},
Insert(Insert),
Text(Text<'a>),
MText(MText<'a>),
}Expand description
what an entity is (more kinds come: text)
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Line
Polyline
at least one point; closed: a segment from the last back to the first, joined at every point
Arc
a circular arc: its centre, radius (above 0), the angle it starts at and how far it turns (radians; positive:
counter-clockwise, the drawing’s y pointing up; not 0). A sweep of a full turn or more is a circle whose dash
pattern starts at start. Drawn in pieces of at most ARC_STEP, coverage from the circle itself
Circle
a circle (its dash pattern starts at angle 0 and runs counter-clockwise)
Quadratic
quadratic Bézier pieces end to end: the start, then per piece its control point and its end (1 + 2k points, k at least 1); closed: the end joins the start (a straight segment where they differ). Curves are flattened into segments per zoom band within curve::FLAT_TOL px (docs/RENDER2D.md “Kurven”); the joins between pieces are the style’s, the dash pattern runs along the curve’s length
Cubic
cubic Bézier pieces: per piece its two control points and its end (1 + 3k points)
Ellipse
an elliptic arc: the point at the parameter t is center + R(rotation) (radii[0] cos t, radii[1] sin t), from t =
start over sweep (radians, not 0; a full turn or more: the closed ellipse, starting at start); radii above 0
Spline
a B-spline of degree 1 to 3 (at least degree + 1 points), rational where weights has one positive weight per
point (empty: all 1), on knots (empty: clamped and uniform, through the first and last point; else points +
degree + 1 non-decreasing values, the curve from knots[degree] to knots[points]); closed with empty knots: periodic
(smooth all round), else the end joins the start. As DXF’s SPLINE
Fill
a filled area: its rings, each the shapes of the list end to end (a shape that does not start where the one before ended: a straight segment between them; the last back to the first), even-odd between rings (a ring inside a hole is an island). Triangulated on the CPU, its edge smoothed as strokes are; the style’s colour, or its hatch (docs/RENDER2D.md “Flächen”)
Insert(Insert)
a block (G6b2): on a layer in its place in the order, or inside another block; its entities in their order, each with its style or by block the insert’s (docs/RENDER2D.md “Blöcke”)
Text(Text<'a>)
a single line of text (G6c; DXF’s TEXT): its glyphs from the scene’s atlas of distance fields, small as bars, very large as fills of their outlines; the style’s colour (docs/RENDER2D.md “Text”)
MText(MText<'a>)
text of several lines (G6c; the basics of DXF’s MTEXT)