示例#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.getInclusiveLoops( betweenPoints, betweenPoints, millRadius )
		loops = euclidean.getSimplifiedLoops( loops, 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
示例#2
0
	def getJoinedLoops( self, importRadius, subObjectInfoLoopsList ):
		"Get joined loops sliced through shape."
		loops = []
		for subObjectInfoLoops in subObjectInfoLoopsList:
			loops += subObjectInfoLoops
		corners = []
		for loop in loops:
			corners += loop
		corners += getLoopsListsIntersections( subObjectInfoLoopsList )
		allPoints = corners[ : ]
		allPoints += getInBetweenPointsFromLoops( importRadius, loops )
		return triangle_mesh.getInclusiveLoops( allPoints, corners, importRadius, False )
示例#3
0
	def getIntersectedLoops( self, importRadius, subObjectInfoLoopsList ):
		"Get intersected loops sliced through shape."
		firstLoops = subObjectInfoLoopsList[ 0 ]
		lastLoops = getJoinedList( subObjectInfoLoopsList[ 1 : ] )
		radiusSide = 0.01 * importRadius
		corners = getPointsBoundarySideLoops( True, firstLoops, getJoinedList( lastLoops ), radiusSide )
		corners += getPointsBoundarySideLoops( True, lastLoops, getJoinedList( firstLoops ), radiusSide )
		corners += getLoopsListsIntersections( subObjectInfoLoopsList )
		allPoints = corners[ : ]
		allPoints += getInBetweenPointsFromLoopsBoundarySideOtherLoops( True, importRadius, lastLoops, firstLoops, radiusSide )
		allPoints += getInBetweenPointsFromLoopsBoundarySideOtherLoops( True, importRadius, firstLoops, lastLoops, radiusSide )
		return triangle_mesh.getInclusiveLoops( allPoints, corners, importRadius, False )
示例#4
0
	def getSubtractedLoops( self, importRadius, subObjectInfoLoopsList ):
		"Get subtracted loops sliced through shape."
		negativeLoops = getJoinedList( subObjectInfoLoopsList[ 1 : ] )
		positiveLoops = subObjectInfoLoopsList[ 0 ]
		radiusSide = 0.01 * importRadius
		corners = getPointsBoundarySideLoops( True, positiveLoops, getJoinedList( negativeLoops ), radiusSide )
		corners += getPointsBoundarySideLoops( False, negativeLoops, getJoinedList( positiveLoops ), radiusSide )
		loopsListsIntersections = getLoopsListsIntersections( subObjectInfoLoopsList )
		corners += loopsListsIntersections
		allPoints = corners[ : ]
		allPoints += getInBetweenPointsFromLoopsBoundarySideOtherLoops( True, importRadius, negativeLoops, positiveLoops, radiusSide )
		allPoints += getInBetweenPointsFromLoopsBoundarySideOtherLoops( False, importRadius, positiveLoops, negativeLoops, radiusSide )
		return triangle_mesh.getInclusiveLoops( allPoints, corners, importRadius, False )
示例#5
0
文件: mill.py 项目: yazici/skeinforge
 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.getInclusiveLoops(betweenPoints, betweenPoints,
                                             millRadius)
     loops = euclidean.getSimplifiedLoops(loops, 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