From 5cef2777fbf0cf386a5d3c82f42c5af9d239534a Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Wed, 24 Jan 2018 14:00:49 +0100 Subject: [PATCH] save precision squared in const --- src/sliceActions/generateSupport.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sliceActions/generateSupport.js b/src/sliceActions/generateSupport.js index 76181de..2c8393b 100644 --- a/src/sliceActions/generateSupport.js +++ b/src/sliceActions/generateSupport.js @@ -2,6 +2,8 @@ import getFillTemplate from './getFillTemplate.js'; import Shape from 'clipper-js'; import { PRECISION } from '../constants.js'; +const PRECISION_SQUARED = Math.pow(PRECISION, 2); + export default function generateSupport(slices, settings) { if (!settings.support.enabled) return; @@ -27,7 +29,7 @@ export default function generateSupport(slices, settings) { const neededSupportArea = upSkin.outline.difference(currentLayer.outline.offset(margin)); - if (neededSupportArea.totalArea() * Math.pow(PRECISION, 2) > minArea) { + if (neededSupportArea.totalArea() * PRECISION_SQUARED > minArea) { supportArea = supportArea.union(neededSupportArea); } if (downSkin) supportArea = supportArea.difference(downSkin.outline.offset(margin));