コード例 #1
0
ファイル: Vector.py プロジェクト: microelly2/PyFlowCypher
    def move(
            a=('AnyPin', [], {
                "enabledOptions":
                PinOptions.ArraySupported | PinOptions.AllowAny
            }),
            v=('VectorPin', MVector()),
    ):
        ''' add vector v to a list of vectors a'''

        rc = [MVector(av) + v for av in a]
        say(rc)
        return rc
コード例 #2
0
    def move(a=('AnyPin', [], {
        'constraint':
        '1',
        "enabledOptions":
        PinOptions.ArraySupported | PinOptions.AllowAny
    }),
             v=('VectorPin', MVector())):
        ''' huhuh '''

        rc = [MVector(av) + v for av in a]
        say(rc)
        return rc
コード例 #3
0
ファイル: Vector.py プロジェクト: microelly2/PyFlowCypher
 def vecZ(Vector=('VectorPin', MVector())):
     ''' vector coordinate z'''
     return Vector.z
コード例 #4
0
ファイル: Vector.py プロジェクト: microelly2/PyFlowCypher
 def vecY(Vector=('VectorPin', MVector())):
     ''' vector coordinate y'''
     return Vector.y
コード例 #5
0
ファイル: Vector.py プロジェクト: microelly2/PyFlowCypher
 def vecX(Vector=('VectorPin', MVector())):
     ''' vector coordinate x'''
     return Vector.x
コード例 #6
0
ファイル: Vector.py プロジェクト: microelly2/PyFlowCypher
 def vecCreate(X=('Float', 0), Y=('Float', 0), Z=('Float', 0)):
     ''' vector by coordinates X, Y, Z.'''
     v = MVector(X, Y, Z)
     #say("create vector",v)
     return v
コード例 #7
0
ファイル: Vector.py プロジェクト: microelly2/PyFlowCypher
 def list2Vector(XYZ=('FloatPin', [], {
     "enabledOptions": PinOptions.ArraySupported
 })):
     ''' vector by coordinates X, Y, Z.'''
     v = MVector(*XYZ)
     return v
コード例 #8
0
ファイル: Vector.py プロジェクト: microelly2/PyFlowCypher
class Vector(FunctionLibraryBase):
    '''doc string for Vector'''
    def __init__(self, packageName):
        super(Vector, self).__init__(packageName)

    @staticmethod
    @IMPLEMENT_NODE(returns=('VectorPin', MVector()),
                    nodeType=NodeTypes.Pure,
                    meta={
                        'Category': 'Vector',
                        'Keywords': ['Vector']
                    })
    def list2Vector(XYZ=('FloatPin', [], {
        "enabledOptions": PinOptions.ArraySupported
    })):
        ''' vector by coordinates X, Y, Z.'''
        v = MVector(*XYZ)
        return v

    @staticmethod
    @IMPLEMENT_NODE(returns=('VectorPin', MVector()),
                    nodeType=NodeTypes.Pure,
                    meta={
                        'Category': 'Vector',
                        'Keywords': ['Vector']
                    })
    def vecCreate(X=('Float', 0), Y=('Float', 0), Z=('Float', 0)):
        ''' vector by coordinates X, Y, Z.'''
        v = MVector(X, Y, Z)
        #say("create vector",v)
        return v

    @staticmethod
    @IMPLEMENT_NODE(returns=('FloatPin', 0),
                    nodeType=NodeTypes.Pure,
                    meta={
                        'Category': 'Vector',
                        'Keywords': ['Vector']
                    })
    def vecX(Vector=('VectorPin', MVector())):
        ''' vector coordinate x'''
        return Vector.x

    @staticmethod
    @IMPLEMENT_NODE(returns=('FloatPin', 0),
                    nodeType=NodeTypes.Pure,
                    meta={
                        'Category': 'Vector',
                        'Keywords': ['Vector']
                    })
    def vecY(Vector=('VectorPin', MVector())):
        ''' vector coordinate y'''
        return Vector.y

    @staticmethod
    @IMPLEMENT_NODE(returns=('FloatPin', 0),
                    nodeType=NodeTypes.Pure,
                    meta={
                        'Category': 'Vector',
                        'Keywords': ['Vector']
                    })
    def vecZ(Vector=('VectorPin', MVector())):
        ''' vector coordinate z'''
        return Vector.z

    @staticmethod
    @IMPLEMENT_NODE(returns=("FloatPin", 0.0),
                    meta={
                        'Category': 'Vector',
                        'Keywords': ['vector', '|', 'dot', 'product']
                    })
    def vecDotProduct(a=("AnyPin", None, {
        "constraint":
        "1",
        "supportedDataTypes": ["FloatVector4Pin", "VectorPin", "QuatPin"]
    }),
                      b=("AnyPin", None, {
                          "constraint":
                          "1",
                          "supportedDataTypes":
                          ["FloatVector4Pin", "VectorPin", "QuatPin"]
                      })):
        '''Dot product'''
        return a.dot(b)

    @staticmethod
    @IMPLEMENT_NODE(returns=('VectorPin', MVector(1, 2, 3)),
                    nodeType=NodeTypes.Pure,
                    meta={
                        'Category': 'Vector',
                        'Keywords': ['Vector', '+']
                    })
    def vecAdd(a=('VectorPin', MVector()), b=('VectorPin', MVector())):
        '''adds vector a and b'''
        return a + b

    @staticmethod
    @IMPLEMENT_NODE(returns=('VectorPin', MVector()),
                    nodeType=NodeTypes.Pure,
                    meta={
                        'Category': 'Vector',
                        'Keywords': ['Vector', '-']
                    })
    def vecSubstract(a=('VectorPin', MVector()), b=('VectorPin', MVector())):
        '''substracts vector a and b'''
        return a - b

    @staticmethod
    @IMPLEMENT_NODE(returns=('VectorPin', MVector()),
                    nodeType=NodeTypes.Pure,
                    meta={
                        'Category': 'Vector',
                        'Keywords': ['Vector', '-']
                    })
    def between(a=('VectorPin', MVector()),
                b=('VectorPin', MVector()),
                m=('Integer', 5)):
        '''between vector a and b'''

        return a * 0.1 * (10 - m) + b * m * 0.1

    @staticmethod
    @IMPLEMENT_NODE(returns=('AnyPin', []),
                    nodeType=NodeTypes.Pure,
                    meta={
                        'Category': 'Vector',
                        'Keywords': ['Vector', '-']
                    })
    def betweenList(a=('AnyPin', [], {
        'constraint':
        '1',
        "enabledOptions":
        PinOptions.ArraySupported | PinOptions.AllowAny
    }),
                    b=('AnyPin', [], {
                        'constraint':
                        '1',
                        "enabledOptions":
                        PinOptions.ArraySupported | PinOptions.AllowAny
                    }),
                    m=('Integer', 5)):
        '''between list a and b'''
        rc = [av * 0.1 * (10 - m) + bv * m * 0.1 for av, bv in zip(a, b)]
        return rc

    @staticmethod
    @IMPLEMENT_NODE(returns=('VectorPin', [MVector()]),
                    meta={
                        'Category': 'Vector',
                        'Keywords': ['Vector', '-']
                    })
    @IMPLEMENT_NODE(returns=('AnyPin', []),
                    nodeType=NodeTypes.Pure,
                    meta={
                        'Category': 'Vector',
                        'Keywords': ['Vector', '-']
                    })
    def move(
            a=('AnyPin', [], {
                "enabledOptions":
                PinOptions.ArraySupported | PinOptions.AllowAny
            }),
            v=('VectorPin', MVector()),
    ):
        ''' add vector v to a list of vectors a'''

        rc = [MVector(av) + v for av in a]
        say(rc)
        return rc

    @staticmethod
    @IMPLEMENT_NODE(returns=(
        'StringPin',
        "workspace",
    ),
                    meta={
                        'Category': 'Document',
                        'Keywords': []
                    })
    def workspace(
            name=('String', "workspace"),
            temp=('BoolPin', True),
    ):

        say("workspace called")
        return (name)
コード例 #9
0
ファイル: Vector.py プロジェクト: microelly2/PyFlowCypher
    def between(a=('VectorPin', MVector()),
                b=('VectorPin', MVector()),
                m=('Integer', 5)):
        '''between vector a and b'''

        return a * 0.1 * (10 - m) + b * m * 0.1
コード例 #10
0
ファイル: Vector.py プロジェクト: microelly2/PyFlowCypher
 def vecSubstract(a=('VectorPin', MVector()), b=('VectorPin', MVector())):
     '''substracts vector a and b'''
     return a - b
コード例 #11
0
ファイル: Vector.py プロジェクト: microelly2/PyFlowCypher
 def vecAdd(a=('VectorPin', MVector()), b=('VectorPin', MVector())):
     '''adds vector a and b'''
     return a + b
コード例 #12
0
 def vecCreate(X=('FloatPin', 0), Y=('FloatPin', 0), Z=('FloatPin', 0)):
     ''' vector by coordinates X, Y, Z.'''
     v = MVector(X, Y, Z)
     return v