MandelUtil.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef MANDEL_MANDELUTIL_H
  2. #define MANDEL_MANDELUTIL_H
  3. namespace mnd
  4. {
  5. struct MandelViewport;
  6. struct MandelInfo;
  7. }
  8. struct mnd::MandelViewport
  9. {
  10. /// real part of the top left corner
  11. double x = -2.1;
  12. /// imaginary part of the top left corner
  13. double y = -1.5;
  14. /// real-part span of the picture to be generated
  15. double width = 3;
  16. /// imaginary-part span of the picture to be generated
  17. double height = 3;
  18. /*!
  19. * \brief adjusts the aspect ratio of the viewport, making sure
  20. * the updated viewport contains all of the original one.
  21. */
  22. void adjustAspectRatio(double nwidth, double nheight);
  23. /*!
  24. * \brief make sure width and height are positive
  25. */
  26. void normalize(void);
  27. /*!
  28. * \brief zoom in around the center by a factor specified
  29. */
  30. void zoomCenter(float scale);
  31. /*!
  32. * \brief returns a viewport where the whole mandelbrot set can be observed
  33. */
  34. static MandelViewport standardView(void);
  35. };
  36. struct mnd::MandelInfo
  37. {
  38. /// viewport
  39. MandelViewport view;
  40. /// width of the bitmap to be generated
  41. long bWidth;
  42. /// height of the bitmap to be generated
  43. long bHeight;
  44. /// maximum iterations
  45. int maxIter;
  46. };
  47. #endif // MANDEL_MANDELUTIL_H