Permalink
Browse files

Implicit.Export.Util.normVertex: Avoid spllitting up vectors

  • Loading branch information...
1 parent 507b767 commit 43faf3ed6907091857dd4a5d86d4ca1747fc2990 @bgamari bgamari committed Nov 25, 2012
Showing with 2 additions and 4 deletions.
  1. +2 −4 Graphics/Implicit/Export/Util.hs
@@ -21,7 +21,7 @@ normTriangle res obj tri@(a,b,c) =
r = 0.01 ::
normVertex :: -> Obj3 -> ℝ3 -> (ℝ3, ℝ3)
-normVertex res obj p@(x,y,z) =
+normVertex res obj p =
let
-- D_vf(p) = ( f(p) - f(p+v) ) /|v|
-- but we'll actually scale v by res, so then |v| = res
@@ -33,9 +33,7 @@ normVertex res obj p@(x,y,z) =
dx = d (1, 0, 0)
dy = d (0, 1, 0)
dz = d (0, 0, 1)
- nonUnitNormal = (dx,dy,dz)
- normal = nonUnitNormal ^/ magnitude nonUnitNormal
- in ((x,y,z), normal)
+ in (p, normalized (dx,dy,dz))
{--- If we need to make a 2D mesh finer...
divideMesh2To :: ℝ -> [(ℝ2, ℝ2, ℝ2)] -> [(ℝ2, ℝ2, ℝ2)]

0 comments on commit 43faf3e

Please sign in to comment.