1. Список говнокодов пользователя Abbath

    Всего: 51

  2. Куча / Говнокод #15822

    +122

    1. 1
    }:;(1,5#3)<@}."_1'--T:: ',.~":,.10000+<.6!:0''

    Даты. Теперь на J.

    Abbath, 22 Апреля 2014

    Комментарии (2)
  3. Assembler / Говнокод #15608

    +137

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    ascdec proc near
    mov di,0
    mov si,0
    xor dx,dx
    mov bx,offset buf
    add bx,10
    mov cx,11
    lo0:
    dec bx
    dec cx
    jcxz ex0
    mov al,[bx]
    cmp al,255
    je lo0
    lo1:
    sub al,30h 
    push bx
    push cx
    mov bx,offset deci
    xor dx,dx
    mov cx,word ptr[bx+2]
    mov bx,word ptr[bx]
    mov ah,0
    call mult32 
    add di,ax
    adc si,dx
    mov bx,offset deci
    mov ax,[bx]
    mov dx,[bx+2]
    call multen
    mov bx,offset deci
    mov [bx],ax
    mov [bx+2],dx
    pop cx
    pop bx
    dec bx
    dec cx
    jcxz ex0
    mov al,[bx]
    jmp lo1
    ex0:
    mov ax,di
    mov dx,si
    test dx,8000h
    jz enda
    jmp error
    enda:
    cmp minus,2dh
    jne pl1
    call ccc
    pl1:
    ret
    ascdec endp
    multen proc near
    push bx
    push cx
    mov bx,10
    mov cx,0
    call mult32
    pop cx
    pop bx
    ret
    multen endp
    mult32 proc near 
    push si
    push di
    push dx
    push ax
    test dx,8000h 
    jz ml
    call ucc
    push dx
    push ax
    ml:
    mov dx,cx
    mov ax,bx
    test dx,8000h  
    jz ml0
    call ucc 
    mov bx,ax
    mov cx,dx
    ml0:
    pop ax
    pop dx
    mov si,0
    mov di,0
    mul bx ;AX*BX
    mov di,ax
    mov si,dx
    pop ax
    mul cx ;AX*CX
    add si,ax
    pop dx
    ucc proc near
    dec ax
    sbb dx,0
    not ax
    not dx
    ret
    ucc endp

    Превращение строки в число.

    Abbath, 27 Марта 2014

    Комментарии (22)
  4. Куча / Говнокод #15377

    +126

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    check =: 3 : 0
    a=.>;:y
    b=.|:(6,#y) $,'(){}[]'=/a
    b=.(-1 3 5{"(1)b) (1 3 5)}"(1) b
    c=.|:(3 2$i.6)([:+/[{[:|:])"(1 _) b
    no=._1
    n=.#c
    p=. 13 : 'I.*./"(1)(1 _1)="(1)(2+\(x{y))'
    while. n~:no do.
    no=.n
    cc =. |:c
    d=.~.(0 p cc),(1 p cc),(2 p cc)
    c=.((i.#c)-.(d,>:d)){c
    n=.#c
    end.
    n=0
    )
    
    samples =: '({[{}]{}[]})';'({}}{[{}]{}[]})';'({[{}]{}[]}';'({[{}]{}]})';'({[{}{}[]})';'';'{}'
    
    test =: 13 : 'check >y{samples'
    
    test"(0) i.7

    По мотивам http://govnokod.ru/15363

    Abbath, 06 Марта 2014

    Комментарии (3)
  5. Куча / Говнокод #15256

    +86

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    load 'regex'
    f=: 13 : '((+./-.(1 2 3 4{y))+.(0{y))*.(5{y)'
    a =: #:i.2^6
    b =: f"(1) a
    cc =: ":|:(|:a),(|:b)
    cc1 =: (32+i.32){cc
    cc2 =: (i.32){cc
    ccc=:|:(|:cc2),(1 32$'*'),(|:cc1)
    ccc=:('\*';'&&') rxrplc"1 (ccc)
    (,&'\\ \hline')"1 (' ';' & ')rxrplc"1 (ccc)

    Вот он, первый говнокод на J

    Abbath, 28 Февраля 2014

    Комментарии (45)
  6. Куча / Говнокод #15222

    +134

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    load 'regex'
    f=: 13 : '((+./-.(1 2 3 4{y))+.(0{y))*.(5{y)'
    a =: #:i.2^6
    b =: f"(1) a
    cc =: ":|:(|:a),(|:b)
    cc1 =: (32+i.32){cc
    cc2 =: (i.32){cc
    ccc=:|:(|:cc2),(1 32$'*'),(|:cc1)
    ccc=:('\*';'&&') rxrplc"1 (ccc)
    (,&'\\ \hline')"1 (' ';' & ')rxrplc"1 (ccc)

    Вот он, первый говнокод на J

    Abbath, 27 Февраля 2014

    Комментарии (0)
  7. C++ / Говнокод #14968

    +46

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    //В хедере
        QVector<double> stateStack;
    //Сохраняем
        stateStack.push_back((double)renderInclusionsAs3DMeshSpheres);
        stateStack.push_back((double)transparencyForClosestSidePolies);
        stateStack.push_back((double)renderFEMGrid);
        stateStack.push_back((double)NEST_results_detail_per_unit);
        stateStack.push_back((double)sourceLineActive);
        stateStack.push_back((double)renderScale);
        stateStack.push_back((double)c2DZoom1To1);
        stateStack.push_back((double)render2DInclusions);
        stateStack.push_back((double)render3DInclusions);
        stateStack.push_back((double)renderNESTResults);
        stateStack.push_back((double)renderFEAResults);
        stateStack.push_back((double)NEST_anumTime);
        stateStack.push_back((double)isAnimRun);
        stateStack.push_back((double)NEST_timeIterToRender);
        stateStack.push_back((double)NEST_RenderResultsIn3D);
        stateStack.push_back((double)NEST_renderTestPoints);
        stateStack.push_back((double)nestNewResults);
        stateStack.push_back((double)fibers_renderFormedRegions);
        stateStack.push_back((double)sourceLineStarted);
        stateStack.push_back((double)renderSourceLine);
        stateStack.push_back((double)heatQuadsModifyMode);
        stateStack.push_back((double)renderTopHeats);
        stateStack.push_back((double)sliceModifyMode);
        stateStack.push_back((double)useSlicePlane);
        stateStack.push_back((double)showSlicedPart);
        stateStack.push_back((double)cRenderMenuOpended);
        stateStack.push_back((double)cForbidRenderResultsOverLayers);
        stateStack.push_back((double)renderCoordLines);
        stateStack.push_back((double)renderDimensions);
        stateStack.push_back((double)renderLimits);
        stateStack.push_back((double)cResTransparency);
        stateStack.push_back((double)cRenderResultsOverLayers);
        stateStack.push_back((double)cActiveLayer);
        stateStack.push_back((double)renderMiniMapAtTop);
        stateStack.push_back((double)subCompositeMode);
        stateStack.push_back((double)subCompositeMapRendering);
        stateStack.push_back((double)fibersRenderable);
        stateStack.push_back((double)renderFibersAsMesh);
        stateStack.push_back((double)droplets_detailedSpheres);
        stateStack.push_back((double)cViewType);
    //Загружаем
     renderInclusionsAs3DMeshSpheres   =(bool)stateStack[0];
        transparencyForClosestSidePolies=        stateStack[1];
        renderFEMGrid=(bool)                     stateStack[2];
        NEST_results_detail_per_unit=            stateStack[3];
        sourceLineActive=(bool)                  stateStack[4];
        renderScale=(bool)                       stateStack[5];
        c2DZoom1To1=(bool)                       stateStack[6];
        render2DInclusions=(bool)                stateStack[7];
        render3DInclusions=(bool)                stateStack[8];
        renderNESTResults=(bool)                 stateStack[9];
        renderFEAResults=(bool)                  stateStack[10];
        NEST_anumTime=                           stateStack[11];
        isAnimRun=(bool)                         stateStack[12];
        NEST_timeIterToRender=                   stateStack[13];
        NEST_RenderResultsIn3D=(bool)            stateStack[14];
        NEST_renderTestPoints=(bool)             stateStack[15];
        nestNewResults=(bool)                    stateStack[16];
        fibers_renderFormedRegions=(bool)        stateStack[17];
        sourceLineStarted=(bool)                 stateStack[18];
        renderSourceLine=(bool)                  stateStack[19];
        heatQuadsModifyMode=(bool)               stateStack[20];
        renderTopHeats=(bool)                    stateStack[21];
        sliceModifyMode=(bool)                   stateStack[22];
        useSlicePlane=(bool)                     stateStack[23];
        showSlicedPart=(bool)                    stateStack[24];
        cRenderMenuOpended=(bool)                stateStack[25];
        cForbidRenderResultsOverLayers=(bool)    stateStack[26];
        renderCoordLines=                        stateStack[27];
        renderDimensions=(bool)                  stateStack[28];
        renderLimits=                            stateStack[29];
        cResTransparency=                        stateStack[30];
        cRenderResultsOverLayers=(bool)          stateStack[31];
        cActiveLayer=                            stateStack[32];
        renderMiniMapAtTop       =(bool)         stateStack[33];
        subCompositeMode         =(bool)         stateStack[34];
        subCompositeMapRendering =(bool)         stateStack[35];
        fibersRenderable=(bool)                  stateStack[36];
        renderFibersAsMesh=(bool)                stateStack[37];
        droplets_detailedSpheres=                stateStack[38];
        cViewType=                               stateStack[39];

    Структуры для педиков.

    Abbath, 25 Февраля 2014

    Комментарии (18)
  8. C++ / Говнокод #14949

    +37

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    long* Service::qByteToLongArray(QByteArray qba, long r)
    {
        long* larr = new long[r];
    
        char *carr;
        carr = (char*)larr;
    
        int len = r * sizeof(long);//length in bytes
    
        for(int i=0; i < len; i++)
            carr[i] = qba.at(i);
    
        return larr;
    }
    
    QByteArray Service::longToQByteArray(long **larr2, long r, long c)
    {
        QByteArray qba;// = new QByteArray();
    
        char **carr2;
        carr2 = (char**)larr2;
    
        int rlen = c * sizeof(long);//length of row in bytes
    
        for(int i=0; i < r; i++){
            qba.append(carr2[i], rlen);//add next row of matrix to the QByteArray
        }
    
        return qba;
    }

    Нашли это, только когда собрали под x64.

    Abbath, 25 Февраля 2014

    Комментарии (16)
  9. C++ / Говнокод #14536

    +55

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    #include <iostream>
    #include <thread>
    #include <cmath>
    #include <cstdlib>
    #include <algorithm>
    #include <iterator>
    #include <future>
    
    constexpr std::size_t array_size = 1e7;
    constexpr std::size_t chunks_number = 1e3;
    
    double local_pi(const std::size_t array_length)
    {
        std::vector<std::pair<double, double>> array_xy;       
        array_xy.reserve(array_length);      
        std::generate_n(std::back_inserter(array_xy), array_length, [](){
          return std::make_pair(rand()/static_cast<double>(RAND_MAX), 
    			    rand()/static_cast<double>(RAND_MAX));
          });
        std::vector<bool> bool_z;
        bool_z.reserve(array_length);
        auto bool_z_insterter = std::back_inserter(bool_z);
        std::for_each(array_xy.cbegin(), array_xy.cend(), [&](const std::pair<double, double>& ref){
          const auto func = [](const std::pair<double, double>& ref){
    	return sqrt(pow(ref.first, 2) + pow(ref.second, 2)) <= 1.0;
          };
          bool_z_insterter = func(ref);
        });
        const auto sum = 4.0 * (std::accumulate(bool_z.cbegin(), bool_z.cend(), 0.0)/array_length);
        return sum;
    }
    int main(){
      const auto concurrency_level = std::thread::hardware_concurrency();
      std::vector< double > chunks_vector;
      chunks_vector.reserve(chunks_number);
      for (std::size_t j = 0; j < chunks_number; ++j) {
        std::vector<std::future<double>> futures;
        futures.reserve(concurrency_level-1);
        for (std::size_t i = 0; i < concurrency_level-1; ++i){
          auto f = std::async(std::launch::async, local_pi, array_size/concurrency_level);
          futures.push_back(std::move(f));
        }
        auto pi = local_pi(array_size/concurrency_level);
        for (auto&& x : futures ){
          pi += x.get();
        }
        pi /= concurrency_level;
        chunks_vector.push_back(pi);
      }
      const auto total_pi = std::accumulate(chunks_vector.cbegin(), chunks_vector.cend(), 0.0)/chunks_vector.size();
      std::cout << "Pi equals = " << std::scientific << total_pi << std::endl;
      return 0;
    }

    Вычисляем pi методом Монте-Карло

    Abbath, 10 Февраля 2014

    Комментарии (63)
  10. C++ / Говнокод #14413

    +11

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    #define EDGE_EDGE_TEST(V0,U0,U1)                      \
    	Bx=U0[i0]-U1[i0];                                   \
    	By=U0[i1]-U1[i1];                                   \
    	Cx=V0[i0]-U0[i0];                                   \
    	Cy=V0[i1]-U0[i1];                                   \
    	f=Ay*Bx-Ax*By;                                      \
    	d=By*Cx-Bx*Cy;                                      \
    	if((f>0 && d>=0 && d<=f) || (f<0 && d<=0 && d>=f))  \
    {                                                   \
    	e=Ax*Cy-Ay*Cx;                                    \
    	if(f>0)                                           \
    {                                                 \
    	if(e>=0 && e<=f) return 1;                      \
    	}                                                 \
    	else                                              \
    {                                                 \
    	if(e<=0 && e>=f) return 1;                      \
    	}                                                 \
    	}
    
    #define POINT_IN_TRI(V0,U0,U1,U2)           \
    {                                           \
    	double a,b,c,d0,d1,d2;                     \
    	/* is T1 completly inside T2? */          \
    	/* check if V0 is inside tri(U0,U1,U2) */ \
    	a=U1[i1]-U0[i1];                          \
    	b=-(U1[i0]-U0[i0]);                       \
    	c=-a*U0[i0]-b*U0[i1];                     \
    	d0=a*V0[i0]+b*V0[i1]+c;                   \
    	\
    	a=U2[i1]-U1[i1];                          \
    	b=-(U2[i0]-U1[i0]);                       \
    	c=-a*U1[i0]-b*U1[i1];                     \
    	d1=a*V0[i0]+b*V0[i1]+c;                   \
    	\
    	a=U0[i1]-U2[i1];                          \
    	b=-(U0[i0]-U2[i0]);                       \
    	c=-a*U2[i0]-b*U2[i1];                     \
    	d2=a*V0[i0]+b*V0[i1]+c;                   \
    	if(d0*d1>0.0)                             \
    {                                         \
    	if(d0*d2>0.0) return 1;                 \
    	}                                         \
    	}
    
    #define NEWCOMPUTE_INTERVALS(VV0,VV1,VV2,D0,D1,D2,D0D1,D0D2,A,B,C,X0,X1) \
    { \
    	if(D0D1>0.0f) \
    { \
    	/* here we know that D0D2<=0.0 */ \
    	/* that is D0, D1 are on the same side, D2 on the other or on the plane */ \
    	A=VV2; B=(VV0-VV2)*D2; C=(VV1-VV2)*D2; X0=D2-D0; X1=D2-D1; \
    	} \
    	else if(D0D2>0.0f)\
    { \
    	/* here we know that d0d1<=0.0 */ \
    	A=VV1; B=(VV0-VV1)*D1; C=(VV2-VV1)*D1; X0=D1-D0; X1=D1-D2; \
    	} \
    	else if(D1*D2>0.0f || D0!=0.0f) \
    { \
    	/* here we know that d0d1<=0.0 or that D0!=0.0 */ \
    	A=VV0; B=(VV1-VV0)*D0; C=(VV2-VV0)*D0; X0=D0-D1; X1=D0-D2; \
    	} \
    	else if(D1!=0.0f) \
    { \
    	A=VV1; B=(VV0-VV1)*D1; C=(VV2-VV1)*D1; X0=D1-D0; X1=D1-D2; \
    	} \
    	else if(D2!=0.0f) \
    { \
    	A=VV2; B=(VV0-VV2)*D2; C=(VV1-VV2)*D2; X0=D2-D0; X1=D2-D1; \
    	} \
    	else \
    { \
    	/* triangles are coplanar */ \
    	return coplanar_tri_tri(N1,V0,V1,V2,U0,U1,U2); \
    	} \
    	}

    Макросы макросики. Inline? Нет, не слышал.

    Abbath, 25 Января 2014

    Комментарии (9)
  11. C++ / Говнокод #14388

    +16

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    QVector<Line> Converter::convert(QImage &image, Modes mode/*, int left, int top, int right, int bottom*/){
        QVector<Line> result;
        /* if(left < 0) left = 0;
        if(top < 0) top = 0;
        //if(right > image.width()) right = image.width();
        //if(bottom > image.height()) bottom = image.height();
        //points.clear();
        //pix.fill(Qt::black);
        if(left > right){
            left ^= right;
            right ^= left;
            left ^= right;
        }
        if(top > bottom){
            top ^= bottom;
            bottom ^= top;
            top ^= bottom;
        }*/
        int left = 0,top = 0,right = image.width(),bottom = image.height();
        for( int i = left; i < right; ++i){
            for( int j = top; j < bottom; ++j){
                Line p;
                p.x1 = p.x2 = i;
                p.y1 = p.y2 = j;
                p.z1 = qGray(image.pixel(i,j));
                p.c = p.z1;
                QVector<int> v;
                if(i!=left) v.push_back(qGray(image.pixel(i-1,j)));
                if(i < right-1) v.push_back(qGray(image.pixel(i+1,j)));
                if(j!=top) v.push_back(qGray(image.pixel(i,j-1)));
                if(j < bottom-1) v.push_back(qGray(image.pixel(i,j+1)));
                if(i!=left && j!= top) v.push_back(qGray(image.pixel(i-1,j-1)));
                if(i < right-1 && j!=top) v.push_back(qGray(image.pixel(i+1,j-1)));
                if(j < bottom-1 && i!=left) v.push_back(qGray(image.pixel(i-1,j+1)));
                if(i < right-1 && j < bottom-1) v.push_back(qGray(image.pixel(i+1,j+1)));
                int min = *(std::min_element(v.begin(),v.end()));
                if(min < qGray(image.pixel(i,j))){
                    /* for( unsigned k = 0; k < p.c-min; ++k){
                        Point p0;
                        p0.x = i;
                        p0.y = j;
                        p0.z = qGray(image.pixel(i,j))-(k+1);
                        p0.c = qGray(image.pixel(i,j));
                        points.push_back(p0);
                    }*/
                    p.z2 = p.z1 - min;
                }else{
                    p.z2 = p.z1;
                }
                result.push_back(p);
            }
        }
        /*origin.x = 0;
        origin.y = 0;
        origin.z = 0.0;*/
        switch (mode) {
        case ISO:
            rotate(result, 3.1415/180*35.2,3.1415/4,-3.1415/4);
            //rotate(result, 0,,0);
            //rotate(result, 0,0,-3.1415/4);
            break;
        case BOTTOM:
            rotate(result, 3.1415/180*90,0,0);
            break;
        case LEFT:
            rotate(result, 3.1415/180*90,0,0);
            rotate(result, 0, 3.1415/180*90,0);
            break;
        case RIGHT:
            rotate(result, 3.1415/180*90,0,0);
            rotate(result, 0, -3.1415/180*90,0);
            break;
        default:
            break;
        }
        return result;
    }

    Картинка превращается, превращается...

    Abbath, 20 Января 2014

    Комментарии (66)