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

View File

@ -2069,15 +2069,12 @@ public:
{
T fx = helper.In.x;
T fy = helper.In.y;
T fz = helper.In.z;
T a0 = T(M_PI) / m_N;
T len = 1 / Zeps(std::cos(a0));
T d = m_Rad * std::sin(a0) * 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;
T fz = helper.In.z;
T angle = Floor<T>(helper.m_PrecalcAtanyx * m_Coeff) / m_Coeff + m_A0;
T x0 = std::cos(angle) * m_Len;
T y0 = std::sin(angle) * m_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)
{
@ -2096,8 +2093,8 @@ public:
else
{
T rangle = std::atan2(helper.In.y - y0, helper.In.x - x0);
fx = x0 + std::cos(rangle) * d;
fy = y0 + std::sin(rangle) * d;
fx = x0 + std::cos(rangle) * m_D;
fy = y0 + std::sin(rangle) * m_D;
fz = 0;
}
}
@ -2118,21 +2115,21 @@ public:
string n = "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 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"
<< "\t\treal_t fx = vIn.x;\n"
<< "\t\treal_t fy = vIn.y;\n"
<< "\t\treal_t fz = vIn.z;\n"
<< "\t\treal_t a0 = MPI / " << n << ";\n"
<< "\t\treal_t len = 1 / Zeps(cos(a0));\n"
<< "\t\treal_t d = " << rad << " * sin(a0) * 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 angle = floor(precalcAtanyx * " << coeff << ") / " << coeff << " + " << a0 << ";\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 ymy = vIn.y - y0;\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 if (" << zero << " > 1.5)\n"
<< "\t\t {\n"
@ -2151,8 +2148,8 @@ public:
<< "\t\t else\n"
<< "\t\t {\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 fy = fma(sin(rangle), d, y0);\n"
<< "\t\t fx = fma(cos(rangle), " << d << ", x0);\n"
<< "\t\t fy = fma(sin(rangle), " << d << ", y0);\n"
<< "\t\t fz = 0;\n"
<< "\t\t }\n"
<< "\t\t }\n"
@ -2169,6 +2166,9 @@ public:
{
m_N = Zeps(m_N);
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
@ -2185,6 +2185,9 @@ protected:
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>(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:
@ -2192,6 +2195,9 @@ private:
T m_Rad;
T m_Zero;
T m_Coeff;//Precalc.
T m_A0;
T m_Len;
T m_D;
};
/// <summary>