MandelUtil.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef MANDEL_MANDELUTIL_H
  2. #define MANDEL_MANDELUTIL_H
  3. #include "Types.h"
  4. namespace mnd
  5. {
  6. struct MandelViewport;
  7. struct MandelInfo;
  8. }
  9. struct mnd::MandelViewport
  10. {
  11. /// real part of the top left corner
  12. Real x = -2.1;
  13. /// imaginary part of the top left corner
  14. Real y = -1.5;
  15. /// real-part span of the picture to be generated
  16. Real width = 3;
  17. /// imaginary-part span of the picture to be generated
  18. Real height = 3;
  19. /*!
  20. * \brief adjusts the aspect ratio of the viewport, making sure
  21. * the updated viewport contains all of the original one.
  22. */
  23. void adjustAspectRatio(double nwidth, double nheight);
  24. /*!
  25. * \brief make sure width and height are positive
  26. */
  27. void normalize(void);
  28. /*!
  29. * \brief zoom in around the center by a factor specified
  30. */
  31. void zoomCenter(float scale);
  32. /*!
  33. * \brief zoom in around a specific point
  34. * \param x value between 0.0f and 1.0f
  35. * \param y value between 0.0f and 1.0f
  36. */
  37. void zoom(float scale, float x, float y);
  38. /*!
  39. * \brief returns a viewport where the whole mandelbrot set can be observed
  40. */
  41. static MandelViewport standardView(void);
  42. /*!
  43. * \brief returns a viewport with (0, 0) in the center
  44. */
  45. static MandelViewport centerView(void);
  46. inline Real right() const { return x + width; }
  47. inline Real bottom() const { return y + height; }
  48. };
  49. struct mnd::MandelInfo
  50. {
  51. /// viewport
  52. MandelViewport view;
  53. /// width of the bitmap to be generated
  54. long bWidth;
  55. /// height of the bitmap to be generated
  56. long bHeight;
  57. /// maximum iterations
  58. long maxIter;
  59. /// smooth coloring
  60. bool smooth;
  61. Real juliaX;
  62. Real juliaY;
  63. };
  64. #endif // MANDEL_MANDELUTIL_H