pub type Figure<'a, 'b> = FigureBase<'a, 'b, FourBar, [f64; 2]>;Available on crate feature
plot only.Expand description
Drawing option of four-bar linkage and its input angle.
use four_bar::{plot2d::Figure, FourBar};
// From linkage
let figure = Figure::from(&FourBar::example());
// Without linkage
let figure = Figure::new();Aliased Type§
struct Figure<'a, 'b> {
pub fb: Option<Cow<'b, FourBarBase<UnNorm, NormFourBar>>>,
pub angle: Option<f64>,
pub lines: Vec<Rc<RefCell<LineData<'a, [f64; 2]>>>>,
pub opt: Opt<'a>,
}Fields§
§fb: Option<Cow<'b, FourBarBase<UnNorm, NormFourBar>>>Linkage
angle: Option<f64>Input angle
lines: Vec<Rc<RefCell<LineData<'a, [f64; 2]>>>>Line data
opt: Opt<'a>Drawing options
Implementations§
source§impl Figure<'_, '_>
impl Figure<'_, '_>
sourcepub fn plot<B, R>(
&self,
root: R
) -> Result<(), DrawingAreaErrorKind<<B as DrawingBackend>::ErrorType>>where
B: DrawingBackend,
DrawingArea<B, Shift>: From<R>,
pub fn plot<B, R>( &self, root: R ) -> Result<(), DrawingAreaErrorKind<<B as DrawingBackend>::ErrorType>>where B: DrawingBackend, DrawingArea<B, Shift>: From<R>,
Plot 2D curves and linkages.
use four_bar::{plot::*, plot2d, FourBar};
let fb = FourBar::example();
let mut buf = String::new();
plot2d::Figure::from(&fb)
.axis(false)
.add_line("First Curve", fb.curve(180), Style::Line, BLACK)
.plot(SVGBackend::with_string(&mut buf, (1600, 1600)))
.unwrap();