Struct aoer_plotty_rs::l_system::LSystem
source · [−]Expand description
LSystem
What it says on the box; a simple L-system implementation for use with plotter based fractal art.
Example
use aoer_plotty_rs::turtle::{TurtleTrait, Turtle, degrees};
use aoer_plotty_rs::l_system::LSystem;
use aoer_plotty_rs::geo_types::nannou::NannouDrawer;
use std::collections::HashMap;
use nannou::lyon::tessellation::{LineCap, LineJoin};
use nannou::Draw;
let draw = Draw::new();
let gosper = LSystem{
axiom: "A".to_string(),
rules: HashMap::from([
('A', "A-B--B+A++AA+B-".to_string()),
('B', "+A-BB--B-A++A+B". to_string())])
};
let tlines = Turtle::new()
.pen_down()
.walk_lpath(&gosper.expand(4), degrees(60.0), 8.0)
.to_multiline();
for line in tlines {
draw.polyline()
.stroke_weight(3.0)
.caps(LineCap::Round)
.join(LineJoin::Round)
.polyline_from_linestring(&line)
.color(nannou::color::NAVY);
}
Fields
axiom: String
rules: HashMap<char, String>
Implementations
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for LSystem
impl Send for LSystem
impl Sync for LSystem
impl Unpin for LSystem
impl UnwindSafe for LSystem
Blanket Implementations
sourceimpl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
sourcefn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified
method Read more
sourcefn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford
method by default Read more
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
sourcefn convert_into(self) -> U
fn convert_into(self) -> U
Convert into T with values clamped to the color defined bounds Read more
sourcefn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
Convert into T. The resulting color might be invalid in its color space Read more
sourcefn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
Convert into T, returning ok if the color is inside of its defined range,
otherwise an
OutOfBounds
error is returned which contains the unclamped color. Read moreimpl<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 morefn 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.