#pragma once #include #include "./mpreal.h" #include #include namespace Util { class rgb { public: uint8_t r; uint8_t g; uint8_t b; rgb(uint8_t r, uint8_t g, uint8_t b); }; class Vec2i { public: int x; int y; Vec2i(int x, int y); }; class Vec2f { public: float x; float y; Vec2f(float x, float y); }; class Vec2d { public: double x; double y; Vec2d(double x, double y); }; //class BigFloat { //public: // uint32_t precision; // mpfr_t val; // // BigFloat(uint32_t prec); // ~BigFloat(); // static BigFloat BigFloat_d(double d, uint32_t prec); // static BigFloat abs(const BigFloat &bf); // void setValue(double val); // std::string to_str() const; // BigFloat operator / (const BigFloat &f); // // inline BigFloat operator - (const BigFloat &f) const // { // BigFloat res = BigFloat(f.precision); // mpfr_sub(res.val, this->val, f.val, MPFR_RNDD); // // return res; // } // // inline BigFloat operator - (const double d) const // { // // BigFloat bd = BigFloat(this->precision); // // bd.setValue(d); // BigFloat res = BigFloat(this->precision); // mpfr_sub_d(res.val, this->val, d, MPFR_RNDD); // // return res; // } // // inline BigFloat operator * (const BigFloat &f) const // { // BigFloat res = BigFloat(f.precision); // mpfr_mul(res.val, this->val, f.val, MPFR_RNDD); // // return res; // } // // inline BigFloat operator * (const double d) const // { // // BigFloat bd = BigFloat(this->precision); // // bd.setValue(d); // BigFloat res = BigFloat(this->precision); // mpfr_mul_d(res.val, this->val, d, MPFR_RNDD); // // return res; // } // // inline BigFloat operator + (const BigFloat &f) const // { // BigFloat res = BigFloat(f.precision); // mpfr_add(res.val, this->val, f.val, MPFR_RNDD); // // return res; // } // // inline BigFloat operator + (const double d) const // { // // BigFloat bd = BigFloat(this->precision); // // bd.setValue(d); // BigFloat res = BigFloat(this->precision); // mpfr_add_d(res.val, this->val, d, MPFR_RNDD); // // return res; // } // // bool operator < (const BigFloat &f) // { // if (mpfr_cmp(this->val, f.val) < 0) // return true; // return false; // } // // bool operator > (const BigFloat &f) // { // if (mpfr_cmp(this->val, f.val) > 0) // return true; // return false; // } // // bool operator <= (const BigFloat &f) // { // int v = mpfr_cmp(this->val, f.val); // // if (v < 0 || v == 0) // return true; // return false; // } // // bool operator >= (const BigFloat &f) // { // int v = mpfr_cmp(this->val, f.val); // // if (v > 0 || v == 0) // return true; // return false; // } // // bool operator < (const double d) // { // if (mpfr_cmp_d(this->val, d) < 0) // return true; // return false; // } // // bool operator > (const double d) // { // if (mpfr_cmp_d(this->val, d) > 0) // return true; // return false; // } // // bool operator <= (const double d) // { // int v = mpfr_cmp_d(this->val, d); // // //std::cout << "comp: " << v << std::endl; // // if (v < 0 || v == 0) // return true; // return false; // } // // bool operator >= (const double d) // { // int v = mpfr_cmp_d(this->val, d); // // if (v > 0 || v == 0) // return true; // return false; // } //}; void init(uint32_t prec); class Vec2mp { public: mpfr::mpreal x; mpfr::mpreal y; Vec2mp(mpfr::mpreal x, mpfr::mpreal y); Vec2mp(double x, double y); }; }