Skip to content

Commit

Permalink
Support 3 digit-range configs maybe more later
Browse files Browse the repository at this point in the history
  • Loading branch information
ckormanyos committed Sep 7, 2024
1 parent 54bde99 commit dda8e7c
Show file tree
Hide file tree
Showing 3 changed files with 319 additions and 76 deletions.
61 changes: 52 additions & 9 deletions MandelbrotDiscovery/mandelbrot_discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,69 @@ template<const unsigned Digits10> auto center_y() -> typename local::cfg_type<Di
template<const unsigned Digits10>
using rectangle_from_digits_type = geometry::rectangle_type<typename geometry::point_type<typename local::cfg_type<Digits10>::mandelbrot_coord_pnt_type>>;

constexpr inline auto default_digits10() -> unsigned { return 132U; }
constexpr inline auto default_00_digits10() -> unsigned { return unsigned { UINT32_C( 44) }; } // For magnification <= 20
constexpr inline auto default_01_digits10() -> unsigned { return unsigned { UINT32_C(104) }; } // For magnification <= 80
constexpr inline auto default_02_digits10() -> unsigned { return unsigned { UINT32_C(536) }; } // For magnification <= 512

using rectangle_00_type = rectangle_from_digits_type<default_00_digits10()>;
using rectangle_01_type = rectangle_from_digits_type<default_01_digits10()>;
using rectangle_02_type = rectangle_from_digits_type<default_02_digits10()>;

using rectangle_tuple_type = std::tuple<rectangle_00_type&, rectangle_01_type&, rectangle_02_type&>;

using rectangle_tuple_type = std::tuple<rectangle_from_digits_type<default_digits10()>&>;
using rectangle_ref_00_type = typename std::tuple_element<0, rectangle_tuple_type>::type;
using rectangle_00_type = typename std::remove_reference<rectangle_ref_00_type>::type;
using point_type = typename rectangle_00_type::point_type;
using rectangle_ref_01_type = typename std::tuple_element<1, rectangle_tuple_type>::type;
using rectangle_ref_02_type = typename std::tuple_element<2, rectangle_tuple_type>::type;

using point_00_type = typename rectangle_00_type::point_type;
using point_01_type = typename rectangle_01_type::point_type;
using point_02_type = typename rectangle_02_type::point_type;

using local_window_type = mandelbrot_discovery<static_cast<int>(INT16_C(800)),
static_cast<int>(INT16_C(800)),
rectangle_tuple_type,
mandelbrot_discovery_detail::WindowTitleDefault,
IDI_MANDELBROT_DISCO>;

auto rectangle() -> rectangle_00_type&
auto rectangle_00() -> rectangle_00_type&
{
static rectangle_00_type my_rect
{
point_type { center_x<default_digits10()>(), center_y<default_digits10()>() },
dx_half<default_digits10()>(),
dy_half<default_digits10()>()
point_00_type { center_x<default_00_digits10()>(), center_y<default_00_digits10()>() },
dx_half<default_00_digits10()>(),
dy_half<default_00_digits10()>()
};

static const bool result_pixel_assoc_is_ok { my_rect.set_pixel_assoc(768, 768) };

static_cast<void>(result_pixel_assoc_is_ok);

return my_rect;
}

auto rectangle_01() -> rectangle_01_type&
{
static rectangle_01_type my_rect
{
point_01_type { center_x<default_01_digits10()>(), center_y<default_01_digits10()>() },
dx_half<default_01_digits10()>(),
dy_half<default_01_digits10()>()
};

static const bool result_pixel_assoc_is_ok { my_rect.set_pixel_assoc(768, 768) };

static_cast<void>(result_pixel_assoc_is_ok);

return my_rect;
}

auto rectangle_02() -> rectangle_02_type&
{
static rectangle_02_type my_rect
{
point_02_type { center_x<default_02_digits10()>(), center_y<default_02_digits10()>() },
dx_half<default_02_digits10()>(),
dy_half<default_02_digits10()>()
};

static const bool result_pixel_assoc_is_ok { my_rect.set_pixel_assoc(768, 768) };
Expand All @@ -76,7 +119,7 @@ auto rectangle() -> rectangle_00_type&

auto WINAPI WinMain(_In_ ::HINSTANCE h_wnd, _In_opt_ ::HINSTANCE, _In_ LPSTR, _In_ int) -> int
{
rectangle_tuple_type rectangle_tuple(rectangle());
rectangle_tuple_type rectangle_tuple(rectangle_00(), rectangle_01(), rectangle_02());

local_window_type::set_rectangle_tuple(rectangle_tuple);

Expand Down
Loading

0 comments on commit dda8e7c

Please sign in to comment.