| 112 | } |
| 113 | |
| 114 | int julia(int x, int y, int width, int height) |
| 115 | { |
| 116 | const float scale = 1.5; |
| 117 | float jx = scale * (float)(width/2.0f - x)/(width/2.0f); |
| 118 | float jy = scale * (float)(height/2.0f - y)/(height/2.0f); |
| 119 | |
| 120 | std::complex<float> c(-0.8f, 0.156f); |
| 121 | std::complex<float> a(jx, jy); |
| 122 | |
| 123 | for (int i=0; i<200; i++) { |
| 124 | a = a * a + c; |
| 125 | if (abs(a) > 1000) |
| 126 | return 0; |
| 127 | } |
| 128 | |
| 129 | return 1; |
| 130 | } |