Created
March 27, 2015 12:39
-
-
Save ppetr/f64c95613ecc481f80a1 to your computer and use it in GitHub Desktop.
Sub/supersonic propeller sound and shock wave diagrams
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Propeller where | |
import qualified Data.Foldable as F | |
import Diagrams.Prelude | |
import Diagrams.Backend.SVG | |
import Diagrams.Backend.SVG.CmdLine | |
type Diag = Diagram SVG R2 | |
wave :: Double -> Double -> Diag | |
wave ang radius = circle radius # translate (r2 (0, 1)) # rotate (ang @@ rad) | |
waves :: Double -> Diag | |
waves speed = pad 1.1 $ unitCircle # lc red # lw thick <> | |
F.foldMap (\i -> let j = i * pi * 2 / density in wave (j * speed) j) [1..count] | |
where | |
density = 20 | |
count = density * 3 / 2 | |
example :: Diag | |
example = | |
waves 0.6 | |
=== | |
waves 1.0 | |
=== | |
waves 1.3 | |
main = mainWith (example # lw veryThin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment