Skip to content

Commit

Permalink
Merge pull request #375 from ryantrinkle/loop-normal-check
Browse files Browse the repository at this point in the history
Rather than using a heuristic, choose whichever point is closest to t…
  • Loading branch information
julialongtin authored Feb 27, 2021
2 parents 9343e61 + 895a86c commit d0a9429
Show file tree
Hide file tree
Showing 8 changed files with 2,808 additions and 2,808 deletions.
4 changes: 2 additions & 2 deletions Graphics/Implicit/Export/Render/TesselateLoops.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ tesselateLoop res obj pathSides = pure $ Tris $ TriangleMesh $
normal = preNormal ^/ preNormalNorm
deriv = (obj (mid + (normal ^* (res/100)) ) - midval)/res*100
mid' = mid - normal ^* (midval/deriv)
in if abs midval > res/50 && preNormalNorm > 0.5 && abs deriv > 0.5
&& abs (midval/deriv) < 2*res && 3*abs (obj mid') < abs midval
midval' = obj mid'
in if abs midval' < abs midval
then early_tris <> [Triangle (a,b,mid') | (a,b) <- zip path (tail path <> [head path]) ]
else early_tris <> [Triangle (a,b,mid) | (a,b) <- zip path (tail path <> [head path]) ]

Expand Down
Loading

0 comments on commit d0a9429

Please sign in to comment.