Skip to main content

CurveKind

Type Alias CurveKind 

Source
pub type CurveKind = CurveKind;
Expand description

A sketch curve’s kind as a program holds it.

Aliased Type§

pub enum CurveKind {
    Line {
        start: PointId,
        end: PointId,
    },
    Arc {
        start: PointId,
        end: PointId,
        sweep: Scalar,
    },
    Circle {
        center: PointId,
        radius: Scalar,
    },
    Spline {
        control_points: Vec<PointId>,
        shape: Option<SplineShape>,
    },
    Text {
        anchor: PointId,
        text: String,
        height: Scalar,
        angle: Scalar,
    },
}

Variants§

§

Line

Fields

§start: PointId
§

Arc

A circular arc from start to end, turning counter-clockwise by sweep radians (clockwise if negative, |sweep| < 2π). Equivalent to giving its curvature 2 sin(sweep / 2) / |end - start| — see [crate::geometry] for why the sweep is what is stored and solved.

Fields

§start: PointId
§sweep: Scalar
§

Circle

Fields

§center: PointId
§radius: Scalar
§

Spline

A clamped B-spline through its first and last control points: as drawn, uniform and non-rational of degree min(3, control_points.len() - 1); taken from elsewhere — an edge of the part projected into the plane — any NURBS (see [SplineShape]).

Fields

§control_points: Vec<PointId>
§

Text

The outlines of text’s glyphs in the sketch font (see [crate::text]): its first baseline from anchor on, its capitals height tall, turned counter-clockwise by angle radians. Each of a glyph’s closed contours is a loop of the profile — an o an outline and a hole in it. Only its anchor is solved for: a text is placed by constraining that point, and takes no constraint itself.

Fields

§anchor: PointId
§text: String
§height: Scalar
§angle: Scalar