Expand description
§Hyperion
- Stochasic
- Contextual
- Parametric
§Usage
As an example well implement the origin LSystem for the growth of algea.
Hyperion is a framework for working with generic LSystems the first step is to create an enum for grammar that makes up the lsystem.
NOTE: This doesn’t necessarily have to be an enum. &’static str/String could also work.
use hyperion::{Rule, LSystemBuilder};
// By Default Alphabet is implemented for any `Copy + PartialEq` type.
#[derive(Clone, Copy, PartialEq)]
pub enum Algea {
A,
B,
}
/// Create an LSystem by passing in an Axiom and Rules.
use Algea::*;
let lsys = LSystemBuilder::new([A])
.rule(Rule::new(A, [A, B]))
.rule(Rule::new(B, [A]))
.build();
// To Evauluate the LSystem call .`sample(generation)`.
lsys.sample(4);
// returns [A, B, A, A, B, A, B, A]
More examples can be found in the tests
folder. And a more complex example with rendering a 3d mesh with bevy can be found in the examples folder and run with
cargo run --example bevy_forest --release
§Features
- grammar (default)
§License
All code in this repository is dual-licensed under either:
- MIT License (LICENSE-MIT or MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or APACHE)
at your option. This means you can select the license you prefer.
§Your contributions
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Modules§
Structs§
- Axiom
- The intiial Axiom used when starting the LSystem
- Condition
- Context
- The context given to each Grammar token when evaluating rules.
- LSystem
- LSystem
Builder - Builder struct to create a LSystem.
- Module
- A module is a Single Instance of a Grammar type with all included parameters.
- Rule
- Rules
- State
- The current State of an LSystem.
Enums§
- Conditional
- Conditional used when elvaluating LSystem rules.
- Conditional
Value - Operator
- Mathamatical operator that can be used on parameters.
- Value
Traits§
- Alphabet
- Marker trait for a type that can be used as an LSystem grammer.