diff options
author | metamuffin <yvchraiqi@protonmail.com> | 2022-06-05 16:32:07 +0200 |
---|---|---|
committer | metamuffin <yvchraiqi@protonmail.com> | 2022-06-05 16:32:07 +0200 |
commit | 280cc84e641872564e35d801fbdc7990e013a0e7 (patch) | |
tree | 5bd73691a61f34d5fab0b7ef1ce37668ccb6c9fd /src/transform.rs | |
parent | 963c729bcdc1e5f82890f96bc55f1532f6eaf763 (diff) | |
download | blubcat-280cc84e641872564e35d801fbdc7990e013a0e7.tar blubcat-280cc84e641872564e35d801fbdc7990e013a0e7.tar.bz2 blubcat-280cc84e641872564e35d801fbdc7990e013a0e7.tar.zst |
polar and translate
Diffstat (limited to 'src/transform.rs')
-rw-r--r-- | src/transform.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/transform.rs b/src/transform.rs index 8b555d1..3994f1d 100644 --- a/src/transform.rs +++ b/src/transform.rs @@ -22,3 +22,13 @@ impl Sample for Polar { self.0.sample(ang, dist) } } + +pub struct Translate { + pub inner: Box<dyn Sample>, + pub offset: (f64, f64), +} +impl Sample for Translate { + fn sample(&mut self, x: f64, y: f64) -> Color { + self.inner.sample(x + self.offset.0, y + self.offset.1) + } +} |