def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.skirtOutset-self.edgeWidth*(self.repository.brimWidth.value+1)) self.outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: self.outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(self.outsetLoops))] if self.repository.brimWidth.value > 0: points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.edgeWidth*0.5) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetBrimLoops = outsetLoops for self.brimLine in xrange(self.brimLine+1,self.repository.brimWidth.value): points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.edgeWidth*(self.brimLine+0.5)) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetBrimLoops += outsetLoops
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.skirtOutset-self.edgeWidth*(self.repository.brimWidth.value+1)) self.outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: self.outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(self.outsetLoops))] self.outsetBrimLoops = [] for self.brimLine in xrange( self.repository.brimWidth.value-1, self.brimLine, -1 ): points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.edgeWidth*(self.brimLine+0.5)) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetBrimLoops += outsetLoops if self.repository.brimWidth.value > 0: points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.edgeWidth*0.5) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetBrimLoops += outsetLoops
def addSegmentTableLoops( self, boundaryLayerIndex ): 'Add the segment tables and loops to the boundary.' boundaryLayer = self.boundaryLayers[boundaryLayerIndex] euclidean.subtractXIntersectionsTable(boundaryLayer.outerHorizontalTable, boundaryLayer.innerHorizontalTable) euclidean.subtractXIntersectionsTable(boundaryLayer.outerVerticalTable, boundaryLayer.innerVerticalTable) boundaryLayer.horizontalSegmentTable = self.getHorizontalSegmentTableForXIntersectionsTable( boundaryLayer.outerHorizontalTable) boundaryLayer.verticalSegmentTable = self.getVerticalSegmentTableForXIntersectionsTable( boundaryLayer.outerVerticalTable) betweenPoints = getPointsFromSegmentTable(boundaryLayer.horizontalSegmentTable) betweenPoints += getPointsFromSegmentTable(boundaryLayer.verticalSegmentTable) innerPoints = euclidean.getPointsByHorizontalDictionary(self.millWidth, boundaryLayer.innerHorizontalTable) innerPoints += euclidean.getPointsByVerticalDictionary(self.millWidth, boundaryLayer.innerVerticalTable) innerPointTable = {} for innerPoint in innerPoints: innerPointTable[innerPoint] = None boundaryLayer.innerLoops = [] boundaryLayer.outerLoops = [] millRadius = 0.75 * self.millWidth loops = triangle_mesh.getDescendingAreaOrientedLoops(betweenPoints, betweenPoints, millRadius) for loop in loops: if isPointOfTableInLoop(loop, innerPointTable): boundaryLayer.innerLoops.append(loop) else: boundaryLayer.outerLoops.append(loop) if self.repository.crossHatch.value and boundaryLayerIndex % 2 == 1: boundaryLayer.segmentTable = boundaryLayer.verticalSegmentTable else: boundaryLayer.segmentTable = boundaryLayer.horizontalSegmentTable
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.perimeterWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.perimeterWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, self.perimeterWidth) outerLoops = getOuterLoops(loops) self.outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(-self.skirtOutset, outerLoops) self.outsetLoops = getOuterLoops(self.outsetLoops)
def createSkirtLoops(self): "Create the skirt loops." points = euclidean.getPointsByHorizontalDictionary(self.perimeterWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.perimeterWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.perimeterWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.skirtOutset) self.outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: self.outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(self.outsetLoops))]
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.perimeterWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.perimeterWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.perimeterWidth) outerLoops = getOuterLoops(loops) outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(-self.skirtOutset, outerLoops) self.outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: self.outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(self.outsetLoops))]
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) self.outsetLoops = [] for i in xrange(self.repository.skirtLineCount.value, 0, -1): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(outerLoops, -self.skirtOutset - i * self.edgeWidth) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] self.outsetLoops.extend(outsetLoops)
def createSkirtLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary( self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary( self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops( points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) self.outsetLoops = [] for i in xrange(self.repository.skirtLineCount.value, 0, -1): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops( outerLoops, -self.skirtOutset - (i - 1) * self.edgeWidth) outsetLoops = getOuterLoops(outsetLoops) if self.repository.convex.value: outsetLoops = [ euclidean.getLoopConvex( euclidean.getConcatenatedList(outsetLoops)) ] self.outsetLoops.extend(outsetLoops)
def createSkirtLoops(self, gap, shellCount): 'Create the skirt loops.' outset = gap + self.edgeWidth points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = self.getOuterLoops(loops) skirtLoops = [] for shellNo in xrange(shellCount): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(-(outset + self.edgeWidth * shellNo), outerLoops) outsetLoops = self.getOuterLoops(outsetLoops) if self.convex: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] for outsetLoop in outsetLoops: skirtLoops.append(outsetLoop + [outsetLoop[0]]) return skirtLoops
def createSkirtLoops(self, gap, shellCount): "Create the skirt loops." outset = gap + self.edgeWidth points = euclidean.getPointsByHorizontalDictionary(self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary(self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops(points, points, 2.5 * self.edgeWidth) outerLoops = self.getOuterLoops(loops) skirtLoops = [] for shellNo in xrange(shellCount): outsetLoops = intercircle.getInsetSeparateLoopsFromLoops(-(outset + self.edgeWidth * shellNo), outerLoops) outsetLoops = self.getOuterLoops(outsetLoops) if self.convex: outsetLoops = [euclidean.getLoopConvex(euclidean.getConcatenatedList(outsetLoops))] for outsetLoop in outsetLoops: skirtLoops.append(outsetLoop + [outsetLoop[0]]) return skirtLoops
def createSkirtAndBrimLoops(self): 'Create the skirt loops.' points = euclidean.getPointsByHorizontalDictionary( self.edgeWidth, self.unifiedLoop.horizontalDictionary) points += euclidean.getPointsByVerticalDictionary( self.edgeWidth, self.unifiedLoop.verticalDictionary) loops = triangle_mesh.getDescendingAreaOrientedLoops( points, points, 2.5 * self.edgeWidth) outerLoops = getOuterLoops(loops) 'Create combined skirt and/or brim loops' self.baseOutsetLoops = [] self.upperOutsetLoops = [] 'self.getSkirtShellOutset(0)' skirtMin = self.getShellOutset( math.floor(self.repository.gapOverEdgeWidth.value)) skirtMax = self.getShellOutset( math.ceil(self.repository.gapOverEdgeWidth.value) + self.repository.baseShells.value) brimMax = self.getShellOutset(self.repository.brimWidth.value) if self.repository.activateSkirt.value and not self.repository.activateBrim.value: self.upperOutsetLoops = self.getOutsetLoops( outerLoops, -self.getSkirtShellOutset(0), self.repository.convex.value) for shellIndex in xrange(self.repository.baseShells.value, 0, -1): outsetLoops = self.getOutsetLoops( outerLoops, -self.getSkirtShellOutset(shellIndex - 1), self.repository.convex.value) self.baseOutsetLoops += outsetLoops elif not self.repository.activateSkirt.value and self.repository.activateBrim.value: for shellIndex in xrange(self.repository.brimWidth.value, 0, -1): outsetLoops = self.getOutsetLoops( outerLoops, -self.getShellOutset(shellIndex - 1), False) self.baseOutsetLoops += outsetLoops elif self.repository.activateSkirt.value and self.repository.activateBrim.value: if skirtMax <= brimMax: 'Skirt is fully inside brim' 'With a convex skirt the threads of skirt may have a big distance to perimeter.' 'Even if brim is large (brim should be non convex in optimal code), the convex skirt and the outer brim may collide' 'Next best solution so far is to make outer brim also following convex. The critical outer corners are touched anyway.' self.upperOutsetLoops = self.getOutsetLoops( outerLoops, -self.skirtOutset, self.repository.convex.value) for shellIndex in xrange(self.repository.brimWidth.value, 0, -1): if (self.getShellOutset(shellIndex - 1) >= skirtMin): outsetLoops = self.getOutsetLoops( outerLoops, -self.getShellOutset(shellIndex - 1), self.repository.convex.value) else: outsetLoops = self.getOutsetLoops( outerLoops, -self.getShellOutset(shellIndex - 1), False) self.baseOutsetLoops += outsetLoops elif skirtMax > brimMax: 'Skirt base shells starts outside brim' if skirtMin >= brimMax: 'Skirt base is outside of brim' 'For skirt base layers we can use convex because convex threads are always further away from perimeter then BrimMax.' self.upperOutsetLoops = self.getOutsetLoops( outerLoops, -self.skirtOutset, self.repository.convex.value) for shellIndex in xrange(self.repository.baseShells.value, 0, -1): outsetLoops = self.getOutsetLoops( outerLoops, -self.getSkirtShellOutset(shellIndex - 1), self.repository.convex.value) self.baseOutsetLoops += outsetLoops for shellIndex in xrange(self.repository.brimWidth.value, 0, -1): outsetLoops = self.getOutsetLoops( outerLoops, -self.getShellOutset(shellIndex - 1), False) self.baseOutsetLoops += outsetLoops else: 'Skirt base touches brim' self.upperOutsetLoops = self.getOutsetLoops( outerLoops, -self.skirtOutset, self.repository.convex.value) for shellIndex in xrange( self.repository.baseShells.value + self.repository.brimWidth.value, 0, -1): if (self.getShellOutset(shellIndex - 1) < skirtMax ) and (self.getShellOutset(shellIndex - 1) >= skirtMin): outsetLoops = self.getOutsetLoops( outerLoops, -self.getShellOutset(shellIndex - 1), self.repository.convex.value) self.baseOutsetLoops += outsetLoops elif (self.getShellOutset(shellIndex - 1) < skirtMin): outsetLoops = self.getOutsetLoops( outerLoops, -self.getShellOutset(shellIndex - 1), False) self.baseOutsetLoops += outsetLoops