Struct four_bar::plot::FigureBase
source ยท pub struct FigureBase<'a, 'b, M: Clone, C: Clone> {
pub fb: Option<Cow<'b, M>>,
pub angle: Option<f64>,
pub lines: Vec<Rc<RefCell<LineData<'a, C>>>>,
pub opt: Opt<'a>,
}Available on crate feature
plot only.Expand description
Option type base.
Fieldsยง
ยงfb: Option<Cow<'b, M>>Linkage
angle: Option<f64>Input angle
lines: Vec<Rc<RefCell<LineData<'a, C>>>>Line data
opt: Opt<'a>Drawing options
Implementationsยง
sourceยงimpl FigureBase<'_, '_, FourBarBase<UnNorm, NormFourBar>, [f64; 2]>
impl FigureBase<'_, '_, FourBarBase<UnNorm, NormFourBar>, [f64; 2]>
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();sourceยงimpl FigureBase<'_, '_, FourBarBase<UnNorm, SNormFourBar>, [f64; 3]>
impl FigureBase<'_, '_, FourBarBase<UnNorm, SNormFourBar>, [f64; 3]>
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 3D spherical linkage.
Please see Opt for more options.
use four_bar::{plot3d::*, SFourBar};
let fb = SFourBar::example();
let mut buf = String::new();
Figure::from(&fb)
.axis(false)
.add_line("First Curve", fb.curve(180), Style::Line, BLACK)
.plot(SVGBackend::with_string(&mut buf, (1600, 1600)))
.unwrap();sourceยงimpl<'a, 'b, M: Clone, C: Clone> FigureBase<'a, 'b, M, C>
impl<'a, 'b, M: Clone, C: Clone> FigureBase<'a, 'b, M, C>
sourcepub fn with_fb_ref(self, fb: &'b M) -> Self
pub fn with_fb_ref(self, fb: &'b M) -> Self
Attach linkage with its reference.
sourcepub fn angle(self, angle: f64) -> Self
pub fn angle(self, angle: f64) -> Self
Set the input angle of the linkage.
If the angle value is not in the range of
fb::FourBarBase::angle_bound(), the actual angle will be the
midpoint.
sourcepub fn font_family(self, family: impl Into<Cow<'a, str>>) -> Self
pub fn font_family(self, family: impl Into<Cow<'a, str>>) -> Self
Set the font family.
sourcepub fn add_line<S, L>(
self,
label: S,
line: L,
style: Style,
color: RGBColor
) -> Selfwhere
S: Into<Cow<'a, str>>,
L: Into<Cow<'a, [C]>>,
pub fn add_line<S, L>( self, label: S, line: L, style: Style, color: RGBColor ) -> Selfwhere S: Into<Cow<'a, str>>, L: Into<Cow<'a, [C]>>,
Add a line.
sourcepub fn add_line_data(self, data: LineData<'a, C>) -> Self
pub fn add_line_data(self, data: LineData<'a, C>) -> Self
Add a line from a LineData instance.
sourcepub fn push_line<S, L>(
&mut self,
label: S,
line: L,
style: Style,
color: RGBColor
)where
S: Into<Cow<'a, str>>,
L: Into<Cow<'a, [C]>>,
pub fn push_line<S, L>( &mut self, label: S, line: L, style: Style, color: RGBColor )where S: Into<Cow<'a, str>>, L: Into<Cow<'a, [C]>>,
Add a line in-placed.
sourcepub fn push_line_data(&mut self, data: LineData<'a, C>)
pub fn push_line_data(&mut self, data: LineData<'a, C>)
Add a line from a LineData instance in-placed.
Trait Implementationsยง
sourceยงimpl<'a, 'b, M: Clone + Clone, C: Clone + Clone> Clone for FigureBase<'a, 'b, M, C>
impl<'a, 'b, M: Clone + Clone, C: Clone + Clone> Clone for FigureBase<'a, 'b, M, C>
sourceยงfn clone(&self) -> FigureBase<'a, 'b, M, C>
fn clone(&self) -> FigureBase<'a, 'b, M, C>
Returns a copy of the value. Read more
1.0.0 ยท sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceยงimpl<'de, 'a, 'b, M, C> Deserialize<'de> for FigureBase<'a, 'b, M, C>where
FigureBase<'a, 'b, M, C>: Default,
M: Deserialize<'de> + Clone,
C: Deserialize<'de> + Clone,
impl<'de, 'a, 'b, M, C> Deserialize<'de> for FigureBase<'a, 'b, M, C>where FigureBase<'a, 'b, M, C>: Default, M: Deserialize<'de> + Clone, C: Deserialize<'de> + Clone,
sourceยงfn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementationsยง
impl<'a, 'b, M, C> !RefUnwindSafe for FigureBase<'a, 'b, M, C>
impl<'a, 'b, M, C> !Send for FigureBase<'a, 'b, M, C>
impl<'a, 'b, M, C> !Sync for FigureBase<'a, 'b, M, C>
impl<'a, 'b, M, C> Unpin for FigureBase<'a, 'b, M, C>where M: Unpin,
impl<'a, 'b, M, C> !UnwindSafe for FigureBase<'a, 'b, M, C>
Blanket Implementationsยง
sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
ยงimpl<T> Pointable for T
impl<T> Pointable for T
ยงimpl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
ยงfn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreยงfn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).ยงfn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.ยงfn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.