Esempio n. 1
0
	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 )
		innerHorizontalSegmentTable = self.getHorizontalSegmentTableForXIntersectionsTable( boundaryLayer.innerHorizontalTable )
		innerVerticalSegmentTable = self.getVerticalSegmentTableForXIntersectionsTable( boundaryLayer.innerVerticalTable )
		betweenPoints = getPointsFromSegmentTable( boundaryLayer.horizontalSegmentTable )
		betweenPoints += getPointsFromSegmentTable( boundaryLayer.verticalSegmentTable )
		innerPoints = getPointsFromSegmentTable( innerHorizontalSegmentTable )
		innerPoints += getPointsFromSegmentTable( innerVerticalSegmentTable )
		innerPointTable = {}
		for innerPoint in innerPoints:
			innerPointTable[ innerPoint ] = None
		boundaryLayer.innerLoops = []
		boundaryLayer.outerLoops = []
		millRadius = 0.75 * self.millWidth
		loops = triangle_mesh.getDescendingAreaLoops(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
Esempio n. 2
0
def getLoopsIntersectionByPair(importRadius, loopsFirst, loopsLast):
	'Get intersection loops for a pair of loop lists.'
	halfImportRadius = 0.5 * importRadius # so that there are no misses on shallow angles
	radiusSide = 0.01 * importRadius
	corners = []
	corners += getInsetPointsByInsetLoops(loopsFirst, True, loopsLast, radiusSide)
	corners += getInsetPointsByInsetLoops(loopsLast, True, loopsFirst, radiusSide)
	allPoints = corners[:]
	allPoints += getInsetPointsByInsetLoops(getInBetweenLoopsFromLoops(loopsFirst, halfImportRadius), True, loopsLast, radiusSide)
	allPoints += getInsetPointsByInsetLoops(getInBetweenLoopsFromLoops(loopsLast, halfImportRadius), True, loopsFirst, radiusSide)
	return triangle_mesh.getDescendingAreaLoops(allPoints, corners, importRadius)
Esempio n. 3
0
def getLoopsDifference(importRadius, loopLists):
	'Get difference loops.'
	halfImportRadius = 0.5 * importRadius # so that there are no misses on shallow angles
	radiusSide = 0.01 * importRadius
	negativeLoops = getLoopsUnified(importRadius, loopLists[1 :])
	intercircle.directLoops(False, negativeLoops)
	positiveLoops = loopLists[0]
	intercircle.directLoops(True, positiveLoops)
	corners = getInsetPointsByInsetLoops(negativeLoops, True, positiveLoops, radiusSide)
	corners += getInsetPointsByInsetLoops(positiveLoops, False, negativeLoops, radiusSide)
	allPoints = corners[:]
	allPoints += getInsetPointsByInsetLoops(getInBetweenLoopsFromLoops(negativeLoops, halfImportRadius), True, positiveLoops, radiusSide)
	allPoints += getInsetPointsByInsetLoops(getInBetweenLoopsFromLoops(positiveLoops, halfImportRadius), False, negativeLoops, radiusSide)
	return triangle_mesh.getDescendingAreaLoops(allPoints, corners, importRadius)
Esempio n. 4
0
def getLoopsUnified(importRadius, loopLists):
	'Get joined loops sliced through shape.'
	allPoints = []
	corners = getLoopsListsIntersections(loopLists)
	radiusSide = 0.01 * importRadius
	radiusSideNegative = -radiusSide
	intercircle.directLoopLists(True, loopLists)
	for loopListIndex in xrange(len(loopLists)):
		insetLoops = loopLists[ loopListIndex ]
		inBetweenInsetLoops = getInBetweenLoopsFromLoops(insetLoops, importRadius)
		otherLoops = euclidean.getConcatenatedList(loopLists[: loopListIndex] + loopLists[loopListIndex + 1 :])
		corners += getInsetPointsByInsetLoops(insetLoops, False, otherLoops, radiusSide)
		allPoints += getInsetPointsByInsetLoops(inBetweenInsetLoops, False, otherLoops, radiusSideNegative)
	allPoints += corners[:]
	return triangle_mesh.getDescendingAreaLoops(allPoints, corners, importRadius)
Esempio n. 5
0
 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)
     innerHorizontalSegmentTable = self.getHorizontalSegmentTableForXIntersectionsTable(
         boundaryLayer.innerHorizontalTable)
     innerVerticalSegmentTable = self.getVerticalSegmentTableForXIntersectionsTable(
         boundaryLayer.innerVerticalTable)
     betweenPoints = getPointsFromSegmentTable(
         boundaryLayer.horizontalSegmentTable)
     betweenPoints += getPointsFromSegmentTable(
         boundaryLayer.verticalSegmentTable)
     innerPoints = getPointsFromSegmentTable(innerHorizontalSegmentTable)
     innerPoints += getPointsFromSegmentTable(innerVerticalSegmentTable)
     innerPointTable = {}
     for innerPoint in innerPoints:
         innerPointTable[innerPoint] = None
     boundaryLayer.innerLoops = []
     boundaryLayer.outerLoops = []
     millRadius = 0.75 * self.millWidth
     loops = triangle_mesh.getDescendingAreaLoops(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