]> git.mar77i.info Git - bigintmandel/blob - mandel.h
initial commit
[bigintmandel] / mandel.h
1
2 // mandel.h
3
4 #ifndef MANDEL_H
5 #define MANDEL_H
6
7 #include <QPixmap>
8 #include <QPoint>
9 #include <QVector>
10
11 class MandelCell;
12
13 class MandelResultCell {
14 friend class MandelMeta;
15
16 size_t iter;
17 QPointF rpos;
18 public:
19 MandelResultCell();
20 MandelResultCell(size_t iter, QPointF rpos);
21 };
22
23 class MandelMeta {
24 size_t max_iter;
25 QImage img;
26 QVector<MandelCell> cells;
27 QPointF center_f;
28 qreal one, four, scale;
29
30 public:
31 MandelMeta(size_t max_iter, QSize size);
32 const size_t get_max_iter() const { return max_iter; }
33 const QPixmap get_pixmap() const { return QPixmap::fromImage(img); }
34 const int get_width() const { return img.width(); }
35 const int get_height() const { return img.height(); }
36 const QSize get_size() const { return img.size(); }
37 const QVector<MandelCell> get_cells() const { return cells; }
38 const QPointF get_center_f() const { return center_f; }
39 const qreal get_four() const { return four; }
40 const qreal get_scale() const { return scale; }
41
42 void zoom2x(QPoint pos);
43 void finished_cell(int num, const MandelResultCell &cell);
44 static MandelResultCell iterate(const MandelCell &cell);
45 };
46
47 class MandelCell {
48 MandelMeta *meta;
49 QPoint pos;
50 size_t iter;
51 QPointF rpos, rpos0;
52
53 protected:
54 void reset_rpos0();
55
56 public:
57 MandelCell(MandelMeta *meta);
58 MandelCell(const MandelCell &cell);
59 inline const size_t get_iter() const { return iter; }
60 inline const QPointF get_rpos0() const { return rpos0; }
61
62 QPoint update_result(size_t iter, const QPointF &rpos);
63 void reset_iter_and_rpos();
64 void set_meta(MandelMeta *meta);
65 void set_pos(const QPoint pos);
66 MandelResultCell iterate() const;
67 };
68
69 #endif // MANDEL_H