This commit is contained in:
Person 2019-06-02 09:36:06 -07:00
commit 460dd6254f
2 changed files with 43 additions and 33 deletions

View File

@ -6685,13 +6685,15 @@ 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 sechsin, sechcos, sechsinh, sechcosh, sechden; T sechsin, sechcos, sechsinh, sechcosh, sechden;
sincos(helper.In.y, &sechsin, &sechcos); T x = T(M_PI / 4) * helper.In.x;
sechsinh = std::sinh(helper.In.x); T y = T(M_PI / 4) * helper.In.y;
sechcosh = std::cosh(helper.In.x); sincos(y, &sechsin, &sechcos);
sechden = 2 / Zeps(std::cos(2 * helper.In.y) + std::cosh(2 * helper.In.x)); sechsinh = std::sinh(x);
helper.Out.x = m_Weight * sechden * sechcos * sechcosh; sechcosh = std::cosh(x);
helper.Out.y = -(m_Weight * sechden * sechsin * sechsinh); sechden = 2 / Zeps(std::cos(y * 2) + std::cosh(x * 2));
helper.Out.x = m_Weight * sechden * sechcos * sechcosh;
helper.Out.y = m_Weight * sechden * sechsin * sechsinh;
helper.Out.z = DefaultZ(helper); helper.Out.z = DefaultZ(helper);
} }
@ -6701,14 +6703,16 @@ public:
string weight = WeightDefineString(); string weight = WeightDefineString();
intmax_t varIndex = IndexInXform(); intmax_t varIndex = IndexInXform();
ss << "\t{\n" ss << "\t{\n"
<< "\t\treal_t sechsin = sin(vIn.y);\n" << "\t\treal_t x = MPI / (real_t)(4.0) * vIn.x;\n"
<< "\t\treal_t sechcos = cos(vIn.y);\n" << "\t\treal_t y = MPI / (real_t)(4.0) * vIn.y;\n"
<< "\t\treal_t sechsinh = sinh(vIn.x);\n" << "\t\treal_t sechsin = sin(y);\n"
<< "\t\treal_t sechcosh = cosh(vIn.x);\n" << "\t\treal_t sechcos = cos(y);\n"
<< "\t\treal_t sechden = (real_t)(2.0) / Zeps(cos((real_t)(2.0) * vIn.y) + cosh((real_t)(2.0) * vIn.x));\n" << "\t\treal_t sechsinh = sinh(x);\n"
<< "\t\treal_t sechcosh = cosh(x);\n"
<< "\t\treal_t sechden = (real_t)(2.0) / Zeps(cos(y * (real_t)(2.0)) + cosh(x * (real_t)(2.0)));\n"
<< "\n" << "\n"
<< "\t\tvOut.x = " << weight << " * sechden * sechcos * sechcosh;\n" << "\t\tvOut.x = " << weight << " * sechden * sechcos * sechcosh;\n"
<< "\t\tvOut.y = -(" << weight << " * sechden * sechsin * sechsinh);\n" << "\t\tvOut.y = " << weight << " * sechden * sechsin * sechsinh;\n"
<< "\t\tvOut.z = " << DefaultZCl() << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n"; << "\t}\n";
return ss.str(); return ss.str();

View File

@ -2069,15 +2069,12 @@ public:
{ {
T fx = helper.In.x; T fx = helper.In.x;
T fy = helper.In.y; T fy = helper.In.y;
T fz = helper.In.z; T fz = helper.In.z;
T a0 = T(M_PI) / m_N; T angle = Floor<T>(helper.m_PrecalcAtanyx * m_Coeff) / m_Coeff + m_A0;
T len = 1 / Zeps(std::cos(a0)); T x0 = std::cos(angle) * m_Len;
T d = m_Rad * std::sin(a0) * len; T y0 = std::sin(angle) * m_Len;
T angle = Floor<T>(helper.m_PrecalcAtanyx * m_Coeff) / m_Coeff + T(M_PI) / m_N;
T x0 = std::cos(angle) * len;
T y0 = std::sin(angle) * len;
if (std::sqrt(Sqr(helper.In.x - x0) + Sqr(helper.In.y - y0)) < d) if (std::sqrt(Sqr(helper.In.x - x0) + Sqr(helper.In.y - y0)) < m_D)
{ {
if (m_Zero > 1.5) if (m_Zero > 1.5)
{ {
@ -2096,8 +2093,8 @@ public:
else else
{ {
T rangle = std::atan2(helper.In.y - y0, helper.In.x - x0); T rangle = std::atan2(helper.In.y - y0, helper.In.x - x0);
fx = x0 + std::cos(rangle) * d; fx = x0 + std::cos(rangle) * m_D;
fy = y0 + std::sin(rangle) * d; fy = y0 + std::sin(rangle) * m_D;
fz = 0; fz = 0;
} }
} }
@ -2118,21 +2115,21 @@ public:
string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string rad = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string rad = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string zero = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string zero = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string coeff = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string coeff = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string a0 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string len = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string d = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n" ss << "\t{\n"
<< "\t\treal_t fx = vIn.x;\n" << "\t\treal_t fx = vIn.x;\n"
<< "\t\treal_t fy = vIn.y;\n" << "\t\treal_t fy = vIn.y;\n"
<< "\t\treal_t fz = vIn.z;\n" << "\t\treal_t fz = vIn.z;\n"
<< "\t\treal_t a0 = MPI / " << n << ";\n" << "\t\treal_t angle = floor(precalcAtanyx * " << coeff << ") / " << coeff << " + " << a0 << ";\n"
<< "\t\treal_t len = 1 / Zeps(cos(a0));\n" << "\t\treal_t x0 = cos(angle) * " << len << ";\n"
<< "\t\treal_t d = " << rad << " * sin(a0) * len;\n" << "\t\treal_t y0 = sin(angle) * " << len << ";\n"
<< "\t\treal_t angle = floor(precalcAtanyx * " << coeff << ") / " << coeff << " + MPI / " << n << ";\n"
<< "\t\treal_t x0 = cos(angle) * len;\n"
<< "\t\treal_t y0 = sin(angle) * len;\n"
<< "\t\treal_t xmx = vIn.x - x0;\n" << "\t\treal_t xmx = vIn.x - x0;\n"
<< "\t\treal_t ymy = vIn.y - y0;\n" << "\t\treal_t ymy = vIn.y - y0;\n"
<< "\n" << "\n"
<< "\t\tif (sqrt(fma(xmx, xmx, SQR(ymy))) < d)\n" << "\t\tif (sqrt(fma(xmx, xmx, SQR(ymy))) < " << d << ")\n"
<< "\t\t{\n" << "\t\t{\n"
<< "\t\t if (" << zero << " > 1.5)\n" << "\t\t if (" << zero << " > 1.5)\n"
<< "\t\t {\n" << "\t\t {\n"
@ -2151,8 +2148,8 @@ public:
<< "\t\t else\n" << "\t\t else\n"
<< "\t\t {\n" << "\t\t {\n"
<< "\t\t real_t rangle = atan2(vIn.y - y0, vIn.x - x0);\n" << "\t\t real_t rangle = atan2(vIn.y - y0, vIn.x - x0);\n"
<< "\t\t fx = fma(cos(rangle), d, x0);\n" << "\t\t fx = fma(cos(rangle), " << d << ", x0);\n"
<< "\t\t fy = fma(sin(rangle), d, y0);\n" << "\t\t fy = fma(sin(rangle), " << d << ", y0);\n"
<< "\t\t fz = 0;\n" << "\t\t fz = 0;\n"
<< "\t\t }\n" << "\t\t }\n"
<< "\t\t }\n" << "\t\t }\n"
@ -2169,6 +2166,9 @@ public:
{ {
m_N = Zeps(m_N); m_N = Zeps(m_N);
m_Coeff = Zeps<T>(m_N * T(0.5) / T(M_PI)); m_Coeff = Zeps<T>(m_N * T(0.5) / T(M_PI));
m_A0 = T(M_PI) / m_N;
m_Len = 1 / Zeps(std::cos(m_A0));
m_D = m_Rad * std::sin(m_A0) * m_Len;
} }
virtual vector<string> OpenCLGlobalFuncNames() const override virtual vector<string> OpenCLGlobalFuncNames() const override
@ -2185,6 +2185,9 @@ protected:
m_Params.push_back(ParamWithName<T>(&m_Rad, prefix + "hypercrop_rad", 1)); m_Params.push_back(ParamWithName<T>(&m_Rad, prefix + "hypercrop_rad", 1));
m_Params.push_back(ParamWithName<T>(&m_Zero, prefix + "hypercrop_zero")); m_Params.push_back(ParamWithName<T>(&m_Zero, prefix + "hypercrop_zero"));
m_Params.push_back(ParamWithName<T>(true, &m_Coeff, prefix + "hypercrop_coeff"));//Precalc. m_Params.push_back(ParamWithName<T>(true, &m_Coeff, prefix + "hypercrop_coeff"));//Precalc.
m_Params.push_back(ParamWithName<T>(true, &m_A0, prefix + "hypercrop_a0"));//Precalc.
m_Params.push_back(ParamWithName<T>(true, &m_Len, prefix + "hypercrop_len"));//Precalc.
m_Params.push_back(ParamWithName<T>(true, &m_D, prefix + "hypercrop_d"));//Precalc.
} }
private: private:
@ -2192,6 +2195,9 @@ private:
T m_Rad; T m_Rad;
T m_Zero; T m_Zero;
T m_Coeff;//Precalc. T m_Coeff;//Precalc.
T m_A0;
T m_Len;
T m_D;
}; };
/// <summary> /// <summary>