mirror of
https://gitlab.com/sheaf/metabrush.git
synced 2024-11-27 17:34:08 +00:00
remove traces & minor cleanups
This commit is contained in:
parent
326487942e
commit
f10fbd9810
|
@ -87,6 +87,7 @@ data D3𝔸1 v =
|
||||||
, _D31_dxdxdx :: !( T v )
|
, _D31_dxdxdx :: !( T v )
|
||||||
}
|
}
|
||||||
deriving stock ( Show, Eq, Functor, Foldable, Traversable, Generic, Generic1 )
|
deriving stock ( Show, Eq, Functor, Foldable, Traversable, Generic, Generic1 )
|
||||||
|
deriving anyclass NFData
|
||||||
deriving Applicative
|
deriving Applicative
|
||||||
via Generically1 D3𝔸1
|
via Generically1 D3𝔸1
|
||||||
|
|
||||||
|
@ -107,6 +108,7 @@ data D2𝔸2 v =
|
||||||
, _D22_dxdx, _D22_dxdy, _D22_dydy :: !( T v )
|
, _D22_dxdx, _D22_dxdy, _D22_dydy :: !( T v )
|
||||||
}
|
}
|
||||||
deriving stock ( Show, Eq, Functor, Foldable, Traversable, Generic, Generic1 )
|
deriving stock ( Show, Eq, Functor, Foldable, Traversable, Generic, Generic1 )
|
||||||
|
deriving anyclass NFData
|
||||||
deriving Applicative
|
deriving Applicative
|
||||||
via Generically1 D2𝔸2
|
via Generically1 D2𝔸2
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,6 @@ import Math.Roots
|
||||||
import Math.Linear
|
import Math.Linear
|
||||||
( Mat22(..), ℝ(..), T(..) )
|
( Mat22(..), ℝ(..), T(..) )
|
||||||
|
|
||||||
import Debug.Utils
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- | Parameters to the curve fitting algorithm.
|
-- | Parameters to the curve fitting algorithm.
|
||||||
|
@ -147,8 +145,8 @@ fitSpline ( FitParameters {..} ) curveFn = go 0
|
||||||
( bez, Max ( Arg max_sq_error t_split_0 ) )
|
( bez, Max ( Arg max_sq_error t_split_0 ) )
|
||||||
| subdiv >= maxSubdiv
|
| subdiv >= maxSubdiv
|
||||||
|| max_sq_error <= dist_tol ^ ( 2 :: Int )
|
|| 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 ] )
|
-> -- 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 )
|
( openCubicBezierCurveSpline () bez, ( FitTangent p tp :<| Seq.fromList ( map FitPoint qs ) ) :|> FitTangent r tr )
|
||||||
| let
|
| let
|
||||||
t_split :: ℝ 1
|
t_split :: ℝ 1
|
||||||
t_split = ℝ1 $ min ( 1 - dt ) $ max dt t_split_0
|
t_split = ℝ1 $ min ( 1 - dt ) $ max dt t_split_0
|
||||||
|
|
|
@ -403,9 +403,7 @@ computeStrokeOutline fitParams ptParams toBrushParams brushFn spline@( Spline {
|
||||||
mbOutline <- lift ( readSTRef cachedStrokeRef )
|
mbOutline <- lift ( readSTRef cachedStrokeRef )
|
||||||
case mbOutline of
|
case mbOutline of
|
||||||
-- Cached fit data is available: use it.
|
-- Cached fit data is available: use it.
|
||||||
Just outline -> do
|
Just outline -> tell outline
|
||||||
tell outline
|
|
||||||
pure ()
|
|
||||||
-- No cached fit: compute the fit anew.
|
-- No cached fit: compute the fit anew.
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
let
|
let
|
||||||
|
|
Loading…
Reference in a new issue