Skip to main content

Shape

Enum Shape 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Line

Fields

§a: [f64; 2]
§b: [f64; 2]
§

Polyline

at least one point; closed: a segment from the last back to the first, joined at every point

Fields

§points: &'a [[f64; 2]]
§closed: bool
§

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

Fields

§center: [f64; 2]
§radius: f64
§start: f64
§sweep: f64
§

Circle

a circle (its dash pattern starts at angle 0 and runs counter-clockwise)

Fields

§center: [f64; 2]
§radius: f64
§

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

Fields

§points: &'a [[f64; 2]]
§closed: bool
§

Cubic

cubic Bézier pieces: per piece its two control points and its end (1 + 3k points)

Fields

§points: &'a [[f64; 2]]
§closed: bool
§

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

Fields

§center: [f64; 2]
§radii: [f64; 2]
§rotation: f64
§start: f64
§sweep: f64
§

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

Fields

§degree: u32
§points: &'a [[f64; 2]]
§weights: &'a [f64]
§knots: &'a [f64]
§closed: bool
§

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”)

Fields

§rings: &'a [&'a [Shape<'a>]]
§

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)

Trait Implementations§

Source§

impl<'a> Clone for Shape<'a>

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<'a> Copy for Shape<'a>

Source§

impl<'a> Debug for Shape<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Forget for Shape<'a>

§

impl<'a> Freeze for Shape<'a>
where &'a [[f64; 2]]: Freeze, &'a [f64]: Freeze, &'a [&'a [Shape<'a>]]: Freeze, &'a str: Freeze,

§

impl<'a> Move for Shape<'a>

§

impl<'a> RefUnwindSafe for Shape<'a>

§

impl<'a> Send for Shape<'a>
where &'a [[f64; 2]]: Send, &'a [f64]: Send, &'a [&'a [Shape<'a>]]: Send, &'a str: Send,

§

impl<'a> Sync for Shape<'a>

§

impl<'a> Unpin for Shape<'a>
where &'a [[f64; 2]]: Unpin, &'a [f64]: Unpin, &'a [&'a [Shape<'a>]]: Unpin, &'a str: Unpin,

§

impl<'a> UnsafeUnpin for Shape<'a>
where &'a [[f64; 2]]: UnsafeUnpin, &'a [f64]: UnsafeUnpin, &'a [&'a [Shape<'a>]]: UnsafeUnpin, &'a str: UnsafeUnpin,

§

impl<'a> UnwindSafe for Shape<'a>
where &'a [[f64; 2]]: UnwindSafe, &'a [f64]: UnwindSafe, &'a [&'a [Shape<'a>]]: UnwindSafe, &'a str: 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> ErasedDestructor for T
where T: 'static,

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> 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.