コード例 #1
0
	def minimize(self, vector3):
		'Minimize the vector3 over the loops, paths and perimeters.'
		pointComplex = vector3.dropAxis()
		pointComplex = euclidean.getMinimum(euclidean.getMinimumByComplexPaths(self.boundaryLoops), pointComplex)
		pointComplex = euclidean.getMinimum(euclidean.getMinimumByComplexPaths(self.innerPerimeters), pointComplex)
		pointComplex = euclidean.getMinimum(euclidean.getMinimumByComplexPaths(self.loops), pointComplex)
		pointComplex = euclidean.getMinimum(euclidean.getMinimumByComplexPaths(self.outerPerimeters), pointComplex)
		pointComplex = euclidean.getMinimum(euclidean.getMinimumByComplexPaths(self.paths), pointComplex)
		vector3.setToXYZ(pointComplex.real, pointComplex.imag, min(self.z, vector3.z))
コード例 #2
0
ファイル: grid.py プロジェクト: 1060460048/Cura
def getGeometryOutput(elementNode):
	'Get vector3 vertexes from attribute dictionary.'
	derivation = GridDerivation(elementNode)
	diameter = derivation.radius + derivation.radius
	typeStringTwoCharacters = derivation.typeString.lower()[: 2]
	typeStringFirstCharacter = typeStringTwoCharacters[: 1]
	topRight = complex(derivation.demiwidth, derivation.demiheight)
	loopsComplex = [euclidean.getSquareLoopWiddershins(-topRight, topRight)]
	if len(derivation.target) > 0:
		loopsComplex = euclidean.getComplexPaths(derivation.target)
	maximumComplex = euclidean.getMaximumByComplexPaths(loopsComplex)
	minimumComplex = euclidean.getMinimumByComplexPaths(loopsComplex)
	gridPath = None
	if typeStringTwoCharacters == 'he':
		gridPath = getHexagonalGrid(diameter, loopsComplex, maximumComplex, minimumComplex, derivation.zigzag)
	elif typeStringTwoCharacters == 'ra' or typeStringFirstCharacter == 'a':
		gridPath = getRandomGrid(derivation, diameter, elementNode, loopsComplex, maximumComplex, minimumComplex)
	elif typeStringTwoCharacters == 're' or typeStringFirstCharacter == 'e':
		gridPath = getRectangularGrid(diameter, loopsComplex, maximumComplex, minimumComplex, derivation.zigzag)
	if gridPath == None:
		print('Warning, the step type was not one of (hexagonal, random or rectangular) in getGeometryOutput in grid for:')
		print(derivation.typeString)
		print(elementNode)
		return []
	loop = euclidean.getVector3Path(gridPath)
	elementNode.attributes['closed'] = 'false'
	return lineation.getGeometryOutputByLoop(elementNode, lineation.SideLoop(loop, 0.5 * math.pi))
コード例 #3
0
def getGeometryOutput(elementNode):
    'Get vector3 vertexes from attribute dictionary.'
    derivation = GridDerivation(elementNode)
    diameter = derivation.radius + derivation.radius
    typeStringTwoCharacters = derivation.typeString.lower()[:2]
    typeStringFirstCharacter = typeStringTwoCharacters[:1]
    topRight = complex(derivation.demiwidth, derivation.demiheight)
    loopsComplex = [euclidean.getSquareLoopWiddershins(-topRight, topRight)]
    if len(derivation.target) > 0:
        loopsComplex = euclidean.getComplexPaths(derivation.target)
    maximumComplex = euclidean.getMaximumByComplexPaths(loopsComplex)
    minimumComplex = euclidean.getMinimumByComplexPaths(loopsComplex)
    gridPath = None
    if typeStringTwoCharacters == 'he':
        gridPath = getHexagonalGrid(diameter, loopsComplex, maximumComplex,
                                    minimumComplex, derivation.zigzag)
    elif typeStringTwoCharacters == 'ra' or typeStringFirstCharacter == 'a':
        gridPath = getRandomGrid(derivation, diameter, elementNode,
                                 loopsComplex, maximumComplex, minimumComplex)
    elif typeStringTwoCharacters == 're' or typeStringFirstCharacter == 'e':
        gridPath = getRectangularGrid(diameter, loopsComplex, maximumComplex,
                                      minimumComplex, derivation.zigzag)
    if gridPath == None:
        print(
            'Warning, the step type was not one of (hexagonal, random or rectangular) in getGeometryOutput in grid for:'
        )
        print(derivation.typeString)
        print(elementNode)
        return []
    loop = euclidean.getVector3Path(gridPath)
    elementNode.attributes['closed'] = 'false'
    return lineation.getGeometryOutputByLoop(
        elementNode, lineation.SideLoop(loop, 0.5 * math.pi))