Beispiel #1
0
def __mirrorData(jsonData, plane):

    if isinstance(jsonData, Vec3):
        return jsonData

    if isinstance(jsonData, Quat):
        newQuat = Quat(jsonData)
        newQuat.mirror(plane)
        return newQuat

    elif isinstance(jsonData, Xfo):
        newXfo = Xfo(jsonData)
        if plane == 0:
            newXfo.tr.x = -newXfo.tr.x
        elif plane == 1:
            newXfo.tr.y = -newXfo.tr.y
        elif plane == 2:
            newXfo.tr.z = -newXfo.tr.z
        
        newXfo.ori.mirror(plane)
        return newXfo

    elif type(jsonData) is list:
        newList = []
        for item in jsonData:
            newList.append(__mirrorData(item, plane))
        return newList

    elif type(jsonData) is dict:
        newDict = {}
        for key, value in jsonData.iteritems():
            newDict[key] = __mirrorData(value, plane)
        return newDict
        
    return jsonData
Beispiel #2
0
def __mirrorData(jsonData, plane):

    if isinstance(jsonData, Vec3):
        return jsonData

    if isinstance(jsonData, Quat):
        newQuat = Quat(jsonData)
        newQuat.mirror(plane)
        return newQuat

    elif isinstance(jsonData, Xfo):
        newXfo = Xfo(jsonData)
        if plane == 0:
            newXfo.tr.x = -newXfo.tr.x
        elif plane == 1:
            newXfo.tr.y = -newXfo.tr.y
        elif plane == 2:
            newXfo.tr.z = -newXfo.tr.z

        newXfo.ori.mirror(plane)
        return newXfo

    elif type(jsonData) is list:
        newList = []
        for item in jsonData:
            newList.append(__mirrorData(item, plane))
        return newList

    elif type(jsonData) is dict:
        newDict = {}
        for key, value in jsonData.iteritems():
            newDict[key] = __mirrorData(value, plane)
        return newDict

    return jsonData