From 497d0de43e6932763df00f94bf98a353423471fa Mon Sep 17 00:00:00 2001 From: Julia Longtin Date: Wed, 9 Jun 2021 23:14:36 +0000 Subject: [PATCH 1/2] abuse more parallelism. --- programs/extcuraengine.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/programs/extcuraengine.hs b/programs/extcuraengine.hs index d37352ccd..0e1c4336f 100644 --- a/programs/extcuraengine.hs +++ b/programs/extcuraengine.hs @@ -121,13 +121,16 @@ centeredTrisFromSTL (RectArea (bedX,bedY,_)) stl = shiftedTris where centerPoint = Point3 (dx,dy,dz) shiftedTris = [shiftTri centerPoint tri | tri <- tris] `using` parListChunk (div (length tris) (fromFastℕ threads)) rseq + xs = [ xOf.fst <$> triPoints | triPoints <- sidesOf <$> tris ] `using` parListChunk (div (length tris) (fromFastℕ threads)) rseq + ys = [ yOf.fst <$> triPoints | triPoints <- sidesOf <$> tris ] `using` parListChunk (div (length tris) (fromFastℕ threads)) rseq + zs = [ zOf.fst <$> triPoints | triPoints <- sidesOf <$> tris ] `using` parListChunk (div (length tris) (fromFastℕ threads)) rseq tris = trianglesFromSTL threads stl (dx,dy,dz) = (bedX/2-x0, bedY/2-y0, -zMin) - xMin = minimum $ xOf.fst <$> foldMap sidesOf tris - yMin = minimum $ yOf.fst <$> foldMap sidesOf tris - zMin = minimum $ zOf.fst <$> foldMap sidesOf tris - xMax = maximum $ xOf.fst <$> foldMap sidesOf tris - yMax = maximum $ yOf.fst <$> foldMap sidesOf tris + xMin = minimum $ concat xs + xMax = maximum $ concat xs + yMin = minimum $ concat ys + yMax = maximum $ concat ys + zMin = minimum $ concat zs (x0,y0) = ((xMax+xMin)/2-xMin, (yMax+yMin)/2-yMin) ----------------------------------------------------------------------- From 91565106d0b6ec23c3d3285d44bd4273fc661c68 Mon Sep 17 00:00:00 2001 From: Julia Longtin Date: Thu, 10 Jun 2021 08:00:36 +0000 Subject: [PATCH 2/2] remove warning. --- programs/extcuraengine.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/extcuraengine.hs b/programs/extcuraengine.hs index 0e1c4336f..69494e7a7 100644 --- a/programs/extcuraengine.hs +++ b/programs/extcuraengine.hs @@ -28,7 +28,7 @@ -- For matching our OpenScad variable types. {-# LANGUAGE ViewPatterns #-} -import Prelude ((*), (/), (+), (-), odd, mod, round, floor, foldMap, (<>), FilePath, fromInteger, error, div, reverse, fst, filter, (<=)) +import Prelude ((*), (/), (+), (-), odd, mod, round, floor, (<>), FilePath, fromInteger, error, div, reverse, fst, filter, (<=)) import Control.Applicative (pure, (<*>), (<$>))