⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flames.c

📁 《精通matlab与c++混合编程》的光盘内容
💻 C
📖 第 1 页 / 共 3 页
字号:
     * 
     * %This loop causes the logo to rise.
     * for i = 1:a-1
     */
    {
        int v_ = mclForIntStart(1);
        int e_ = mclForIntEnd(mclMinus(mclVv(a, "a"), _mxarray14_));
        if (v_ > e_) {
            mlfAssign(&i, _mxarray35_);
        } else {
            /*
             * if ~isempty(get(gcf,'UserData'))
             * theRand = [theRand(3:end,:);theRand(1:2,:)];
             * movedUp = [X(2:end,:);theOnes];
             * movedUp2 = [movedUp(2:end,:);theOnes];
             * upAndLeftAndRight = ([movedUp2(:,2:end),theZeros]) + ...
             * ([theZeros,movedUp2(:,1:end-1)]);
             * theTemp = theRand .* X;
             * X = theTemp + theTemp + movedUp + upAndLeftAndRight + movedUp2 ;
             * X = X ./ max(max(X));
             * X([zeros(a-i-1,b);theLogo(1:i+1,:)]==1) = 1;
             * set(theImage,'CData',X.*201);
             * drawnow;
             * end
             * end
             */
            for (; ; ) {
                if (mclNotBool(
                      mlfIsempty(mlfNGet(1, mlfGcf(), _mxarray12_, NULL)))) {
                    mlfAssign(
                      &theRand,
                      mlfVertcat(
                        mclArrayRef2(
                          mclVv(theRand, "theRand"),
                          mlfColon(
                            _mxarray74_,
                            mlfEnd(
                              mclVv(theRand, "theRand"),
                              _mxarray14_,
                              _mxarray40_),
                            NULL),
                          mlfCreateColonIndex()),
                        mclArrayRef2(
                          mclVv(theRand, "theRand"),
                          mlfColon(_mxarray14_, _mxarray40_, NULL),
                          mlfCreateColonIndex()),
                        NULL));
                    mlfAssign(
                      &movedUp,
                      mlfVertcat(
                        mclArrayRef2(
                          mclVv(X, "X"),
                          mlfColon(
                            _mxarray40_,
                            mlfEnd(mclVv(X, "X"), _mxarray14_, _mxarray40_),
                            NULL),
                          mlfCreateColonIndex()),
                        mclVv(theOnes, "theOnes"),
                        NULL));
                    mlfAssign(
                      &movedUp2,
                      mlfVertcat(
                        mclArrayRef2(
                          mclVv(movedUp, "movedUp"),
                          mlfColon(
                            _mxarray40_,
                            mlfEnd(
                              mclVv(movedUp, "movedUp"),
                              _mxarray14_,
                              _mxarray40_),
                            NULL),
                          mlfCreateColonIndex()),
                        mclVv(theOnes, "theOnes"),
                        NULL));
                    mlfAssign(
                      &upAndLeftAndRight,
                      mclPlus(
                        mlfHorzcat(
                          mclArrayRef2(
                            mclVv(movedUp2, "movedUp2"),
                            mlfCreateColonIndex(),
                            mlfColon(
                              _mxarray40_,
                              mlfEnd(
                                mclVv(movedUp2, "movedUp2"),
                                _mxarray40_,
                                _mxarray40_),
                              NULL)),
                          mclVv(theZeros, "theZeros"),
                          NULL),
                        mlfHorzcat(
                          mclVv(theZeros, "theZeros"),
                          mclArrayRef2(
                            mclVv(movedUp2, "movedUp2"),
                            mlfCreateColonIndex(),
                            mlfColon(
                              _mxarray14_,
                              mclMinus(
                                mlfEnd(
                                  mclVv(movedUp2, "movedUp2"),
                                  _mxarray40_,
                                  _mxarray40_),
                                _mxarray14_),
                              NULL)),
                          NULL)));
                    mlfAssign(
                      &theTemp,
                      mclTimes(mclVv(theRand, "theRand"), mclVv(X, "X")));
                    mlfAssign(
                      &X,
                      mclPlus(
                        mclPlus(
                          mclPlus(
                            mclPlus(
                              mclVv(theTemp, "theTemp"),
                              mclVv(theTemp, "theTemp")),
                            mclVv(movedUp, "movedUp")),
                          mclVv(upAndLeftAndRight, "upAndLeftAndRight")),
                        mclVv(movedUp2, "movedUp2")));
                    mlfAssign(
                      &X,
                      mclRdivide(
                        mclVv(X, "X"),
                        mlfMax(
                          NULL,
                          mlfMax(NULL, mclVv(X, "X"), NULL, NULL),
                          NULL,
                          NULL)));
                    mclArrayAssign1(
                      &X,
                      _mxarray14_,
                      mclEq(
                        mlfVertcat(
                          mlfZeros(
                            mclMinus(
                              mclMinus(mclVv(a, "a"), mlfScalar(v_)),
                              _mxarray14_),
                            mclVv(b, "b"),
                            NULL),
                          mclArrayRef2(
                            mclVa(theLogo, "theLogo"),
                            mlfColon(_mxarray14_, mlfScalar(v_ + 1), NULL),
                            mlfCreateColonIndex()),
                          NULL),
                        _mxarray14_));
                    mclAssignAns(
                      &ans,
                      mlfNSet(
                        0,
                        mclVa(theImage, "theImage"),
                        _mxarray72_,
                        mclTimes(mclVv(X, "X"), _mxarray39_),
                        NULL));
                    mlfDrawnow(NULL);
                }
                if (v_ == e_) {
                    break;
                }
                ++v_;
            }
            mlfAssign(&i, mlfScalar(v_));
        }
    }
    /*
     * 
     * %This while loop just keeps cycling the flames until the window is
     * %closed.
     * while ~isempty(get(gcf,'UserData'))
     */
    while (mclNotBool(mlfIsempty(mlfNGet(1, mlfGcf(), _mxarray12_, NULL)))) {
        /*
         * theRand = [theRand(3:end,:);theRand(1:2,:)];
         */
        mlfAssign(
          &theRand,
          mlfVertcat(
            mclArrayRef2(
              mclVv(theRand, "theRand"),
              mlfColon(
                _mxarray74_,
                mlfEnd(mclVv(theRand, "theRand"), _mxarray14_, _mxarray40_),
                NULL),
              mlfCreateColonIndex()),
            mclArrayRef2(
              mclVv(theRand, "theRand"),
              mlfColon(_mxarray14_, _mxarray40_, NULL),
              mlfCreateColonIndex()),
            NULL));
        /*
         * movedUp = [X(2:end,:);theOnes];
         */
        mlfAssign(
          &movedUp,
          mlfVertcat(
            mclArrayRef2(
              mclVv(X, "X"),
              mlfColon(
                _mxarray40_,
                mlfEnd(mclVv(X, "X"), _mxarray14_, _mxarray40_),
                NULL),
              mlfCreateColonIndex()),
            mclVv(theOnes, "theOnes"),
            NULL));
        /*
         * movedUp2 = [movedUp(2:end,:);theOnes];
         */
        mlfAssign(
          &movedUp2,
          mlfVertcat(
            mclArrayRef2(
              mclVv(movedUp, "movedUp"),
              mlfColon(
                _mxarray40_,
                mlfEnd(mclVv(movedUp, "movedUp"), _mxarray14_, _mxarray40_),
                NULL),
              mlfCreateColonIndex()),
            mclVv(theOnes, "theOnes"),
            NULL));
        /*
         * upAndLeftAndRight = ([movedUp2(:,2:end),theZeros])+ ...
         */
        mlfAssign(
          &upAndLeftAndRight,
          mclPlus(
            mlfHorzcat(
              mclArrayRef2(
                mclVv(movedUp2, "movedUp2"),
                mlfCreateColonIndex(),
                mlfColon(
                  _mxarray40_,
                  mlfEnd(mclVv(movedUp2, "movedUp2"), _mxarray40_, _mxarray40_),
                  NULL)),
              mclVv(theZeros, "theZeros"),
              NULL),
            mlfHorzcat(
              mclVv(theZeros, "theZeros"),
              mclArrayRef2(
                mclVv(movedUp2, "movedUp2"),
                mlfCreateColonIndex(),
                mlfColon(
                  _mxarray14_,
                  mclMinus(
                    mlfEnd(
                      mclVv(movedUp2, "movedUp2"), _mxarray40_, _mxarray40_),
                    _mxarray14_),
                  NULL)),
              NULL)));
        /*
         * ([theZeros,movedUp2(:,1:end-1)]);
         * theTemp = theRand .* X;
         */
        mlfAssign(&theTemp, mclTimes(mclVv(theRand, "theRand"), mclVv(X, "X")));
        /*
         * X = theTemp + theTemp + movedUp + upAndLeftAndRight + movedUp2 ;
         */
        mlfAssign(
          &X,
          mclPlus(
            mclPlus(
              mclPlus(
                mclPlus(mclVv(theTemp, "theTemp"), mclVv(theTemp, "theTemp")),
                mclVv(movedUp, "movedUp")),
              mclVv(upAndLeftAndRight, "upAndLeftAndRight")),
            mclVv(movedUp2, "movedUp2")));
        /*
         * X = X ./ (max(max(X)));
         */
        mlfAssign(
          &X,
          mclRdivide(
            mclVv(X, "X"),
            mlfMax(NULL, mlfMax(NULL, mclVv(X, "X"), NULL, NULL), NULL, NULL)));
        /*
         * X(theLogical==1) = 1;
         */
        mclArrayAssign1(
          &X, _mxarray14_, mclEq(mclVv(theLogical, "theLogical"), _mxarray14_));
        /*
         * set(theImage,'CData',X.*201);
         */
        mclAssignAns(
          &ans,
          mlfNSet(
            0,
            mclVa(theImage, "theImage"),
            _mxarray72_,
            mclTimes(mclVv(X, "X"), _mxarray39_),
            NULL));
        /*
         * drawnow;
         */
        mlfDrawnow(NULL);
    /*
     * end
     */
    }
    mxDestroyArray(X);
    mxDestroyArray(a);
    mxDestroyArray(b);
    mxDestroyArray(theZeros);
    mxDestroyArray(theZeros2);
    mxDestroyArray(theOnes);
    mxDestroyArray(theRand);
    mxDestroyArray(theLogical);
    mxDestroyArray(i);
    mxDestroyArray(movedUp);
    mxDestroyArray(movedUp2);
    mxDestroyArray(upAndLeftAndRight);
    mxDestroyArray(theTemp);
    mxDestroyArray(ans);
    mxDestroyArray(theLogo);
    mxDestroyArray(theImage);
    mclSetCurrentLocalFunctionTable(save_local_function_table_);
    /*
     * 
     * 
     * 
     */
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -