/** * File: FracBase.hh * Copyright (C) 2025 Tyler Triplett * License: GNU GPL 3.0 or later <https://www.gnu.org/licenses/gpl-3.0.html> * * This is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef FRAC_BASE_HH #define FRAC_BASE_HH #include <pch.hh> #include <generators/BaseGen.hh> #include <generators/Pixel.hh> #include <complex> namespace ty { using Setting = std::pair<std::string, double&>; using Point = std::complex<double>; class FracBase : public BaseGen { protected: /// base consts const double range_ = 1.5; /// this could be anything really const double iterLimit_ = 5000.0; /// base settings double zoomFactor_ = 1.0; double realCenter_ = 0.0; double imagCenter_ = 0.0; double maxIter_ = 1000; /// computed by init double minX_ = 0; double minY_ = 0; double scaleX_ = 0; double scaleY_ = 0; /// regular functions std::pair<double, double> scaleRange() const; Pixel pixelFromIt(const int& it) const; Point pixelTranslation(const int& px, const int& py) const; virtual int computeIteration(const int& px, const int& py) const; virtual Point nextZ(const Point& z, const Point& c) const = 0; virtual std::vector<Setting> getSettings(); public: FracBase(const int& w, const int& h); virtual ~FracBase(); FracBase(const FracBase&) = delete; void init(const json& j) override; std::vector<unsigned char> runGen() override; }; } /// ty #endif /// FRAC_BASE_HH