示例#1
0
def getCubicPath(xmlElement):
    "Get the cubic path."
    end = evaluate.getVector3FromXMLElement(xmlElement)
    previousXMLElement = xmlElement.getPreviousXMLElement()
    if previousXMLElement == None:
        print(
            'Warning, can not get previousXMLElement in getCubicPath in cubic for:'
        )
        print(xmlElement)
        return [end]
    begin = xmlElement.getPreviousVertex(Vector3())
    controlPoint0 = evaluate.getVector3ByPrefix('controlPoint0', None,
                                                xmlElement)
    if controlPoint0 == None:
        oldControlPoint = evaluate.getVector3ByPrefixes(
            ['controlPoint', 'controlPoint1'], None, previousXMLElement)
        if oldControlPoint == None:
            print(
                'Warning, can not get oldControlPoint in getCubicPath in cubic for:'
            )
            print(xmlElement)
            return [end]
        controlPoint0 = begin + begin - oldControlPoint
    controlPoints = [
        controlPoint0,
        evaluate.getVector3ByPrefix('controlPoint1', None, xmlElement)
    ]
    return svg_reader.getCubicPoints(
        begin, controlPoints, end,
        lineation.getNumberOfBezierPoints(begin, end, xmlElement))
示例#2
0
def getCubicPath(xmlElement):
	"Get the cubic path."
	end = evaluate.getVector3FromXMLElement(xmlElement)
	previousXMLElement = xmlElement.getPreviousXMLElement()
	if previousXMLElement == None:
		print('Warning, can not get previousXMLElement in getCubicPath in cubic for:')
		print(xmlElement)
		return [end]
	begin = xmlElement.getPreviousVertex(Vector3())
	controlPoint0 = evaluate.getVector3ByPrefix('controlPoint0', None, xmlElement)
	if controlPoint0 == None:
		oldControlPoint = evaluate.getVector3ByPrefixes(['controlPoint','controlPoint1'], None, previousXMLElement)
		if oldControlPoint == None:
			print('Warning, can not get oldControlPoint in getCubicPath in cubic for:')
			print(xmlElement)
			return [end]
		controlPoint0 = begin + begin - oldControlPoint
	controlPoints = [controlPoint0, evaluate.getVector3ByPrefix('controlPoint1', None, xmlElement)]
	return svg_reader.getCubicPoints(begin, controlPoints, end, lineation.getNumberOfBezierPoints(begin, end, xmlElement))
示例#3
0
def getCubicPathByBeginEnd(begin, controlPoints, elementNode, end):
	"Get the cubic path by begin and end."
	return svg_reader.getCubicPoints(begin, controlPoints, end, lineation.getNumberOfBezierPoints(begin, elementNode, end))