Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sub/supersonic propeller sound and shock wave diagrams
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
You can’t perform that action at this time.