From f10fbd98106fe6fa1fbc54cdb06446e3a3c3e296 Mon Sep 17 00:00:00 2001 From: sheaf Date: Sat, 6 Jan 2024 18:18:14 +0100 Subject: [PATCH] remove traces & minor cleanups --- src/splines/Math/Algebra/Dual/Internal.hs | 2 ++ src/splines/Math/Bezier/Cubic/Fit.hs | 6 ++---- src/splines/Math/Bezier/Stroke.hs | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/splines/Math/Algebra/Dual/Internal.hs b/src/splines/Math/Algebra/Dual/Internal.hs index 32c4814..03c7bc9 100644 --- a/src/splines/Math/Algebra/Dual/Internal.hs +++ b/src/splines/Math/Algebra/Dual/Internal.hs @@ -87,6 +87,7 @@ data D3𝔸1 v = , _D31_dxdxdx :: !( T v ) } deriving stock ( Show, Eq, Functor, Foldable, Traversable, Generic, Generic1 ) + deriving anyclass NFData deriving Applicative via Generically1 D3𝔸1 @@ -107,6 +108,7 @@ data D2𝔸2 v = , _D22_dxdx, _D22_dxdy, _D22_dydy :: !( T v ) } deriving stock ( Show, Eq, Functor, Foldable, Traversable, Generic, Generic1 ) + deriving anyclass NFData deriving Applicative via Generically1 D2𝔸2 diff --git a/src/splines/Math/Bezier/Cubic/Fit.hs b/src/splines/Math/Bezier/Cubic/Fit.hs index 19326e8..9846f0f 100644 --- a/src/splines/Math/Bezier/Cubic/Fit.hs +++ b/src/splines/Math/Bezier/Cubic/Fit.hs @@ -82,8 +82,6 @@ import Math.Roots import Math.Linear ( Mat22(..), ℝ(..), T(..) ) -import Debug.Utils - -------------------------------------------------------------------------------- -- | Parameters to the curve fitting algorithm. @@ -147,8 +145,8 @@ fitSpline ( FitParameters {..} ) curveFn = go 0 ( bez, Max ( Arg max_sq_error t_split_0 ) ) | subdiv >= maxSubdiv || max_sq_error <= dist_tol ^ ( 2 :: Int ) - -> trace ( unlines [ "fitSpline: piece is OK", "t_min = " ++ show t_min, "start = " ++ show p, "start tgt = " ++ show tp, "t_max = " ++ show t_max, "end = " ++ show r, "end tgt = " ++ show tr ] ) - $ ( openCubicBezierCurveSpline () bez, ( FitTangent p tp :<| Seq.fromList ( map FitPoint qs ) ) :|> FitTangent r tr ) + -> -- trace ( unlines [ "fitSpline: piece is OK", "t_min = " ++ show t_min, "start = " ++ show p, "start tgt = " ++ show tp, "t_max = " ++ show t_max, "end = " ++ show r, "end tgt = " ++ show tr ] ) $ + ( openCubicBezierCurveSpline () bez, ( FitTangent p tp :<| Seq.fromList ( map FitPoint qs ) ) :|> FitTangent r tr ) | let t_split :: ℝ 1 t_split = ℝ1 $ min ( 1 - dt ) $ max dt t_split_0 diff --git a/src/splines/Math/Bezier/Stroke.hs b/src/splines/Math/Bezier/Stroke.hs index 21e3512..77bf8c5 100644 --- a/src/splines/Math/Bezier/Stroke.hs +++ b/src/splines/Math/Bezier/Stroke.hs @@ -403,9 +403,7 @@ computeStrokeOutline fitParams ptParams toBrushParams brushFn spline@( Spline { mbOutline <- lift ( readSTRef cachedStrokeRef ) case mbOutline of -- Cached fit data is available: use it. - Just outline -> do - tell outline - pure () + Just outline -> tell outline -- No cached fit: compute the fit anew. Nothing -> do let