Skip to content

Instantly share code, notes, and snippets.

@wchargin
Created September 14, 2023 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wchargin/73dd2ed0af74abacd9b08cf3482da77b to your computer and use it in GitHub Desktop.
Save wchargin/73dd2ed0af74abacd9b08cf3482da77b to your computer and use it in GitHub Desktop.
patches to qqlrs to force Margin::Wide and reduce scale changes
diff --git a/src/art.rs b/src/art.rs
index 78e28bf..aaf353f 100644
--- a/src/art.rs
+++ b/src/art.rs
@@ -213,7 +213,7 @@ impl ColorChangeOdds {
}
}
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub enum ScaleGenerator {
Constant {
mean: f64,
@@ -933,7 +933,7 @@ impl Points {
if rng.odds(color_change_odds.line) {
scale_generator.change(rng);
}
- let scale = scale_generator.next(rng);
+ let scale = scale_generator.clone().next(&mut rng.clone());
let mut primary_color_spec = color_db
.color(color_scheme.primary_seq[primary_color_idx])
@@ -984,7 +984,7 @@ impl Points {
}
// For the next line/dot-sequence, potentially change the color and scale
- scale_generator.change(rng); // NOTE: This doesn't update `scale` (?).
+ //scale_generator.change(rng); // NOTE: This doesn't update `scale` (?).
if rng.odds(color_change_odds.line) {
primary_color_idx =
pick_next_color(&color_scheme.primary_seq, primary_color_idx, rng);
@@ -1501,7 +1501,8 @@ pub struct Render {
}
pub fn draw(seed: &[u8; 32], color_db: &ColorDb, config: &Config, canvas_width: i32) -> Render {
- let traits = Traits::from_seed(seed);
+ let mut traits = Traits::from_seed(seed);
+ traits.margin = Margin::Wide;
let mut rng = Rng::from_seed(&seed[..]);
eprintln!("initialized traits");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment