123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #ifndef MANDEL_MANDELUTIL_H
- #define MANDEL_MANDELUTIL_H
- #include "Types.h"
- namespace mnd
- {
- struct MandelViewport;
- struct MandelInfo;
- }
- struct mnd::MandelViewport
- {
- /// real part of the top left corner
- Real x = -2.1;
- /// imaginary part of the top left corner
- Real y = -1.5;
- /// real-part span of the picture to be generated
- Real width = 3;
- /// imaginary-part span of the picture to be generated
- Real height = 3;
- /*!
- * \brief adjusts the aspect ratio of the viewport, making sure
- * the updated viewport contains all of the original one.
- */
- void adjustAspectRatio(double nwidth, double nheight);
- /*!
- * \brief make sure width and height are positive
- */
- void normalize(void);
- /*!
- * \brief zoom in around the center by a factor specified
- */
- void zoomCenter(float scale);
- /*!
- * \brief zoom in around a specific point
- * \param x value between 0.0f and 1.0f
- * \param y value between 0.0f and 1.0f
- */
- void zoom(float scale, float x, float y);
- /*!
- * \brief returns a viewport where the whole mandelbrot set can be observed
- */
- static MandelViewport standardView(void);
- /*!
- * \brief returns a viewport with (0, 0) in the center
- */
- static MandelViewport centerView(void);
- inline Real right() const { return x + width; }
- inline Real bottom() const { return y + height; }
- };
- struct mnd::MandelInfo
- {
- /// viewport
- MandelViewport view;
- /// width of the bitmap to be generated
- long bWidth;
- /// height of the bitmap to be generated
- long bHeight;
- /// maximum iterations
- long maxIter;
- /// smooth coloring
- bool smooth;
- Real juliaX;
- Real juliaY;
- };
- #endif // MANDEL_MANDELUTIL_H
|