Skip to main content

Drawing

Struct Drawing 

Source
pub struct Drawing { /* private fields */ }
Expand description

A sketch drawn point by point, each point placed by two formulas — its x and y from a fixed origin — so that every point follows the parameters on its own, and solving the sketch is solving a linear system with one answer. Curves only join points; arcs take a radius.

It is drawn where the parameters as defined put it, so a program built as it is needs no solving.

Implementations§

Source§

impl Drawing

Source

pub fn new(program: &Program) -> GeopResult<Self>

A drawing for a step of program, drawn with its parameters as it defines them.

Source

pub fn point( &mut self, x: impl AsRef<str>, y: impl AsRef<str>, ) -> GeopResult<PointId>

The point at (x, y), each a formula.

Source

pub fn line(&mut self, a: PointId, b: PointId) -> CurveId

Source

pub fn bezier(&mut self, control: Vec<PointId>) -> CurveId

The Bézier curve of the control points control, of degree one less than there are: a spline on one span, through its first and last point.

Source

pub fn polygon(&mut self, corners: &[[String; 2]]) -> GeopResult<Vec<CurveId>>

A closed polygon through corners, each [x, y] formulas: its lines, the first from the first corner to the second.

Source

pub fn arc( &mut self, start: PointId, end: PointId, radius: &str, ccw: bool, ) -> GeopResult<CurveId>

The shorter arc of radius from start to end, turning counter-clockwise if ccw.

Source

pub fn circle(&mut self, center: PointId, diameter: &str) -> GeopResult<CurveId>

A circle around center of diameter.

Source

pub fn origin(&self) -> PointId

The fixed point every other is placed from, at (0, 0).

Source

pub fn on(self, plane: SketchPlane) -> AddSketchArgs

The sketch, on plane: drawn where its dimensions put it, so it needs no solving — and a build with the parameters as defined then solves none (see AddSketch), which is what keeps a large profile, a rack’s teeth, cheap to place.

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.