Author Brent Yorgey
 Title Lozenge
 Created at Tue Dec 3 14:48:28 UTC 2013
 Parent paste  #248
strip :: (Double -> Double) -> Double -> Double -> Int -> Double -> Diagram SVG R2
strip f lo hi n offset
  = [lo, lo + (hi - lo) / (fromIntegral n - 1) .. hi]
  # map (square . f)
  # hcat' with {sep = offset, catMethod = Distrib}

lozenge = vcat' with { sep = 3, catMethod = Distrib } (replicate 7 str)
        # centerXY
  where str = strip (\x -> cos x + 1) (-pi) pi 23 3
  
example = mconcat
  [ lozenge # fc black
  , lozenge # fc red
    # translateY (-1.5)
    # translateX (width lozenge / 2 - 4.5)
  ]
Result
Warning
This binding for ‛offset’ shadows the existing binding
imported from ‛Diagrams.Prelude’
(and originally defined in ‛Diagrams.Trail’)
Warning
Top-level binding with no type signature: lozenge :: Diagram SVG R2
Warning
Top-level binding with no type signature: example :: Diagram SVG R2