Skip to content

Commit

Permalink
Merge pull request #158 from ckormanyos/scalable_resolution
Browse files Browse the repository at this point in the history
Fixes #118 via scalable resolution
  • Loading branch information
ckormanyos authored Sep 22, 2024
2 parents 2e7b6f0 + 4392e6b commit dd7ac94
Show file tree
Hide file tree
Showing 14 changed files with 1,799 additions and 60 deletions.
1 change: 1 addition & 0 deletions MandelbrotDiscovery/MandelbrotDiscovery.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="mandelbrot_discovery.cpp" />
<ClCompile Include="mandelbrot_discovery_rescale.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MandelbrotDiscovery.rc" />
Expand Down
3 changes: 3 additions & 0 deletions MandelbrotDiscovery/MandelbrotDiscovery.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<ClCompile Include="mandelbrot_discovery.cpp">
<Filter>MandelbrotDiscovery</Filter>
</ClCompile>
<ClCompile Include="mandelbrot_discovery_rescale.cpp">
<Filter>MandelbrotDiscovery</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="mandelbrot_discovery.h">
Expand Down
21 changes: 18 additions & 3 deletions MandelbrotDiscovery/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,23 @@
value_type my_y { };
};

struct rectangle_base
{
public:
static constexpr auto default_pixels() noexcept -> int { return 768; }

virtual ~rectangle_base() = default;

protected:
rectangle_base() = default;
};

template<typename PointType>
struct rectangle_type
struct rectangle_type : public rectangle_base
{
private:
using base_class_type = rectangle_base;

public:
using point_type = PointType;
using value_type = typename point_type::value_type;
Expand All @@ -48,6 +62,8 @@

rectangle_type() = delete;

~rectangle_type() override = default;

auto operator*=(const int n) -> rectangle_type&
{
static_cast<void>(my_dx_half *= n);
Expand Down Expand Up @@ -91,8 +107,7 @@
auto dx_half() const noexcept -> value_type { return my_dx_half; }
auto dy_half() const noexcept -> value_type { return my_dy_half; }

auto center() const noexcept -> const point_type& { return my_center; }
auto center() noexcept -> point_type& { return my_center; }
auto center() const noexcept -> const point_type { return my_center; }

auto recenter(const point_type& new_center) noexcept -> void
{
Expand Down
32 changes: 20 additions & 12 deletions MandelbrotDiscovery/mandelbrot_discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ 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_00_digits10() -> unsigned { return unsigned { UINT32_C( 44) }; } // For magnification <= 20
constexpr inline auto default_01_digits10() -> unsigned { return unsigned { UINT32_C( 64) }; } // For magnification <= 40
constexpr inline auto default_02_digits10() -> unsigned { return unsigned { UINT32_C( 104) }; } // For magnification <= 80
constexpr inline auto default_03_digits10() -> unsigned { return unsigned { UINT32_C(1560) }; } // For magnification <= 1536 (which we consider unlimited)
constexpr inline auto default_00_digits10() noexcept -> unsigned { return unsigned { UINT32_C( 44) }; } // For magnification <= 20
constexpr inline auto default_01_digits10() noexcept -> unsigned { return unsigned { UINT32_C( 64) }; } // For magnification <= 40
constexpr inline auto default_02_digits10() noexcept -> unsigned { return unsigned { UINT32_C( 104) }; } // For magnification <= 80
constexpr inline auto default_03_digits10() noexcept -> unsigned { return unsigned { UINT32_C(1560) }; } // For magnification <= 1536 (which we consider unlimited)

using rectangle_00_type = rectangle_from_digits_type<default_00_digits10()>;
using rectangle_01_type = rectangle_from_digits_type<default_01_digits10()>;
Expand Down Expand Up @@ -74,9 +74,11 @@ auto rectangle_00() -> rectangle_00_type&
dy_half<default_00_digits10()>()
};

static const bool result_pixel_assoc_is_ok { my_rect.set_pixel_assoc(768, 768) };
{
static const bool result_pixel_assoc_is_ok { my_rect.set_pixel_assoc(geometry::rectangle_base::default_pixels(), geometry::rectangle_base::default_pixels()) };

static_cast<void>(result_pixel_assoc_is_ok);
static_cast<void>(result_pixel_assoc_is_ok);
}

return my_rect;
}
Expand All @@ -90,9 +92,11 @@ auto rectangle_01() -> rectangle_01_type&
dy_half<default_01_digits10()>()
};

static const bool result_pixel_assoc_is_ok { my_rect.set_pixel_assoc(768, 768) };
{
static const bool result_pixel_assoc_is_ok { my_rect.set_pixel_assoc(geometry::rectangle_base::default_pixels(), geometry::rectangle_base::default_pixels()) };

static_cast<void>(result_pixel_assoc_is_ok);
static_cast<void>(result_pixel_assoc_is_ok);
}

return my_rect;
}
Expand All @@ -106,9 +110,11 @@ auto rectangle_02() -> rectangle_02_type&
dy_half<default_02_digits10()>()
};

static const bool result_pixel_assoc_is_ok { my_rect.set_pixel_assoc(768, 768) };
{
static const bool result_pixel_assoc_is_ok { my_rect.set_pixel_assoc(geometry::rectangle_base::default_pixels(), geometry::rectangle_base::default_pixels()) };

static_cast<void>(result_pixel_assoc_is_ok);
static_cast<void>(result_pixel_assoc_is_ok);
}

return my_rect;
}
Expand All @@ -122,9 +128,11 @@ auto rectangle_03() -> rectangle_03_type&
dy_half<default_03_digits10()>()
};

static const bool result_pixel_assoc_is_ok { my_rect.set_pixel_assoc(768, 768) };
{
static const bool result_pixel_assoc_is_ok { my_rect.set_pixel_assoc(geometry::rectangle_base::default_pixels(), geometry::rectangle_base::default_pixels()) };

static_cast<void>(result_pixel_assoc_is_ok);
static_cast<void>(result_pixel_assoc_is_ok);
}

return my_rect;
}
Expand Down
Loading

0 comments on commit dd7ac94

Please sign in to comment.