Exemple #1
0
def getLoopsWithCorners(corners, importRadius, loops, pointTable):
    "Add corners to the loops."
    shortestAdditionalLength = 0.85 * importRadius
    for corner in corners:
        if corner not in pointTable:
            addWithLeastLength(loops, corner, shortestAdditionalLength)
    return euclidean.getSimplifiedLoops(loops, importRadius)
Exemple #2
0
def getLoopsWithCorners(corners, importRadius, loops, pointTable):
	'Add corners to the loops.'
	for corner in corners:
		if corner not in pointTable:
			addWithLeastLength(importRadius, loops, corner)
			pointTable[corner] = None
	return euclidean.getSimplifiedLoops(loops, importRadius)
Exemple #3
0
def getLoopsWithCorners(corners, importRadius, loops, pointTable):
	'Add corners to the loops.'
	for corner in corners:
		if corner not in pointTable:
			addWithLeastLength(importRadius, loops, corner)
			pointTable[corner] = None
	return euclidean.getSimplifiedLoops(loops, importRadius)
Exemple #4
0
def getLoopsWithCorners( corners, importRadius, loops, pointTable ):
	"Add corners to the loops."
	shortestAdditionalLength = 0.85 * importRadius
	for corner in corners:
		if corner not in pointTable:
			addWithLeastLength( loops, corner, shortestAdditionalLength )
	return euclidean.getSimplifiedLoops(loops, importRadius)
	def getLoops( self, importRadius, z ):
		"Get loops sliced through shape."
		if len( self.subObjects ) < 1:
			return []
		subObjectLoopsList = getSubObjectLoopsList( importRadius, self.subObjects, z )
		loops = self.operationFunction( importRadius, subObjectLoopsList )
		return euclidean.getSimplifiedLoops( loops, importRadius )
Exemple #6
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 = trianglemesh.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
Exemple #7
0
	def getLoops(self, importRadius, z):
		"Get loops sliced through shape."
		visibleObjects = evaluate.getVisibleObjects(self.archivableObjects)
		if len( visibleObjects ) < 1:
			return []
		visibleObjectLoopsList = getVisibleObjectLoopsList( importRadius, visibleObjects, z )
		loops = self.getLoopsFromObjectLoopsList( importRadius, visibleObjectLoopsList )
		return euclidean.getSimplifiedLoops( loops, importRadius )
Exemple #8
0
	def getLoops(self, importRadius, z):
		'Get loops sliced through shape.'
		visibleObjects = evaluate.getVisibleObjects(self.archivableObjects)
		if len( visibleObjects ) < 1:
			return []
		visibleObjectLoopsList = getVisibleObjectLoopsList( importRadius, visibleObjects, z )
		loops = self.getLoopsFromObjectLoopsList(importRadius, visibleObjectLoopsList)
		return euclidean.getSimplifiedLoops( loops, importRadius )
Exemple #9
0
	def getLoopsFromMesh( self, z ):
		'Get loops from a carve of a mesh.'
		originalLoops = []
		self.setEdgesForAllFaces()
		if self.isCorrectMesh:
			originalLoops = getLoopsFromCorrectMesh( self.edges, self.faces, self.getTransformedVertexes(), z )
		if len( originalLoops ) < 1:
			originalLoops = getLoopsFromUnprovenMesh( self.edges, self.faces, self.importRadius, self.getTransformedVertexes(), z )
		loops = euclidean.getSimplifiedLoops(originalLoops, self.importRadius)
		sortLoopsInOrderOfArea(True, loops)
		return getOrientedLoops(loops)
Exemple #10
0
	def getLoopsFromMesh( self, z ):
		'Get loops from a carve of a mesh.'
		originalLoops = []
		self.setEdgesForAllFaces()
		if self.isCorrectMesh:
			originalLoops = getLoopsFromCorrectMesh( self.edges, self.faces, self.getTransformedVertexes(), z )
		if len( originalLoops ) < 1:
			originalLoops = getLoopsFromUnprovenMesh( self.edges, self.faces, self.importRadius, self.getTransformedVertexes(), z )
		loops = euclidean.getSimplifiedLoops(originalLoops, self.importRadius)
		sortLoopsInOrderOfArea(True, loops)
		return getOrientedLoops(loops)
Exemple #11
0
def getDescendingAreaLoops(allPoints, corners, importRadius):
	'Get descending area loops which include most of the points.'
	loops = intercircle.getCentersFromPoints(allPoints, importRadius)
	descendingAreaLoops = []
	sortLoopsInOrderOfArea(True, loops)
	pointDictionary = {}
	for loop in loops:
		if len(loop) > 2 and getOverlapRatio(loop, pointDictionary) < 0.3 and intercircle.getIsLarge(loop, importRadius):
			intercircle.directLoop(not euclidean.getIsInFilledRegion(descendingAreaLoops, loop[0]), loop)
			descendingAreaLoops.append(loop)
			addLoopToPointTable(loop, pointDictionary)
	descendingAreaLoops = euclidean.getSimplifiedLoops(descendingAreaLoops, importRadius)
	return getLoopsWithCorners(corners, importRadius, descendingAreaLoops, pointDictionary)
Exemple #12
0
def getDescendingAreaLoops(allPoints, corners, importRadius):
	'Get loops which include most of the points.'
	loops = intercircle.getCentersFromPoints(allPoints, importRadius)
	descendingAreaLoops = []
	sortLoopsInOrderOfArea(True, loops)
	pointDictionary = {}
	for loop in loops:
		if len(loop) > 2 and getOverlapRatio(loop, pointDictionary) < 0.1:
			intercircle.directLoop(not euclidean.getIsInFilledRegion(descendingAreaLoops, loop[0]), loop)
			descendingAreaLoops.append(loop)
			addLoopToPointTable(loop, pointDictionary)
	descendingAreaLoops = euclidean.getSimplifiedLoops(descendingAreaLoops, importRadius)
	return getLoopsWithCorners(corners, importRadius, descendingAreaLoops, pointDictionary)
	def getLoopsFromMesh( self, z ):
		"Get loops from a carve of a mesh."
		originalLoops = []
		if self.isCorrectMesh:
			originalLoops = getLoopsFromCorrectMesh( self.edges, self.faces, self.getVertices(), z )
		if len( originalLoops ) < 1:
			originalLoops = getLoopsFromUnprovenMesh( self.edges, self.faces, self.importRadius, self.getVertices(), z )
		loops = getLoopsInOrderOfArea( compareAreaDescending, euclidean.getSimplifiedLoops( originalLoops, self.importRadius ) )
		for loopIndex in xrange( len( loops ) ):
			loop = loops[ loopIndex ]
			leftPoint = euclidean.getLeftPoint( loop )
			isInFilledRegion = euclidean.isInFilledRegion( loops[ : loopIndex ] + loops[ loopIndex + 1 : ], leftPoint )
			if isInFilledRegion == euclidean.isWiddershins( loop ):
				loop.reverse()
		return loops
	def getLoopsFromMesh( self, z ):
		"Get loops from a carve of a mesh."
		originalLoops = []
		if self.isCorrectMesh:
			originalLoops = getLoopsFromCorrectMesh( self.edges, self.faces, self.getTransformedVertexes(), z )
		if len( originalLoops ) < 1:
			originalLoops = getLoopsFromUnprovenMesh( self.edges, self.faces, self.importRadius, self.getTransformedVertexes(), z )
		loops = getLoopsInOrderOfArea( compareAreaDescending, euclidean.getSimplifiedLoops( originalLoops, self.importRadius ) )
		for loopIndex in xrange( len(loops) ):
			loop = loops[loopIndex]
			leftPoint = euclidean.getLeftPoint(loop)
			isInFilledRegion = euclidean.getIsInFilledRegion( loops[ : loopIndex ] + loops[loopIndex + 1 :], leftPoint )
			if isInFilledRegion == euclidean.isWiddershins(loop):
				loop.reverse()
		return loops