25 #include <QMutexLocker>
26 #include <QtCore/QtDebug>
37 template<MandelImpl Impl>
113 static const float S = 4.f;
130 : m_real(r), m_imag(i),
131 m_real2(r * r), m_imag2(i * i)
135 MyComplex squaredPlus(
T r,
T i)
const
138 m_real2 + r - m_imag2,
139 (m_real + m_real) * m_imag + i
145 return m_real2 + m_imag2;
155 template<
typename T>
inline MyComplex<T>
P(MyComplex<T> z,
T c_real,
T c_imag)
157 return z.squaredPlus(c_real, c_imag);
162 float y0,
float scale,
int maxIt)
164 typedef MyComplex<float_v>
Z;
165 const unsigned int height = image.height();
166 const unsigned int width = image.width();
167 const float_v colorScale = 0xff /
static_cast<float>(maxIt);
168 for (
unsigned int y = 0;
y < height; ++
y) {
169 unsigned int *
VC_RESTRICT line =
reinterpret_cast<unsigned int *
>(image.scanLine(
y));
170 const float_v c_imag = y0 +
y * scale;
174 const float_v c_real = x0 +
x * scale;
178 while (!(inside && n < maxIt).isEmpty()) {
179 z =
P(z, c_real, c_imag);
181 inside = z.norm() <
S;
183 uint_v colorValue =
static_cast<uint_v>((maxIt -
n) * colorScale) * 0x10101;
184 if (toStore.isFull()) {
199 float y0,
float scale,
int maxIt)
201 typedef MyComplex<float>
Z;
202 const int height = image.height();
203 const int width = image.width();
204 const float colorScale = 0xff /
static_cast<float>(maxIt);
205 for (
int y = 0;
y < height; ++
y) {
206 unsigned int *
VC_RESTRICT line =
reinterpret_cast<unsigned int *
>(image.scanLine(
y));
207 const float c_imag = y0 +
y * scale;
208 for (
int x = 0;
x < width; ++
x) {
209 const float c_real = x0 +
x * scale;
212 for (; z.norm() <
S && n < maxIt; ++
n) {
213 z =
P(z, c_real, c_imag);
215 *line++ =
static_cast<unsigned int>((maxIt -
n) * colorScale) * 0x10101;
ClassImp(TIterator) Bool_t TIterator return false
Compare two iterator objects.
virtual void mandelMe(QImage &image, float x, float y, float scale, int maxIterations)=0
unsigned long long Cycles() const
MandelBase(QObject *_parent=0)
MyComplex< T > P(MyComplex< T > z, T c_real, T c_imag)
[MyComplex]
Vector< unsigned int > uint_v
void brot(const QSize &size, float x, float y, float scale)
std::complex< float_v > Z
double norm(double *x, double *p)
Mandel(QObject *_parent=0)
void ready(const QImage &image, quint64 cycles)
void mandelMe(QImage &image, float x, float y, float scale, int maxIterations)
const char Int_t const char * image