mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-22 05:30:06 -05:00
Fixed Hypertile, Hypertile1 and Hypertile2
This commit is contained in:
parent
f852f935a5
commit
4bc428eee2
@ -3084,16 +3084,12 @@ public:
|
|||||||
|
|
||||||
virtual void Precalc() override
|
virtual void Precalc() override
|
||||||
{
|
{
|
||||||
T pa = 2 * T(M_PI) / Zeps(m_P);
|
T pa = T(M_2PI) / Zeps(m_P);
|
||||||
T qa = 2 * T(M_PI) / Zeps(m_Q);
|
T cs = std::cos(pa);
|
||||||
T r = (1 - std::cos(pa)) / (std::cos(pa) + std::cos(qa)) + 1;
|
T r2 = (T(1) - cs) / (cs + cos(M_2PI / Zeps(m_Q))) + 1;
|
||||||
|
T r = (r2 > 0) ? T(1) / sqrt(r2) : T(1);
|
||||||
T a = m_N * pa;
|
T a = m_N * pa;
|
||||||
|
|
||||||
if (r > 0)
|
|
||||||
r = 1 / std::sqrt(r);
|
|
||||||
else
|
|
||||||
r = 1;
|
|
||||||
|
|
||||||
m_Real = r * std::cos(a);
|
m_Real = r * std::cos(a);
|
||||||
m_Imag = r * std::sin(a);
|
m_Imag = r * std::sin(a);
|
||||||
}
|
}
|
||||||
@ -3103,9 +3099,9 @@ protected:
|
|||||||
{
|
{
|
||||||
string prefix = Prefix();
|
string prefix = Prefix();
|
||||||
m_Params.clear();
|
m_Params.clear();
|
||||||
m_Params.push_back(ParamWithName<T>(&m_P, prefix + "hypertile_p", 3, eParamType::INTEGER, 3, T(0x7fffffff)));
|
m_Params.push_back(ParamWithName<T>(&m_P, prefix + "hypertile_p", T(3)));
|
||||||
m_Params.push_back(ParamWithName<T>(&m_Q, prefix + "hypertile_q", 7, eParamType::INTEGER, 3, T(0x7fffffff)));
|
m_Params.push_back(ParamWithName<T>(&m_Q, prefix + "hypertile_q", T(7)));
|
||||||
m_Params.push_back(ParamWithName<T>(&m_N, prefix + "hypertile_n", 0, eParamType::INTEGER));
|
m_Params.push_back(ParamWithName<T>(&m_N, prefix + "hypertile_n", T(0)));
|
||||||
m_Params.push_back(ParamWithName<T>(true, &m_Real, prefix + "hypertile_real"));//Precalc.
|
m_Params.push_back(ParamWithName<T>(true, &m_Real, prefix + "hypertile_real"));//Precalc.
|
||||||
m_Params.push_back(ParamWithName<T>(true, &m_Imag, prefix + "hypertile_imag"));
|
m_Params.push_back(ParamWithName<T>(true, &m_Imag, prefix + "hypertile_imag"));
|
||||||
}
|
}
|
||||||
@ -3134,7 +3130,7 @@ public:
|
|||||||
|
|
||||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||||
{
|
{
|
||||||
T temp = rand.Rand() * m_Pa;
|
T temp = Floor<T>(rand.Frand01<T>() * m_IP) * m_Pa;
|
||||||
T sina = std::sin(temp);
|
T sina = std::sin(temp);
|
||||||
T cosa = std::cos(temp);
|
T cosa = std::cos(temp);
|
||||||
T re = m_R * cosa;
|
T re = m_R * cosa;
|
||||||
@ -3160,8 +3156,9 @@ public:
|
|||||||
string q = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string q = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string pa = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string pa = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string r = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string r = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
|
string ip = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t temp = MwcNext(mwc) * " << pa << ";\n"
|
<< "\t\treal_t temp = floor(MwcNext01(mwc) * " << ip << ") * " << pa << ";\n"
|
||||||
<< "\t\treal_t sina = sin(temp);\n"
|
<< "\t\treal_t sina = sin(temp);\n"
|
||||||
<< "\t\treal_t cosa = cos(temp);\n"
|
<< "\t\treal_t cosa = cos(temp);\n"
|
||||||
<< "\t\treal_t re = " << r << " * cosa;\n"
|
<< "\t\treal_t re = " << r << " * cosa;\n"
|
||||||
@ -3181,15 +3178,11 @@ public:
|
|||||||
|
|
||||||
virtual void Precalc() override
|
virtual void Precalc() override
|
||||||
{
|
{
|
||||||
T r2 = 1 - (std::cos(2 * T(M_PI) / Zeps(m_P)) - 1) /
|
m_Pa = T(M_2PI) / Zeps(m_P);
|
||||||
(std::cos(2 * T(M_PI) / Zeps(m_P)) + std::cos(2 * T(M_PI) / Zeps(m_Q)));
|
T cs = cos(m_Pa);
|
||||||
|
T r2 = T(1) - (cs - 1) / (cs + cos(M_2PI / Zeps(m_Q)));
|
||||||
if (r2 > 0)
|
m_R = (r2 > 0) ? T(1) / sqrt(r2) : T(1);
|
||||||
m_R = 1 / std::sqrt(r2);
|
m_IP = (int) m_P;
|
||||||
else
|
|
||||||
m_R = 1;
|
|
||||||
|
|
||||||
m_Pa = 2 * T(M_PI) / Zeps(m_P);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -3197,10 +3190,11 @@ protected:
|
|||||||
{
|
{
|
||||||
string prefix = Prefix();
|
string prefix = Prefix();
|
||||||
m_Params.clear();
|
m_Params.clear();
|
||||||
m_Params.push_back(ParamWithName<T>(&m_P, prefix + "hypertile1_p", 3, eParamType::INTEGER, 3, T(0x7fffffff)));
|
m_Params.push_back(ParamWithName<T>(&m_P, prefix + "hypertile1_p", T(3)));
|
||||||
m_Params.push_back(ParamWithName<T>(&m_Q, prefix + "hypertile1_q", 7, eParamType::INTEGER, 3, T(0x7fffffff)));
|
m_Params.push_back(ParamWithName<T>(&m_Q, prefix + "hypertile1_q", T(7)));
|
||||||
m_Params.push_back(ParamWithName<T>(true, &m_Pa, prefix + "hypertile1_pa"));//Precalc.
|
m_Params.push_back(ParamWithName<T>(true, &m_Pa, prefix + "hypertile1_pa"));//Precalc.
|
||||||
m_Params.push_back(ParamWithName<T>(true, &m_R, prefix + "hypertile1_r"));
|
m_Params.push_back(ParamWithName<T>(true, &m_R, prefix + "hypertile1_r"));
|
||||||
|
m_Params.push_back(ParamWithName<T>(true, &m_IP, prefix + "hypertile1_ip"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -3208,6 +3202,7 @@ private:
|
|||||||
T m_Q;
|
T m_Q;
|
||||||
T m_Pa;//Precalc.
|
T m_Pa;//Precalc.
|
||||||
T m_R;
|
T m_R;
|
||||||
|
T m_IP;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -3233,7 +3228,7 @@ public:
|
|||||||
T x = (a * c + b * d);
|
T x = (a * c + b * d);
|
||||||
T y = (b * c - a * d);
|
T y = (b * c - a * d);
|
||||||
T vr = m_Weight / (SQR(c) + SQR(d));
|
T vr = m_Weight / (SQR(c) + SQR(d));
|
||||||
T temp = rand.Rand() * m_Pa;
|
T temp = Floor<T>(rand.Frand01<T>() * 32767) * m_Pa;
|
||||||
T sina = std::sin(temp);
|
T sina = std::sin(temp);
|
||||||
T cosa = std::cos(temp);
|
T cosa = std::cos(temp);
|
||||||
helper.Out.x = vr * (x * cosa + y * sina);
|
helper.Out.x = vr * (x * cosa + y * sina);
|
||||||
@ -3260,7 +3255,7 @@ public:
|
|||||||
<< "\t\treal_t x = fma(a, c, b * d);\n"
|
<< "\t\treal_t x = fma(a, c, b * d);\n"
|
||||||
<< "\t\treal_t y = fma(b, c, -(a * d));\n"
|
<< "\t\treal_t y = fma(b, c, -(a * d));\n"
|
||||||
<< "\t\treal_t vr = " << weight << " / fma(c, c, SQR(d));\n"
|
<< "\t\treal_t vr = " << weight << " / fma(c, c, SQR(d));\n"
|
||||||
<< "\t\treal_t temp = MwcNext(mwc) * " << pa << ";\n"
|
<< "\t\treal_t temp = floor(MwcNext01(mwc) * 32767) * " << pa << ";\n"
|
||||||
<< "\t\treal_t sina = sin(temp);\n"
|
<< "\t\treal_t sina = sin(temp);\n"
|
||||||
<< "\t\treal_t cosa = cos(temp);\n"
|
<< "\t\treal_t cosa = cos(temp);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -3273,15 +3268,10 @@ public:
|
|||||||
|
|
||||||
virtual void Precalc() override
|
virtual void Precalc() override
|
||||||
{
|
{
|
||||||
T r2 = 1 - (std::cos(2 * T(M_PI) / Zeps(m_P)) - 1) /
|
m_Pa = T(M_2PI) / Zeps(m_P);
|
||||||
(std::cos(2 * T(M_PI) / Zeps(m_P)) + std::cos(2 * T(M_PI) / Zeps(m_Q)));
|
T cs = cos(m_Pa);
|
||||||
|
T r2 = T(1) - (cs - T(1)) / (cs + cos(T(M_2PI) / Zeps(m_Q)));
|
||||||
if (r2 > 0)
|
m_R = (r2 > 0) ? T(1) / sqrt(r2) : T(1);
|
||||||
m_R = 1 / std::sqrt(r2);
|
|
||||||
else
|
|
||||||
m_R = 1;
|
|
||||||
|
|
||||||
m_Pa = 2 * T(M_PI) / Zeps(m_P);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -3289,8 +3279,8 @@ protected:
|
|||||||
{
|
{
|
||||||
string prefix = Prefix();
|
string prefix = Prefix();
|
||||||
m_Params.clear();
|
m_Params.clear();
|
||||||
m_Params.push_back(ParamWithName<T>(&m_P, prefix + "hypertile2_p", 3, eParamType::INTEGER, 3, T(0x7fffffff)));
|
m_Params.push_back(ParamWithName<T>(&m_P, prefix + "hypertile2_p", T(3)));
|
||||||
m_Params.push_back(ParamWithName<T>(&m_Q, prefix + "hypertile2_q", 7, eParamType::INTEGER, 3, T(0x7fffffff)));
|
m_Params.push_back(ParamWithName<T>(&m_Q, prefix + "hypertile2_q", T(7)));
|
||||||
m_Params.push_back(ParamWithName<T>(true, &m_Pa, prefix + "hypertile2_pa"));//Precalc.
|
m_Params.push_back(ParamWithName<T>(true, &m_Pa, prefix + "hypertile2_pa"));//Precalc.
|
||||||
m_Params.push_back(ParamWithName<T>(true, &m_R, prefix + "hypertile2_r"));
|
m_Params.push_back(ParamWithName<T>(true, &m_R, prefix + "hypertile2_r"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user