Browse files

Merge branch 'master' of github.com:colah/ImplicitCAD

  • Loading branch information...
2 parents 606e228 + f8b7135 commit 47cc7238281808347bd8b53c5c0a4ca0cb524bfc @colah committed Dec 13, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 Benchmark.hs
View
12 Benchmark.hs
@@ -1,5 +1,7 @@
import Criterion.Main
import Graphics.Implicit
+import Graphics.Implicit.Export.SymbolicObj2
+import Graphics.Implicit.Export.SymbolicObj3
import Graphics.Implicit.Primitives
obj2d_1 :: SymbolicObj2
@@ -27,23 +29,33 @@ object2 = squarePipe (10,10,10) 1 100
(map (\n->(n/precision)*y) [0..precision])
(map (\n->(n/precision)*z) [0..precision])
+object3 :: SymbolicObj3
+object3 =
+ difference
+ [ rect3R 1 (-1,-1,-1) (1,1,1)
+ , rect3R 1 (0,0,0) (2,2,2)
+ ]
+
obj2Benchmarks :: String -> SymbolicObj2 -> Benchmark
obj2Benchmarks name obj =
bgroup name
[ bench "SVG write" $ writeSVG 1 "benchmark.svg" obj
, bench "PNG write" $ writePNG2 1 "benchmark.png" obj
+ , bench "Get contour" $ nf (symbolicGetContour 1) obj
]
obj3Benchmarks :: String -> SymbolicObj3 -> Benchmark
obj3Benchmarks name obj =
bgroup name
[ --bench "PNG write" $ writePNG3 1 "benchmark.png" obj
bench "STL write" $ writeSTL 1 "benchmark.stl" obj
+ , bench "Get mesh" $ nf (symbolicGetMesh 1) obj
]
benchmarks =
[ obj3Benchmarks "Object 1" object1
, obj3Benchmarks "Object 2" object2
+ , obj3Benchmarks "Object 3" object3
]
main = defaultMain benchmarks

0 comments on commit 47cc723

Please sign in to comment.