module Geom2D.CubicBezier.Outline
(bezierOffset, bezierOffsetPoint)
where
import Geom2D
import Geom2D.CubicBezier.Basic
import Geom2D.CubicBezier.Approximate
offsetPoint :: (Floating a) => a -> Point a -> Point a -> Point a
offsetPoint dist start tangent =
start ^+^ (rotate90L $* dist *^ normVector tangent)
bezierOffsetPoint :: CubicBezier Double -> Double -> Double -> (DPoint, DPoint)
bezierOffsetPoint cb dist t = (offsetPoint dist p p', p')
where (p, p') = evalBezierDeriv cb t
bezierOffset :: CubicBezier Double
-> Double
-> Maybe Int
-> Double
-> [CubicBezier Double]
bezierOffset cb dist (Just m) tol =
approximatePathMax m (bezierOffsetPoint cb dist) 15 tol 0 1 False
bezierOffset cb dist Nothing tol =
approximatePath (bezierOffsetPoint cb dist) 15 tol 0 1 False