module Graphics.PS.Bezier (bezier4) where import Graphics.PS.Pt {-- bezier3 :: Pt -> Pt -> Pt -> Double -> Pt bezier3 (Pt x1 y1) (Pt x2 y2) (Pt x3 y3) mu = (Pt x y) where a = mu * mu b = 1 - mu c = b * b x = x1 * c + 2 * x2 * b * mu + x3 * a y = y1 * c + 2 * y2 * b * mu + y3 * a --} bezier4 :: Pt -> Pt -> Pt -> Pt -> Double -> Pt bezier4 (Pt x1 y1) (Pt x2 y2) (Pt x3 y3) (Pt x4 y4) mu = let a = 1 - mu b = a*a*a c = mu*mu*mu x = b*x1 + 3*mu*a*a*x2 + 3*mu*mu*a*x3 + c*x4 y = b*y1 + 3*mu*a*a*y2 + 3*mu*mu*a*y3 + c*y4 in Pt x y