mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-06-30 21:36:33 -04:00
06/09/2017
--User changes -dark.qss is now per-OS. -Properly set/reload palette when coming from the palette editor. The latter must be done if they've modified the current palette even if they've clicked cancel. --Bug fixes -Make the following variations safer by using Zeps(): conic, bipolar, edisc, whorl, tan, csc, cot, tanh, sech, csch, coth, auger, bwraps, hypertile3d, hypertile3d1, ortho, poincare, rational3, barycentroid, sschecks, cscq, cschq, scry_3D, splitbrdr, hexcrop, nblur, crob. -Fix bug enabling/disabling overwrite button in palette editor. -Small optimization for gdoffs, use precalcAtanYX. -Properly propagate z through circlesplit, cylinder2 and tile_log variations. -Some values in truchet_fill could've been NaN. --Code changes -Make most installation files read only. -Qualify many calls with std:: to ensure they're not colliding with glm:: -Use auto in more places.
This commit is contained in:
@ -141,7 +141,7 @@ public:
|
||||
}
|
||||
|
||||
//Allocate the memory for these filters and the hit/width lookup array.
|
||||
rowSize = static_cast<int>(2 * ceil(finalMaxRad) - 1);
|
||||
rowSize = static_cast<int>(2 * std::ceil(finalMaxRad) - 1);
|
||||
m_FilterWidth = (rowSize - 1) / 2;
|
||||
m_KernelSize = (m_FilterWidth + 1) * (2 + m_FilterWidth) / 2;
|
||||
m_Coefs.resize(maxIndex * m_KernelSize);
|
||||
|
@ -634,7 +634,7 @@ public:
|
||||
t = xform->m_Post.m_Mat[col][2];
|
||||
}
|
||||
|
||||
cxAng[k][col] = atan2(c1[1], c1[0]);
|
||||
cxAng[k][col] = std::atan2(c1[1], c1[0]);
|
||||
cxMag[k][col] = std::sqrt(c1[0] * c1[0] + c1[1] * c1[1]);
|
||||
|
||||
if (cxMag[k][col] == 0)
|
||||
@ -722,7 +722,7 @@ public:
|
||||
{
|
||||
c1[0] = embers[k].GetXform(xfi)->m_Affine.m_Mat[0][col];//A,D then B,E.
|
||||
c1[1] = embers[k].GetXform(xfi)->m_Affine.m_Mat[1][col];
|
||||
cxang[k][col] = atan2(c1[1], c1[0]);
|
||||
cxang[k][col] = std::atan2(c1[1], c1[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -774,7 +774,7 @@ public:
|
||||
{
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (log(cxMag[i][col]) < -10)
|
||||
if (std::log(cxMag[i][col]) < -10)
|
||||
accmode[col] = 1;//Mode set to linear interp.
|
||||
}
|
||||
}
|
||||
@ -926,8 +926,8 @@ public:
|
||||
|
||||
if (bd < 0) return true;
|
||||
|
||||
ad = atan2(a.m_Affine.A(), a.m_Affine.D());
|
||||
bd = atan2(b.m_Affine.A(), b.m_Affine.D());
|
||||
ad = std::atan2(a.m_Affine.A(), a.m_Affine.D());
|
||||
bd = std::atan2(b.m_Affine.A(), b.m_Affine.D());
|
||||
}
|
||||
|
||||
return ad > bd;
|
||||
|
@ -919,18 +919,17 @@ eRenderStatus Renderer<T, bucketT>::GaussianDensityFilter()
|
||||
|
||||
for (intmax_t j = localStartRow; (j < localEndRow) && !m_Abort; j++)
|
||||
{
|
||||
size_t bucketRowStart = j * m_SuperRasW;//Pull out of inner loop for optimization.
|
||||
const tvec4<bucketT, glm::defaultp>* bucket;
|
||||
const tvec4<bucketT, glm::defaultp>* buckets = m_HistBuckets.data();
|
||||
const bucketT* filterCoefs = m_DensityFilter->Coefs();
|
||||
const bucketT* filterWidths = m_DensityFilter->Widths();
|
||||
auto buckets = m_HistBuckets.data();
|
||||
auto bucketRowStart = buckets + (j * m_SuperRasW);//Pull out of inner loop for optimization.
|
||||
auto filterCoefs = m_DensityFilter->Coefs();
|
||||
auto filterWidths = m_DensityFilter->Widths();
|
||||
|
||||
for (intmax_t i = startCol; i < endCol; i++)
|
||||
{
|
||||
intmax_t ii, jj, arrFilterWidth;
|
||||
size_t filterSelectInt, filterCoefIndex;
|
||||
T filterSelect = 0;
|
||||
bucket = buckets + bucketRowStart + i;
|
||||
auto bucket = bucketRowStart + i;
|
||||
|
||||
//Don't do anything if there's no hits here. Must also put this first to avoid dividing by zero below.
|
||||
if (bucket->a == 0)
|
||||
|
@ -684,7 +684,7 @@ static inline void ClampGte0Ref(T& val)
|
||||
template <typename T>
|
||||
static inline T Round(T r)
|
||||
{
|
||||
return (r > 0) ? static_cast<T>(Floor<T>(r + T(0.5))) : ceil(r - T(0.5));
|
||||
return (r > 0) ? static_cast<T>(Floor<T>(r + T(0.5))) : std::ceil(r - T(0.5));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1226,10 +1226,10 @@ public:
|
||||
}
|
||||
|
||||
if (m_NeedPrecalcAtanXY)
|
||||
iteratorHelper.m_PrecalcAtanxy = atan2(iteratorHelper.In.x, iteratorHelper.In.y);
|
||||
iteratorHelper.m_PrecalcAtanxy = std::atan2(iteratorHelper.In.x, iteratorHelper.In.y);
|
||||
|
||||
if (m_NeedPrecalcAtanYX)
|
||||
iteratorHelper.m_PrecalcAtanyx = atan2(iteratorHelper.In.y, iteratorHelper.In.x);
|
||||
iteratorHelper.m_PrecalcAtanyx = std::atan2(iteratorHelper.In.y, iteratorHelper.In.x);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -2328,4 +2328,4 @@ protected:
|
||||
\
|
||||
PREPOSTPARVARCOPY(Post##varName##Variation, varName##Variation) \
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -2883,9 +2883,10 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T ct = helper.In.x / helper.m_PrecalcSqrtSumSquares;
|
||||
T z = Zeps(helper.m_PrecalcSqrtSumSquares);
|
||||
T ct = helper.In.x / z;
|
||||
T r = m_Weight * (rand.Frand01<T>() - m_Holes) *
|
||||
m_Eccentricity / (1 + m_Eccentricity * ct) / helper.m_PrecalcSqrtSumSquares;
|
||||
m_Eccentricity / (1 + m_Eccentricity * ct) / z;
|
||||
helper.Out.x = r * helper.In.x;
|
||||
helper.Out.y = r * helper.In.y;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
@ -2900,8 +2901,9 @@ public:
|
||||
string eccentricity = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string holes = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t z = Zeps(precalcSqrtSumSquares);\n"
|
||||
<< "\t\treal_t ct = vIn.x / precalcSqrtSumSquares;\n"
|
||||
<< "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * (MwcNext01(mwc) - " << holes << ") * " << eccentricity << " / (1 + " << eccentricity << " * ct) / precalcSqrtSumSquares;\n"
|
||||
<< "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * (MwcNext01(mwc) - " << holes << ") * " << eccentricity << " / (1 + " << eccentricity << " * ct) / z;\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = r * vIn.x;\n"
|
||||
<< "\t\tvOut.y = r * vIn.y;\n"
|
||||
@ -2910,6 +2912,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
m_Eccentricity = rand.Frand01<T>();
|
||||
@ -3096,7 +3103,7 @@ public:
|
||||
const T x2y2 = helper.m_PrecalcSumSquares;
|
||||
const T t = x2y2 + 1;
|
||||
const T x2 = 2 * helper.In.x;
|
||||
T y = T(0.5) * atan2(2 * helper.In.y, x2y2 - 1) + m_S;
|
||||
T y = T(0.5) * std::atan2(2 * helper.In.y, x2y2 - 1) + m_S;
|
||||
|
||||
if (y > T(M_PI_2))
|
||||
y = -T(M_PI_2) + fmod(y + T(M_PI_2), T(M_PI));
|
||||
@ -3123,7 +3130,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
helper.Out.x = m_V4 * std::log((t + x2) / (t - x2));
|
||||
helper.Out.x = m_V4 * std::log((t + x2) / Zeps(t - x2));
|
||||
helper.Out.y = m_V * y;
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
@ -3176,7 +3183,7 @@ public:
|
||||
|
||||
ss << "\t\telse\n"
|
||||
<< "\t\t{\n"
|
||||
<< "\t\t vOut.x = (" << v4 << " * log((t + x2) / (t - x2)));\n"
|
||||
<< "\t\t vOut.x = (" << v4 << " * log((t + x2) / Zeps(t - x2)));\n"
|
||||
<< "\t\t vOut.y = (" << v << " * y);\n"
|
||||
<< "\t\t vOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
|
||||
<< "\t\t}\n"
|
||||
@ -3196,6 +3203,11 @@ public:
|
||||
m_Shift = 2 * rand.Frand01<T>() - 1;
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual bool SetParamVal(const char* name, T val) override
|
||||
{
|
||||
if (!_stricmp(name, "bipolar_shift"))
|
||||
@ -3394,8 +3406,8 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T invCellSize = 1 / m_Size;
|
||||
T x = floor(helper.In.x * invCellSize);//Calculate input cell. Note that int cast is omitted here. See below.
|
||||
T y = floor(helper.In.y * invCellSize);
|
||||
T x = std::floor(helper.In.x * invCellSize);//Calculate input cell. Note that int cast is omitted here. See below.
|
||||
T y = std::floor(helper.In.y * invCellSize);
|
||||
T dx = helper.In.x - x * m_Size;//Offset from cell origin.
|
||||
T dy = helper.In.y - y * m_Size;
|
||||
|
||||
@ -3696,14 +3708,14 @@ public:
|
||||
T tmp2 = 2 * helper.In.x;
|
||||
T r1 = std::sqrt(tmp + tmp2);
|
||||
T r2 = std::sqrt(tmp - tmp2);
|
||||
T xmax = (r1 + r2) * T(0.5);
|
||||
T xmax = Zeps((r1 + r2) * T(0.5));
|
||||
T a1 = std::log(xmax + std::sqrt(xmax - 1));
|
||||
T a2 = -std::acos(Clamp<T>(helper.In.x / xmax, -1, 1));
|
||||
T w = m_Weight / T(11.57034632);//This is an interesting magic number.
|
||||
T snv, csv, snhu, cshu;
|
||||
sincos(a1, &snv, &csv);
|
||||
snhu = sinh(a2);
|
||||
cshu = cosh(a2);
|
||||
snhu = std::sinh(a2);
|
||||
cshu = std::cosh(a2);
|
||||
|
||||
if (helper.In.y > 0.0)
|
||||
snv = -snv;
|
||||
@ -3722,7 +3734,7 @@ public:
|
||||
<< "\t\treal_t tmp2 = (real_t)(2.0) * vIn.x;\n"
|
||||
<< "\t\treal_t r1 = sqrt(tmp + tmp2);\n"
|
||||
<< "\t\treal_t r2 = sqrt(tmp - tmp2);\n"
|
||||
<< "\t\treal_t xmax = (r1 + r2) * (real_t)(0.5);\n"
|
||||
<< "\t\treal_t xmax = Zeps((r1 + r2) * (real_t)(0.5));\n"
|
||||
<< "\t\treal_t a1 = log(xmax + sqrt(xmax - (real_t)(1.0)));\n"
|
||||
<< "\t\treal_t a2 = -acos(clamp(vIn.x / xmax, -(real_t)(1.0), (real_t)(1.0)));\n"
|
||||
<< "\t\treal_t w = xform->m_VariationWeights[" << varIndex << "] / (real_t)(11.57034632);\n"
|
||||
@ -3738,6 +3750,11 @@ public:
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -3774,7 +3791,7 @@ public:
|
||||
else
|
||||
ssx = std::sqrt(ssx);
|
||||
|
||||
helper.Out.x = w * atan2(a, b);
|
||||
helper.Out.x = w * std::atan2(a, b);
|
||||
|
||||
if (helper.In.y > 0)
|
||||
helper.Out.y = w * std::log(xmax + ssx);
|
||||
@ -3997,7 +4014,7 @@ public:
|
||||
|
||||
if (r < m_Weight)
|
||||
{
|
||||
T a = atan2(y, x) + m_Spin + m_Twist * (m_Weight - r);
|
||||
T a = std::atan2(y, x) + m_Spin + m_Twist * (m_Weight - r);
|
||||
helper.Out.x = m_Weight * (r * std::cos(a) + m_X);//Fix to make it colapse to 0 when weight is 0.//SMOULDER
|
||||
helper.Out.y = m_Weight * (r * std::sin(a) - m_Y);
|
||||
}
|
||||
@ -4657,12 +4674,12 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
if (cos(helper.In.y * m_YAng) >= 0)
|
||||
if (std::cos(helper.In.y * m_YAng) >= 0)
|
||||
helper.Out.x = m_Weight * helper.In.x;
|
||||
else
|
||||
helper.Out.x = -(m_Weight * helper.In.x);
|
||||
|
||||
if (cos(helper.In.x * m_XAng) >= 0)
|
||||
if (std::cos(helper.In.x * m_XAng) >= 0)
|
||||
helper.Out.y = m_Weight * helper.In.y;
|
||||
else
|
||||
helper.Out.y = -(m_Weight * helper.In.y);
|
||||
@ -5151,7 +5168,7 @@ public:
|
||||
if (r < m_Weight)
|
||||
a = helper.m_PrecalcAtanyx + m_Inside / (m_Weight - r);
|
||||
else
|
||||
a = helper.m_PrecalcAtanyx + m_Outside / (m_Weight - r);
|
||||
a = helper.m_PrecalcAtanyx + m_Outside / Zeps(m_Weight - r);
|
||||
|
||||
helper.Out.x = m_Weight * r * std::cos(a);
|
||||
helper.Out.y = m_Weight * r * std::sin(a);
|
||||
@ -5173,7 +5190,7 @@ public:
|
||||
<< "\t\tif (r < xform->m_VariationWeights[" << varIndex << "])\n"
|
||||
<< "\t\t a = precalcAtanyx + " << inside << " / (xform->m_VariationWeights[" << varIndex << "] - r);\n"
|
||||
<< "\t\telse\n"
|
||||
<< "\t\t a = precalcAtanyx + " << outside << " / (xform->m_VariationWeights[" << varIndex << "] - r);\n"
|
||||
<< "\t\t a = precalcAtanyx + " << outside << " / Zeps(xform->m_VariationWeights[" << varIndex << "] - r);\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = (xform->m_VariationWeights[" << varIndex << "] * r * cos(a));\n"
|
||||
<< "\t\tvOut.y = (xform->m_VariationWeights[" << varIndex << "] * r * sin(a));\n"
|
||||
@ -5182,6 +5199,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
m_Inside = rand.Frand01<T>();
|
||||
@ -5378,8 +5400,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * std::sin(helper.In.x) * cosh(helper.In.y);
|
||||
helper.Out.y = m_Weight * std::cos(helper.In.x) * sinh(helper.In.y);
|
||||
helper.Out.x = m_Weight * std::sin(helper.In.x) * std::cosh(helper.In.y);
|
||||
helper.Out.y = m_Weight * std::cos(helper.In.x) * std::sinh(helper.In.y);
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
@ -5410,8 +5432,8 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
//clamp fabs x and y to 7.104760e+002 for cosh, and |x| 7.104760e+002 for sinh
|
||||
helper.Out.x = m_Weight * std::cos(helper.In.x) * cosh(helper.In.y);
|
||||
helper.Out.y = -(m_Weight * std::sin(helper.In.x) * sinh(helper.In.y));
|
||||
helper.Out.x = m_Weight * std::cos(helper.In.x) * std::cosh(helper.In.y);
|
||||
helper.Out.y = -(m_Weight * std::sin(helper.In.x) * std::sinh(helper.In.y));
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
@ -5443,9 +5465,9 @@ public:
|
||||
{
|
||||
T tansin, tancos, tansinh, tancosh, tanden;
|
||||
sincos(2 * helper.In.x, &tansin, &tancos);
|
||||
tansinh = sinh(2 * helper.In.y);
|
||||
tancosh = cosh(2 * helper.In.y);
|
||||
tanden = 1 / (tancos + tancosh);
|
||||
tansinh = std::sinh(2 * helper.In.y);
|
||||
tancosh = std::cosh(2 * helper.In.y);
|
||||
tanden = 1 / Zeps(tancos + tancosh);
|
||||
helper.Out.x = m_Weight * tanden * tansin;
|
||||
helper.Out.y = m_Weight * tanden * tansinh;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
@ -5460,7 +5482,7 @@ public:
|
||||
<< "\t\treal_t tancos = cos((real_t)(2.0) * vIn.x);\n"
|
||||
<< "\t\treal_t tansinh = sinh((real_t)(2.0) * vIn.y);\n"
|
||||
<< "\t\treal_t tancosh = cosh((real_t)(2.0) * vIn.y);\n"
|
||||
<< "\t\treal_t tanden = (real_t)(1.0) / (tancos + tancosh);\n"
|
||||
<< "\t\treal_t tanden = (real_t)(1.0) / Zeps(tancos + tancosh);\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * tanden * tansin;\n"
|
||||
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * tanden * tansinh;\n"
|
||||
@ -5468,6 +5490,11 @@ public:
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -5485,9 +5512,9 @@ public:
|
||||
{
|
||||
T secsin, seccos, secsinh, seccosh, secden;
|
||||
sincos(helper.In.x, &secsin, &seccos);
|
||||
secsinh = sinh(helper.In.y);
|
||||
seccosh = cosh(helper.In.y);
|
||||
secden = 2 / (cos(2 * helper.In.x) + cosh(2 * helper.In.y));
|
||||
secsinh = std::sinh(helper.In.y);
|
||||
seccosh = std::cosh(helper.In.y);
|
||||
secden = 2 / Zeps(std::cos(2 * helper.In.x) + std::cosh(2 * helper.In.y));
|
||||
helper.Out.x = m_Weight * secden * seccos * seccosh;
|
||||
helper.Out.y = m_Weight * secden * secsin * secsinh;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
@ -5502,7 +5529,7 @@ public:
|
||||
<< "\t\treal_t seccos = cos(vIn.x);\n"
|
||||
<< "\t\treal_t secsinh = sinh(vIn.y);\n"
|
||||
<< "\t\treal_t seccosh = cosh(vIn.y);\n"
|
||||
<< "\t\treal_t secden = (real_t)(2.0) / (cos((real_t)(2.0) * vIn.x) + cosh((real_t)(2.0) * vIn.y));\n"
|
||||
<< "\t\treal_t secden = (real_t)(2.0) / Zeps(cos((real_t)(2.0) * vIn.x) + cosh((real_t)(2.0) * vIn.y));\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * secden * seccos * seccosh;\n"
|
||||
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * secden * secsin * secsinh;\n"
|
||||
@ -5510,6 +5537,11 @@ public:
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -5529,7 +5561,7 @@ public:
|
||||
sincos(helper.In.x, &cscsin, &csccos);
|
||||
cscsinh = std::sinh(helper.In.y);
|
||||
csccosh = std::cosh(helper.In.y);
|
||||
cscden = 2 / (std::cosh(2 * helper.In.y) - std::cos(2 * helper.In.x));
|
||||
cscden = 2 / Zeps(std::cosh(2 * helper.In.y) - std::cos(2 * helper.In.x));
|
||||
helper.Out.x = m_Weight * cscden * cscsin * csccosh;
|
||||
helper.Out.y = -(m_Weight * cscden * csccos * cscsinh);
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
@ -5544,7 +5576,7 @@ public:
|
||||
<< "\t\treal_t csccos = cos(vIn.x);\n"
|
||||
<< "\t\treal_t cscsinh = sinh(vIn.y);\n"
|
||||
<< "\t\treal_t csccosh = cosh(vIn.y);\n"
|
||||
<< "\t\treal_t cscden = (real_t)(2.0) / (cosh((real_t)(2.0) * vIn.y) - cos((real_t)(2.0) * vIn.x));\n"
|
||||
<< "\t\treal_t cscden = (real_t)(2.0) / Zeps(cosh((real_t)(2.0) * vIn.y) - cos((real_t)(2.0) * vIn.x));\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cscden * cscsin * csccosh;\n"
|
||||
<< "\t\tvOut.y = -(xform->m_VariationWeights[" << varIndex << "] * cscden * csccos * cscsinh);\n"
|
||||
@ -5552,6 +5584,11 @@ public:
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -5569,9 +5606,9 @@ public:
|
||||
{
|
||||
T cotsin, cotcos, cotsinh, cotcosh, cotden;
|
||||
sincos(2 * helper.In.x, &cotsin, &cotcos);
|
||||
cotsinh = sinh(2 * helper.In.y);
|
||||
cotcosh = cosh(2 * helper.In.y);
|
||||
cotden = 1 / (cotcosh - cotcos);
|
||||
cotsinh = std::sinh(2 * helper.In.y);
|
||||
cotcosh = std::cosh(2 * helper.In.y);
|
||||
cotden = 1 / Zeps(cotcosh - cotcos);
|
||||
helper.Out.x = m_Weight * cotden * cotsin;
|
||||
helper.Out.y = m_Weight * cotden * -1 * cotsinh;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
@ -5586,7 +5623,7 @@ public:
|
||||
<< "\t\treal_t cotcos = cos((real_t)(2.0) * vIn.x);\n"
|
||||
<< "\t\treal_t cotsinh = sinh((real_t)(2.0) * vIn.y);\n"
|
||||
<< "\t\treal_t cotcosh = cosh((real_t)(2.0) * vIn.y);\n"
|
||||
<< "\t\treal_t cotden = (real_t)(1.0) / (cotcosh - cotcos);\n"
|
||||
<< "\t\treal_t cotden = (real_t)(1.0) / Zeps(cotcosh - cotcos);\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cotden * cotsin;\n"
|
||||
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * cotden * -1 * cotsinh;\n"
|
||||
@ -5594,6 +5631,11 @@ public:
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -5611,8 +5653,8 @@ public:
|
||||
{
|
||||
T sinhsin, sinhcos, sinhsinh, sinhcosh;
|
||||
sincos(helper.In.y, &sinhsin, &sinhcos);
|
||||
sinhsinh = sinh(helper.In.x);
|
||||
sinhcosh = cosh(helper.In.x);
|
||||
sinhsinh = std::sinh(helper.In.x);
|
||||
sinhcosh = std::cosh(helper.In.x);
|
||||
helper.Out.x = m_Weight * sinhsinh * sinhcos;
|
||||
helper.Out.y = m_Weight * sinhcosh * sinhsin;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
@ -5651,8 +5693,8 @@ public:
|
||||
{
|
||||
T coshsin, coshcos, coshsinh, coshcosh;
|
||||
sincos(helper.In.y, &coshsin, &coshcos);
|
||||
coshsinh = sinh(helper.In.x);
|
||||
coshcosh = cosh(helper.In.x);
|
||||
coshsinh = std::sinh(helper.In.x);
|
||||
coshcosh = std::cosh(helper.In.x);
|
||||
helper.Out.x = m_Weight * coshcosh * coshcos;
|
||||
helper.Out.y = m_Weight * coshsinh * coshsin;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
@ -5691,9 +5733,9 @@ public:
|
||||
{
|
||||
T tanhsin, tanhcos, tanhsinh, tanhcosh, tanhden;
|
||||
sincos(2 * helper.In.y, &tanhsin, &tanhcos);
|
||||
tanhsinh = sinh(2 * helper.In.x);
|
||||
tanhcosh = cosh(2 * helper.In.x);
|
||||
tanhden = 1 / (tanhcos + tanhcosh);
|
||||
tanhsinh = std::sinh(2 * helper.In.x);
|
||||
tanhcosh = std::cosh(2 * helper.In.x);
|
||||
tanhden = 1 / Zeps(tanhcos + tanhcosh);
|
||||
helper.Out.x = m_Weight * tanhden * tanhsinh;
|
||||
helper.Out.y = m_Weight * tanhden * tanhsin;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
@ -5708,7 +5750,7 @@ public:
|
||||
<< "\t\treal_t tanhcos = cos((real_t)(2.0) * vIn.y);\n"
|
||||
<< "\t\treal_t tanhsinh = sinh((real_t)(2.0) * vIn.x);\n"
|
||||
<< "\t\treal_t tanhcosh = cosh((real_t)(2.0) * vIn.x);\n"
|
||||
<< "\t\treal_t tanhden = (real_t)(1.0) / (tanhcos + tanhcosh);\n"
|
||||
<< "\t\treal_t tanhden = (real_t)(1.0) / Zeps(tanhcos + tanhcosh);\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * tanhden * tanhsinh;\n"
|
||||
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * tanhden * tanhsin;\n"
|
||||
@ -5716,6 +5758,11 @@ public:
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -5733,9 +5780,9 @@ public:
|
||||
{
|
||||
T sechsin, sechcos, sechsinh, sechcosh, sechden;
|
||||
sincos(helper.In.y, &sechsin, &sechcos);
|
||||
sechsinh = sinh(helper.In.x);
|
||||
sechcosh = cosh(helper.In.x);
|
||||
sechden = 2 / (cos(2 * helper.In.y) + cosh(2 * helper.In.x));
|
||||
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);
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
@ -5750,7 +5797,7 @@ public:
|
||||
<< "\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) / (cos((real_t)(2.0) * vIn.y) + cosh((real_t)(2.0) * 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"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sechden * sechcos * sechcosh;\n"
|
||||
<< "\t\tvOut.y = -(xform->m_VariationWeights[" << varIndex << "] * sechden * sechsin * sechsinh);\n"
|
||||
@ -5758,6 +5805,11 @@ public:
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -5777,7 +5829,7 @@ public:
|
||||
sincos(helper.In.y, &cschsin, &cschcos);
|
||||
cschsinh = std::sinh(helper.In.x);
|
||||
cschcosh = std::cosh(helper.In.x);
|
||||
cschden = 2 / (std::cosh(2 * helper.In.x) - std::cos(2 * helper.In.y));
|
||||
cschden = 2 / Zeps(std::cosh(2 * helper.In.x) - std::cos(2 * helper.In.y));
|
||||
helper.Out.x = m_Weight * cschden * cschsinh * cschcos;
|
||||
helper.Out.y = -(m_Weight * cschden * cschcosh * cschsin);
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
@ -5792,7 +5844,7 @@ public:
|
||||
<< "\t\treal_t cschcos = cos(vIn.y);\n"
|
||||
<< "\t\treal_t cschsinh = sinh(vIn.x);\n"
|
||||
<< "\t\treal_t cschcosh = cosh(vIn.x);\n"
|
||||
<< "\t\treal_t cschden = (real_t)(2.0) / (cosh((real_t)(2.0) * vIn.x) - cos((real_t)(2.0) * vIn.y));\n"
|
||||
<< "\t\treal_t cschden = (real_t)(2.0) / Zeps(cosh((real_t)(2.0) * vIn.x) - cos((real_t)(2.0) * vIn.y));\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cschden * cschsinh * cschcos;\n"
|
||||
<< "\t\tvOut.y = -(xform->m_VariationWeights[" << varIndex << "] * cschden * cschcosh * cschsin);\n"
|
||||
@ -5800,6 +5852,11 @@ public:
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -5817,9 +5874,9 @@ public:
|
||||
{
|
||||
T cothsin, cothcos, cothsinh, cothcosh, cothden;
|
||||
sincos(2 * helper.In.y, &cothsin, &cothcos);
|
||||
cothsinh = sinh(2 * helper.In.x);
|
||||
cothcosh = cosh(2 * helper.In.x);
|
||||
cothden = 1 / (cothcosh - cothcos);
|
||||
cothsinh = std::sinh(2 * helper.In.x);
|
||||
cothcosh = std::cosh(2 * helper.In.x);
|
||||
cothden = 1 / Zeps(cothcosh - cothcos);
|
||||
helper.Out.x = m_Weight * cothden * cothsinh;
|
||||
helper.Out.y = m_Weight * cothden * cothsin;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
@ -5834,7 +5891,7 @@ public:
|
||||
<< "\t\treal_t cothcos = cos((real_t)(2.0) * vIn.y);\n"
|
||||
<< "\t\treal_t cothsinh = sinh((real_t)(2.0) * vIn.x);\n"
|
||||
<< "\t\treal_t cothcosh = cosh((real_t)(2.0) * vIn.x);\n"
|
||||
<< "\t\treal_t cothden = (real_t)(1.0) / (cothcosh - cothcos);\n"
|
||||
<< "\t\treal_t cothden = (real_t)(1.0) / Zeps(cothcosh - cothcos);\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cothden * cothsinh;\n"
|
||||
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * cothden * cothsin;\n"
|
||||
@ -5842,6 +5899,11 @@ public:
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -5862,8 +5924,8 @@ public:
|
||||
{
|
||||
T s = std::sin(m_Freq * helper.In.x);
|
||||
T t = std::sin(m_Freq * helper.In.y);
|
||||
T dy = helper.In.y + m_AugerWeight * (m_Scale * s / 2 + std::abs(helper.In.y) * s);
|
||||
T dx = helper.In.x + m_AugerWeight * (m_Scale * t / 2 + std::abs(helper.In.x) * t);
|
||||
T dy = helper.In.y + m_AugerWeight * (m_Scale * s / Zeps(2 + std::abs(helper.In.y) * s));
|
||||
T dx = helper.In.x + m_AugerWeight * (m_Scale * t / Zeps(2 + std::abs(helper.In.x) * t));
|
||||
helper.Out.x = m_Weight * (helper.In.x + m_Symmetry * (dx - helper.In.x));
|
||||
helper.Out.y = m_Weight * dy;
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
@ -5882,8 +5944,8 @@ public:
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t s = sin(" << freq << " * vIn.x);\n"
|
||||
<< "\t\treal_t t = sin(" << freq << " * vIn.y);\n"
|
||||
<< "\t\treal_t dy = vIn.y + " << augerWeight << " * (" << scale << " * s / (real_t)(2.0) + fabs(vIn.y) * s);\n"
|
||||
<< "\t\treal_t dx = vIn.x + " << augerWeight << " * (" << scale << " * t / (real_t)(2.0) + fabs(vIn.x) * t);\n"
|
||||
<< "\t\treal_t dy = vIn.y + " << augerWeight << " * (" << scale << " * s / Zeps((real_t)(2.0) + fabs(vIn.y) * s));\n"
|
||||
<< "\t\treal_t dx = vIn.x + " << augerWeight << " * (" << scale << " * t / Zeps((real_t)(2.0) + fabs(vIn.x) * t));\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x + " << symmetry << " * (dx - vIn.x));\n"
|
||||
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * dy;\n"
|
||||
@ -5900,6 +5962,11 @@ public:
|
||||
m_Scale = rand.Frand01<T>();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -5943,7 +6010,7 @@ public:
|
||||
frac = 1;
|
||||
|
||||
T avgr = m_Weight * (m_Spr * std::sqrt(std::sqrt(yy + SQR(xpw)) / frac));
|
||||
T avga = (atan2(helper.In.y, xmw) - atan2(helper.In.y, xpw)) * T(0.5);
|
||||
T avga = (std::atan2(helper.In.y, xmw) - std::atan2(helper.In.y, xpw)) * T(0.5);
|
||||
helper.Out.x = avgr * std::cos(avga);
|
||||
helper.Out.y = avgr * std::sin(avga);
|
||||
helper.Out.z = helper.In.z;//Apo does not use weight, sums only z. Sum here for reg, else assign.
|
||||
|
@ -155,7 +155,7 @@ public:
|
||||
{
|
||||
lx *= m_G2;
|
||||
ly *= m_G2;
|
||||
T r = m_Rfactor / ((SQR(lx) + SQR(ly)) / 4 + 1);
|
||||
T r = m_Rfactor / Zeps((SQR(lx) + SQR(ly)) / 4 + 1);
|
||||
lx *= r;
|
||||
ly *= r;
|
||||
r = (SQR(lx) + SQR(ly)) / m_R2;
|
||||
@ -211,7 +211,7 @@ public:
|
||||
<< "\t\t lx *= " << g2 << ";\n"
|
||||
<< "\t\t ly *= " << g2 << ";\n"
|
||||
<< "\n"
|
||||
<< "\t\t real_t r = " << rfactor << " / ((SQR(lx) + SQR(ly)) / 4 + 1);\n"
|
||||
<< "\t\t real_t r = " << rfactor << " / Zeps((SQR(lx) + SQR(ly)) / 4 + 1);\n"
|
||||
<< "\n"
|
||||
<< "\t\t lx *= r;\n"
|
||||
<< "\t\t ly *= r;\n"
|
||||
@ -245,10 +245,15 @@ public:
|
||||
else
|
||||
maxBubble *= (1 / (SQR(maxBubble) / 4 + 1));
|
||||
|
||||
m_R2 = SQR(radius);
|
||||
m_R2 = Zeps(SQR(radius));
|
||||
m_Rfactor = radius / maxBubble;
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -1957,7 +1962,7 @@ public:
|
||||
{
|
||||
T s, c;
|
||||
T avgr = m_Weight * (std::sqrt(SQR(helper.In.y) + SQR(helper.In.x + 1)) / std::sqrt(SQR(helper.In.y) + SQR(helper.In.x - 1)));
|
||||
T avga = (atan2(helper.In.y, helper.In.x - 1) - atan2(helper.In.y, helper.In.x + 1)) / 2;
|
||||
T avga = (atan2(helper.In.y, helper.In.x - 1) - std::atan2(helper.In.y, helper.In.x + 1)) / 2;
|
||||
sincos(avga, &s, &c);
|
||||
helper.Out.x = avgr * c;
|
||||
helper.Out.y = avgr * s;
|
||||
@ -2033,7 +2038,7 @@ public:
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_K = T(0.5) * std::log(Zeps(SQR(m_Real) + SQR(m_Imag)));//Original used 1e-300, which isn't representable with a float.
|
||||
m_T = atan2(m_Imag, m_Real);
|
||||
m_T = std::atan2(m_Imag, m_Real);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -2958,7 +2963,7 @@ public:
|
||||
T r2 = helper.m_PrecalcSumSquares + helper.In.z;
|
||||
T x2cx = m_C2x * helper.In.x;
|
||||
T y2cy = m_C2y * helper.In.y;
|
||||
T d = m_Weight / (m_C2 * r2 + x2cx - y2cy + 1);
|
||||
T d = m_Weight / Zeps(m_C2 * r2 + x2cx - y2cy + 1);
|
||||
helper.Out.x = d * (helper.In.x * m_S2x - m_Cx * ( y2cy - r2 - 1));
|
||||
helper.Out.y = d * (helper.In.y * m_S2y + m_Cy * (-x2cx - r2 - 1));
|
||||
helper.Out.z = d * (helper.In.z * m_S2z);
|
||||
@ -2987,7 +2992,7 @@ public:
|
||||
<< "\t\treal_t r2 = precalcSumSquares + vIn.z;\n"
|
||||
<< "\t\treal_t x2cx = " << c2x << " * vIn.x;\n"
|
||||
<< "\t\treal_t y2cy = " << c2y << " * vIn.y;\n"
|
||||
<< "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] / (" << c2 << " * r2 + x2cx - y2cy + 1);\n"
|
||||
<< "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] / Zeps(" << c2 << " * r2 + x2cx - y2cy + 1);\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = d * (vIn.x * " << s2x << " - " << cx << "* ( y2cy - r2 - 1));\n"
|
||||
<< "\t\tvOut.y = d * (vIn.y * " << s2y << " + " << cy << "* (-x2cx - r2 - 1));\n"
|
||||
@ -3018,6 +3023,11 @@ public:
|
||||
m_S2z = 1 - SQR(m_Cy) - SQR(m_Cx);
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -3078,7 +3088,7 @@ public:
|
||||
T r2 = helper.m_PrecalcSumSquares + SQR(helper.In.z);
|
||||
T x2cx = 2 * cx * helper.In.x;
|
||||
T y2cy = 2 * cy * helper.In.x;
|
||||
T d = m_Weight / (m_C2 * r2 + x2cx - y2cy + 1);
|
||||
T d = m_Weight / Zeps(m_C2 * r2 + x2cx - y2cy + 1);
|
||||
helper.Out.x = d * (helper.In.x * s2x - cx * ( y2cy - r2 - 1));
|
||||
helper.Out.y = d * (helper.In.y * s2y + cy * (-x2cx - r2 - 1));
|
||||
helper.Out.z = d * (helper.In.z * m_S2z);
|
||||
@ -3105,7 +3115,7 @@ public:
|
||||
<< "\t\treal_t r2 = precalcSumSquares + SQR(vIn.z);\n"
|
||||
<< "\t\treal_t x2cx = 2 * cx * vIn.x;\n"
|
||||
<< "\t\treal_t y2cy = 2 * cy * vIn.x;\n"
|
||||
<< "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] / (" << c2 << " * r2 + x2cx - y2cy + 1);\n"
|
||||
<< "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] / Zeps(" << c2 << " * r2 + x2cx - y2cy + 1);\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = d * (vIn.x * s2x - cx * ( y2cy - r2 - 1));\n"
|
||||
<< "\t\tvOut.y = d * (vIn.y * s2y + cy * (-x2cx - r2 - 1));\n"
|
||||
@ -3131,6 +3141,11 @@ public:
|
||||
m_S2z = 1 - m_C2;
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -3811,10 +3826,10 @@ public:
|
||||
{
|
||||
if (helper.In.x >= 0)
|
||||
{
|
||||
xo = (r + 1) / (2 * helper.In.x);
|
||||
xo = (r + 1) / Zeps(2 * helper.In.x);
|
||||
ro = std::sqrt(SQR(helper.In.x - xo) + SQR(helper.In.y));
|
||||
theta = atan2(T(1), ro);
|
||||
a = fmod(m_In * theta + atan2(helper.In.y, xo - helper.In.x) + theta, 2 * theta) - theta;
|
||||
theta = std::atan2(T(1), ro);
|
||||
a = fmod(m_In * theta + std::atan2(helper.In.y, xo - helper.In.x) + theta, 2 * theta) - theta;
|
||||
sincos(a, &s, &c);
|
||||
helper.Out.x = m_Weight * (xo - c * ro);
|
||||
helper.Out.y = m_Weight * s * ro;
|
||||
@ -3823,8 +3838,8 @@ public:
|
||||
{
|
||||
xo = - (r + 1) / (2 * helper.In.x);
|
||||
ro = std::sqrt(SQR(-helper.In.x - xo) + SQR(helper.In.y));
|
||||
theta = atan2(T(1), ro);
|
||||
a = fmod(m_In * theta + atan2(helper.In.y, xo + helper.In.x) + theta, 2 * theta) - theta;
|
||||
theta = std::atan2(T(1), ro);
|
||||
a = fmod(m_In * theta + std::atan2(helper.In.y, xo + helper.In.x) + theta, 2 * theta) - theta;
|
||||
sincos(a, &s, &c);
|
||||
helper.Out.x = -(m_Weight * (xo - c * ro));
|
||||
helper.Out.y = m_Weight * s * ro;
|
||||
@ -3840,10 +3855,10 @@ public:
|
||||
|
||||
if (x >= 0)
|
||||
{
|
||||
xo = (SQR(x) + SQR(y) + 1) / (2 * x);
|
||||
xo = (SQR(x) + SQR(y) + 1) / Zeps(2 * x);
|
||||
ro = std::sqrt(SQR(x - xo) + SQR(y));
|
||||
theta = std::atan2(T(1), ro);
|
||||
a = fmod(m_Out * theta + atan2(y, xo - x) + theta, 2 * theta) - theta;
|
||||
a = fmod(m_Out * theta + std::atan2(y, xo - x) + theta, 2 * theta) - theta;
|
||||
sincos(a, &s, &c);
|
||||
x = (xo - c * ro);
|
||||
y = s * ro;
|
||||
@ -3895,7 +3910,7 @@ public:
|
||||
<< "\t\t{\n"
|
||||
<< "\t\t if (vIn.x >= 0)\n"
|
||||
<< "\t\t {\n"
|
||||
<< "\t\t xo = (r + 1) / (2 * vIn.x);\n"
|
||||
<< "\t\t xo = (r + 1) / Zeps(2 * vIn.x);\n"
|
||||
<< "\t\t ro = sqrt(SQR(vIn.x - xo) + SQR(vIn.y));\n"
|
||||
<< "\t\t theta = atan2(1, ro);\n"
|
||||
<< "\t\t a = fmod(" << in << " * theta + atan2(vIn.y, xo - vIn.x) + theta, 2 * theta) - theta;\n"
|
||||
@ -3928,7 +3943,7 @@ public:
|
||||
<< "\n"
|
||||
<< "\t\t if (x >= 0)\n"
|
||||
<< "\t\t {\n"
|
||||
<< "\t\t xo = (SQR(x) + SQR(y) + 1) / (2 * x);\n"
|
||||
<< "\t\t xo = (SQR(x) + SQR(y) + 1) / Zeps(2 * x);\n"
|
||||
<< "\t\t ro = sqrt(SQR(x - xo) + SQR(y));\n"
|
||||
<< "\t\t theta = atan2(1 , ro);\n"
|
||||
<< "\t\t a = fmod(" << out << " * theta + atan2(y, xo - x) + theta, 2 * theta) - theta;\n"
|
||||
@ -3971,6 +3986,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -4001,10 +4021,10 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T x = m_C1x + (SQR(m_C1r) * (helper.In.x - m_C1x)) / (SQR(helper.In.x - m_C1x) + SQR(helper.In.y - m_C1y));
|
||||
T y = m_C1y + (SQR(m_C1r) * (helper.In.y - m_C1y)) / (SQR(helper.In.x - m_C1x) + SQR(helper.In.y - m_C1y));
|
||||
helper.Out.x = m_C2x + (SQR(m_C2r) * (x - m_C2x)) / (SQR(x - m_C2x) + SQR(y - m_C2y));
|
||||
helper.Out.y = m_C2y + (SQR(m_C2r) * (y - m_C2y)) / (SQR(x - m_C2x) + SQR(y - m_C2y));
|
||||
T x = m_C1x + (SQR(m_C1r) * (helper.In.x - m_C1x)) / Zeps(Sqr(helper.In.x - m_C1x) + Sqr(helper.In.y - m_C1y));
|
||||
T y = m_C1y + (SQR(m_C1r) * (helper.In.y - m_C1y)) / Zeps(Sqr(helper.In.x - m_C1x) + Sqr(helper.In.y - m_C1y));
|
||||
helper.Out.x = m_C2x + (SQR(m_C2r) * (x - m_C2x)) / Zeps(Sqr(x - m_C2x) + Sqr(y - m_C2y));
|
||||
helper.Out.y = m_C2y + (SQR(m_C2r) * (y - m_C2y)) / Zeps(Sqr(x - m_C2x) + Sqr(y - m_C2y));
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
@ -4025,11 +4045,11 @@ public:
|
||||
string c1d = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string c2d = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t x = " << c1x << " + (SQR(" << c1r << ") * (vIn.x - " << c1x << ")) / (SQR(vIn.x - " << c1x << ") + SQR(vIn.y - " << c1y << "));\n"
|
||||
<< "\t\treal_t y = " << c1y << " + (SQR(" << c1r << ") * (vIn.y - " << c1y << ")) / (SQR(vIn.x - " << c1x << ") + SQR(vIn.y - " << c1y << "));\n"
|
||||
<< "\t\treal_t x = " << c1x << " + (SQR(" << c1r << ") * (vIn.x - " << c1x << ")) / Zeps(Sqr(vIn.x - " << c1x << ") + Sqr(vIn.y - " << c1y << "));\n"
|
||||
<< "\t\treal_t y = " << c1y << " + (SQR(" << c1r << ") * (vIn.y - " << c1y << ")) / Zeps(Sqr(vIn.x - " << c1x << ") + Sqr(vIn.y - " << c1y << "));\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = " << c2x << " + (SQR(" << c2r << ") * (x - " << c2x << ")) / (SQR(x - " << c2x << ") + SQR(y - " << c2y << "));\n"
|
||||
<< "\t\tvOut.y = " << c2y << " + (SQR(" << c2r << ") * (y - " << c2y << ")) / (SQR(x - " << c2x << ") + SQR(y - " << c2y << "));\n"
|
||||
<< "\t\tvOut.x = " << c2x << " + (SQR(" << c2r << ") * (x - " << c2x << ")) / Zeps(Sqr(x - " << c2x << ") + Sqr(y - " << c2y << "));\n"
|
||||
<< "\t\tvOut.y = " << c2y << " + (SQR(" << c2r << ") * (y - " << c2y << ")) / Zeps(Sqr(x - " << c2x << ") + Sqr(y - " << c2y << "));\n"
|
||||
<< "\t\tvOut.z = " << DefaultZCl()
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
@ -4045,6 +4065,11 @@ public:
|
||||
m_C2y = m_C2d * std::sin(fmod(m_C2a, T(M_PI)));
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr", "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -4358,7 +4383,7 @@ public:
|
||||
T ti = m_T3 * (3 * xsqr * helper.In.y - ycb) + m_T2 * 2 * helper.In.x * helper.In.y + m_T1 * helper.In.y;
|
||||
T br = m_B3 * (xcb - 3 * helper.In.x * ysqr) + m_B2 * (xsqr - ysqr) + m_B1 * helper.In.x + m_Bc;
|
||||
T bi = m_B3 * (3 * xsqr * helper.In.y - ycb) + m_B2 * 2 * helper.In.x * helper.In.y + m_B1 * helper.In.y;
|
||||
T r3den = 1 / (br * br + bi * bi);
|
||||
T r3den = 1 / Zeps(br * br + bi * bi);
|
||||
helper.Out.x = m_Weight * (tr * br + ti * bi) * r3den;
|
||||
helper.Out.y = m_Weight * (ti * br - tr * bi) * r3den;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
@ -4390,7 +4415,7 @@ public:
|
||||
<< "\t\treal_t br = " << b3 << " * (xcb - 3 * vIn.x * ysqr) + " << b2 << " * (xsqr - ysqr) + " << b1 << " * vIn.x + " << bc << ";\n"
|
||||
<< "\t\treal_t bi = " << b3 << " * (3 * xsqr * vIn.y - ycb) + " << b2 << " * 2 * vIn.x * vIn.y + " << b1 << " * vIn.y;\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t r3den = 1 / (br * br + bi * bi);\n"
|
||||
<< "\t\treal_t r3den = 1 / Zeps(br * br + bi * bi);\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (tr * br + ti * bi) * r3den;\n"
|
||||
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (ti * br - tr * bi) * r3den;\n"
|
||||
@ -4399,6 +4424,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -4663,6 +4693,11 @@ public:
|
||||
m_Vv = std::abs(m_Weight);
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -5192,7 +5227,7 @@ public:
|
||||
T dot11 = SQR(m_C) + SQR(m_D);//v1 * v1.
|
||||
T dot12 = m_C * helper.In.x + m_D * helper.In.y;//v1 * v2.
|
||||
//Compute inverse denomiator.
|
||||
T invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
|
||||
T invDenom = 1 / Zeps(dot00 * dot11 - dot01 * dot01);
|
||||
//Now we can pull [u,v] as the barycentric coordinates of the point
|
||||
//P in the triangle [A, B, C].
|
||||
T u = (dot11 * dot02 - dot01 * dot12) * invDenom;
|
||||
@ -5221,7 +5256,7 @@ public:
|
||||
<< "\t\treal_t dot02 = " << a << " * vIn.x + " << b << " * vIn.y;\n"
|
||||
<< "\t\treal_t dot11 = SQR(" << c << ") + SQR(" << d << ");\n"
|
||||
<< "\t\treal_t dot12 = " << c << " * vIn.x + " << d << " * vIn.y;\n"
|
||||
<< "\t\treal_t invDenom = (real_t)(1.0) / (dot00 * dot11 - dot01 * dot01);\n"
|
||||
<< "\t\treal_t invDenom = (real_t)(1.0) / Zeps(dot00 * dot11 - dot01 * dot01);\n"
|
||||
<< "\t\treal_t u = (dot11 * dot02 - dot01 * dot12) * invDenom;\n"
|
||||
<< "\t\treal_t v = (dot00 * dot12 - dot01 * dot02) * invDenom;\n"
|
||||
<< "\t\treal_t um = sqrt(SQR(u) + SQR(vIn.x)) * Sign(u);\n"
|
||||
@ -5236,7 +5271,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sign" };
|
||||
return vector<string> { "Sign", "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -20,9 +20,9 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T temp = 1 / Zeps(cos(helper.In.y)) + m_Effect * T(M_PI);
|
||||
helper.Out.x = m_Weight * (tanh(helper.In.x) * temp);
|
||||
helper.Out.y = m_Weight * (tanh(helper.In.y) * temp);
|
||||
T temp = 1 / Zeps(std::cos(helper.In.y)) + m_Effect * T(M_PI);
|
||||
helper.Out.x = m_Weight * (std::tanh(helper.In.x) * temp);
|
||||
helper.Out.y = m_Weight * (std::tanh(helper.In.y) * temp);
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
@ -1111,7 +1111,7 @@ public:
|
||||
T coeff = std::abs(helper.In.z);
|
||||
|
||||
if (coeff != 0 && m_Power != 1)
|
||||
coeff = std::exp(log(coeff) * m_Power);
|
||||
coeff = std::exp(std::log(coeff) * m_Power);
|
||||
|
||||
helper.Out.x = m_Weight * (helper.m_TransX + helper.In.x * coeff);
|
||||
helper.Out.y = m_Weight * (helper.m_TransY + helper.In.y * coeff);
|
||||
@ -2258,7 +2258,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T dx, dy, r = m_Weight / (helper.m_PrecalcSumSquares + EPS);
|
||||
T dx, dy, r = m_Weight / Zeps(helper.m_PrecalcSumSquares);
|
||||
int isXY = int(VarFuncs<T>::LRint(helper.In.x * m_InvSize) + VarFuncs<T>::LRint(helper.In.y * m_InvSize));
|
||||
|
||||
if (isXY & 1)
|
||||
@ -2289,7 +2289,7 @@ public:
|
||||
string rand = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string invSize = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc.
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t dx, dy, r = xform->m_VariationWeights[" << varIndex << "] / (precalcSumSquares + EPS);\n"
|
||||
<< "\t\treal_t dx, dy, r = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSumSquares);\n"
|
||||
<< "\t\tint isXY = LRint(vIn.x * " << invSize << ") + LRint(vIn.y * " << invSize << ");\n"
|
||||
<< "\n"
|
||||
<< "\t\tif (isXY & 1)\n"
|
||||
@ -2312,12 +2312,12 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "LRint" };
|
||||
return vector<string> { "LRint", "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_InvSize = 1 / (m_Size + EPS);
|
||||
m_InvSize = 1 / Zeps(m_Size);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -3468,8 +3468,8 @@ public:
|
||||
sigma = alt * m_PiCn + fmod(sigma - m_CaCn, m_PiCn);
|
||||
|
||||
T temp = std::cosh(tau) - std::cos(sigma);
|
||||
helper.Out.x = m_Weight * sinh(tau) / temp;
|
||||
helper.Out.y = m_Weight * sin(sigma) / temp;
|
||||
helper.Out.x = m_Weight * std::sinh(tau) / temp;
|
||||
helper.Out.y = m_Weight * std::sin(sigma) / temp;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
@ -3791,7 +3791,7 @@ public:
|
||||
}
|
||||
|
||||
helper.Out.x = m_Weight * xmax * std::cos(nu);
|
||||
helper.Out.y = m_Weight * std::sqrt(xmax - 1) * std::sqrt(xmax + 1) * sin(nu);
|
||||
helper.Out.y = m_Weight * std::sqrt(xmax - 1) * std::sqrt(xmax + 1) * std::sin(nu);
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
|
@ -592,8 +592,8 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T d = Zeps(helper.m_PrecalcSumSquares);
|
||||
helper.Out.x = (m_Weight / d) * (tanh(d) * (2 * helper.In.x));
|
||||
helper.Out.y = (m_Weight / d) * (cos(d) * (2 * helper.In.y));
|
||||
helper.Out.x = (m_Weight / d) * (std::tanh(d) * (2 * helper.In.x));
|
||||
helper.Out.y = (m_Weight / d) * (std::cos(d) * (2 * helper.In.y));
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
@ -631,8 +631,8 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T d = Zeps(helper.m_PrecalcSumSquares);
|
||||
helper.Out.x = (m_Weight / 2) * (tanh(d) * (2 * helper.In.x));
|
||||
helper.Out.y = (m_Weight / 2) * (cos(d) * (2 * helper.In.y));
|
||||
helper.Out.x = (m_Weight / 2) * (std::tanh(d) * (2 * helper.In.x));
|
||||
helper.Out.y = (m_Weight / 2) * (std::cos(d) * (2 * helper.In.y));
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
@ -3664,7 +3664,7 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T absV = VarFuncs<T>::Hypot(helper.In.y, helper.In.z);
|
||||
T ni = m_Weight / (helper.m_PrecalcSumSquares + SQR(helper.In.z));
|
||||
T ni = m_Weight / Zeps(helper.m_PrecalcSumSquares + SQR(helper.In.z));
|
||||
T s = std::sin(helper.In.x);
|
||||
T c = std::cos(helper.In.x);
|
||||
T sh = std::sinh(absV);
|
||||
@ -3681,7 +3681,7 @@ public:
|
||||
intmax_t varIndex = IndexInXform();
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
|
||||
<< "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / (precalcSumSquares + SQR(vIn.z));\n"
|
||||
<< "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSumSquares + SQR(vIn.z));\n"
|
||||
<< "\t\treal_t s = sin(vIn.x);\n"
|
||||
<< "\t\treal_t c = cos(vIn.x);\n"
|
||||
<< "\t\treal_t sh = sinh(absV);\n"
|
||||
@ -3715,7 +3715,7 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T absV = VarFuncs<T>::Hypot(helper.In.y, helper.In.z);
|
||||
T ni = m_Weight / (helper.m_PrecalcSumSquares + SQR(helper.In.z));
|
||||
T ni = m_Weight / Zeps(helper.m_PrecalcSumSquares + SQR(helper.In.z));
|
||||
T s = std::sin(absV);
|
||||
T c = std::cos(absV);
|
||||
T sh = std::sinh(helper.In.x);
|
||||
@ -3732,7 +3732,7 @@ public:
|
||||
intmax_t varIndex = IndexInXform();
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
|
||||
<< "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / (precalcSumSquares + SQR(vIn.z));\n"
|
||||
<< "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSumSquares + SQR(vIn.z));\n"
|
||||
<< "\t\treal_t s = sin(absV);\n"
|
||||
<< "\t\treal_t c = cos(absV);\n"
|
||||
<< "\t\treal_t sh = sinh(vIn.x);\n"
|
||||
@ -4731,7 +4731,7 @@ public:
|
||||
if (r <= m_R1)
|
||||
{
|
||||
r *= m_R2 / m_R1;
|
||||
temp = atan2(helper.In.y, c1mx);
|
||||
temp = std::atan2(helper.In.y, c1mx);
|
||||
helper.Out.x = m_Weight * (r * std::cos(temp) - m_C2);
|
||||
helper.Out.y = m_Weight * r * std::sin(temp);
|
||||
}
|
||||
@ -4749,7 +4749,7 @@ public:
|
||||
if (r <= m_R2)
|
||||
{
|
||||
r *= m_R1 / m_R2;
|
||||
temp = atan2(helper.In.y, c1mx);
|
||||
temp = std::atan2(helper.In.y, c1mx);
|
||||
helper.Out.x = m_Weight * (r * std::cos(temp) + m_C1);
|
||||
helper.Out.y = m_Weight * r * std::sin(temp);
|
||||
}
|
||||
@ -5060,10 +5060,10 @@ public:
|
||||
T ymax = T(0.5) * (std::sqrt(tmp + y2) + std::sqrt(tmp - y2));
|
||||
T a = helper.In.x / Zeps(xmax);
|
||||
T b = VarFuncs<T>::SafeSqrt(1 - SQR(a));
|
||||
helper.Out.x = m_Vx * atan2(a, b) * r;
|
||||
helper.Out.x = m_Vx * std::atan2(a, b) * r;
|
||||
a = helper.In.y / Zeps(ymax);
|
||||
b = VarFuncs<T>::SafeSqrt(1 - SQR(a));
|
||||
helper.Out.y = m_Vy * atan2(a, b) * r;
|
||||
helper.Out.y = m_Vy * std::atan2(a, b) * r;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
|
@ -1086,8 +1086,8 @@ public:
|
||||
T uu = SQR(helper.In.x);
|
||||
T vv = SQR(helper.In.y);
|
||||
T ww = SQR(helper.In.z);
|
||||
T atOmegaX = atan2(vv, ww);
|
||||
T atOmegaY = atan2(uu, ww);
|
||||
T atOmegaX = std::atan2(vv, ww);
|
||||
T atOmegaY = std::atan2(uu, ww);
|
||||
T su = std::sin(helper.In.x);
|
||||
T cu = std::cos(helper.In.x);
|
||||
T sv = std::sin(helper.In.y);
|
||||
@ -1994,7 +1994,7 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T t = helper.m_PrecalcSumSquares + SQR(helper.In.z);
|
||||
T r = 1 / (std::sqrt(t) * (t + m_InvWeight));
|
||||
T r = 1 / Zeps(std::sqrt(t) * (t + m_InvWeight));
|
||||
T z = helper.In.z == 0 ? helper.m_PrecalcAtanyx : helper.In.z;
|
||||
helper.Out.x = helper.In.x * r;
|
||||
helper.Out.y = helper.In.y * r;
|
||||
@ -2010,7 +2010,7 @@ public:
|
||||
string invWeight = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t t = precalcSumSquares + SQR(vIn.z);\n"
|
||||
<< "\t\treal_t r = 1 / (sqrt(t) * (t + " << invWeight << "));\n"
|
||||
<< "\t\treal_t r = 1 / Zeps(sqrt(t) * (t + " << invWeight << "));\n"
|
||||
<< "\t\treal_t z = vIn.z == 0 ? precalcAtanyx : vIn.z;\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = vIn.x * r;\n"
|
||||
@ -2025,6 +2025,11 @@ public:
|
||||
m_InvWeight = 1 / Zeps(m_Weight);
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -2159,12 +2164,12 @@ public:
|
||||
if (offsetX >= 0)
|
||||
{
|
||||
helper.Out.x += m_Weight * (offsetX * T(0.5) + roundX + m_X);
|
||||
helper.Out.y += m_Weight * (offsetY * T(0.5) + roundY + m_Y * offsetY / offsetX);
|
||||
helper.Out.y += m_Weight * (offsetY * T(0.5) + roundY + m_Y * offsetY / Zeps(offsetX));
|
||||
}
|
||||
else
|
||||
{
|
||||
helper.Out.x += m_Weight * (offsetX * T(0.5) + roundX - m_Y);
|
||||
helper.Out.y += m_Weight * (offsetY * T(0.5) + roundY - m_Y * offsetY / offsetX);
|
||||
helper.Out.y += m_Weight * (offsetY * T(0.5) + roundY - m_Y * offsetY / Zeps(offsetX));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2172,12 +2177,12 @@ public:
|
||||
if (offsetY >= 0)
|
||||
{
|
||||
helper.Out.y += m_Weight * (offsetY * T(0.5) + roundY + m_Y);
|
||||
helper.Out.x += m_Weight * (offsetX * T(0.5) + roundX + offsetX / offsetY * m_Y);
|
||||
helper.Out.x += m_Weight * (offsetX * T(0.5) + roundX + offsetX / Zeps(offsetY) * m_Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
helper.Out.y += m_Weight * (offsetY * T(0.5) + roundY - m_Y);
|
||||
helper.Out.x += m_Weight * (offsetX * T(0.5) + roundX - offsetX / offsetY * m_X);
|
||||
helper.Out.x += m_Weight * (offsetX * T(0.5) + roundX - offsetX / Zeps(offsetY) * m_X);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2219,12 +2224,12 @@ public:
|
||||
<< "\t\t if (offsetX >= 0)\n"
|
||||
<< "\t\t {\n"
|
||||
<< "\t\t vOut.x += xform->m_VariationWeights[" << varIndex << "] * (offsetX * (real_t)(0.5) + roundX + " << x << ");\n"
|
||||
<< "\t\t vOut.y += xform->m_VariationWeights[" << varIndex << "] * (offsetY * (real_t)(0.5) + roundY + " << y << " * offsetY / offsetX);\n"
|
||||
<< "\t\t vOut.y += xform->m_VariationWeights[" << varIndex << "] * (offsetY * (real_t)(0.5) + roundY + " << y << " * offsetY / Zeps(offsetX));\n"
|
||||
<< "\t\t }\n"
|
||||
<< "\t\t else\n"
|
||||
<< "\t\t {\n"
|
||||
<< "\t\t vOut.x += xform->m_VariationWeights[" << varIndex << "] * (offsetX * (real_t)(0.5) + roundX - " << y << ");\n"
|
||||
<< "\t\t vOut.y += xform->m_VariationWeights[" << varIndex << "] * (offsetY * (real_t)(0.5) + roundY - " << y << " * offsetY / offsetX);\n"
|
||||
<< "\t\t vOut.y += xform->m_VariationWeights[" << varIndex << "] * (offsetY * (real_t)(0.5) + roundY - " << y << " * offsetY / Zeps(offsetX));\n"
|
||||
<< "\t\t }\n"
|
||||
<< "\t\t }\n"
|
||||
<< "\t\t else\n"
|
||||
@ -2232,12 +2237,12 @@ public:
|
||||
<< "\t\t if (offsetY >= 0)\n"
|
||||
<< "\t\t {\n"
|
||||
<< "\t\t vOut.y += xform->m_VariationWeights[" << varIndex << "] * (offsetY * (real_t)(0.5) + roundY + " << y << ");\n"
|
||||
<< "\t\t vOut.x += xform->m_VariationWeights[" << varIndex << "] * (offsetX * (real_t)(0.5) + roundX + offsetX / offsetY * " << y << ");\n"
|
||||
<< "\t\t vOut.x += xform->m_VariationWeights[" << varIndex << "] * (offsetX * (real_t)(0.5) + roundX + offsetX / Zeps(offsetY) * " << y << ");\n"
|
||||
<< "\t\t }\n"
|
||||
<< "\t\t else\n"
|
||||
<< "\t\t {\n"
|
||||
<< "\t\t vOut.y += xform->m_VariationWeights[" << varIndex << "] * (offsetY * (real_t)(0.5) + roundY - " << y << ");\n"
|
||||
<< "\t\t vOut.x += xform->m_VariationWeights[" << varIndex << "] * (offsetX * (real_t)(0.5) + roundX - offsetX / offsetY * " << x << ");\n"
|
||||
<< "\t\t vOut.x += xform->m_VariationWeights[" << varIndex << "] * (offsetX * (real_t)(0.5) + roundX - offsetX / Zeps(offsetY) * " << x << ");\n"
|
||||
<< "\t\t }\n"
|
||||
<< "\t\t }\n"
|
||||
<< "\t\t}\n"
|
||||
@ -2249,6 +2254,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -2360,9 +2370,9 @@ public:
|
||||
default:
|
||||
scale = Clamp<T>(rs, 0, T(0.9)) + T(0.1);
|
||||
denom = 1 / scale;
|
||||
helper.Out.x = m_Weight * Lerp<T>(helper.In.x, floor(helper.In.x * denom) + scale * ax, m_MulX * rs) + m_MulX * std::pow(ax, m_BoxPow) * rs * denom;//m_BoxPow should be an integer value held in T,
|
||||
helper.Out.y = m_Weight * Lerp<T>(helper.In.y, floor(helper.In.y * denom) + scale * ay, m_MulY * rs) + m_MulY * std::pow(ay, m_BoxPow) * rs * denom;//so std::abs() shouldn't be necessary.
|
||||
helper.Out.z = m_Weight * Lerp<T>(helper.In.z, floor(helper.In.z * denom) + scale * az, m_MulZ * rs) + m_MulZ * std::pow(az, m_BoxPow) * rs * denom;
|
||||
helper.Out.x = m_Weight * Lerp<T>(helper.In.x, std::floor(helper.In.x * denom) + scale * ax, m_MulX * rs) + m_MulX * std::pow(ax, m_BoxPow) * rs * denom;//m_BoxPow should be an integer value held in T,
|
||||
helper.Out.y = m_Weight * Lerp<T>(helper.In.y, std::floor(helper.In.y * denom) + scale * ay, m_MulY * rs) + m_MulY * std::pow(ay, m_BoxPow) * rs * denom;//so std::abs() shouldn't be necessary.
|
||||
helper.Out.z = m_Weight * Lerp<T>(helper.In.z, std::floor(helper.In.z * denom) + scale * az, m_MulZ * rs) + m_MulZ * std::pow(az, m_BoxPow) * rs * denom;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4131,7 +4141,7 @@ public:
|
||||
while (++n < 6)
|
||||
{
|
||||
if ((m_P[n].y <= i.y && i.y < m_P[j].y) || (m_P[j].y <= i.y && i.y < m_P[n].y))
|
||||
if (i.x < (m_P[j].x - m_P[n].x) * (i.y - m_P[n].y) / (m_P[j].y - m_P[n].y) + m_P[n].x)
|
||||
if (i.x < (m_P[j].x - m_P[n].x) * (i.y - m_P[n].y) / Zeps(m_P[j].y - m_P[n].y) + m_P[n].x)
|
||||
c ^= 1;
|
||||
|
||||
j = n;
|
||||
@ -4182,7 +4192,7 @@ public:
|
||||
<< "\t\t int ynoff = " << pyStartIndex << " + n;\n"
|
||||
<< "\n"
|
||||
<< "\t\t if ((parVars[ynoff] <= i.y && i.y < parVars[yjoff]) || (parVars[yjoff] <= i.y && i.y < parVars[ynoff]))\n"
|
||||
<< "\t\t if (i.x < (parVars[xjoff] - parVars[xnoff]) * (i.y - parVars[ynoff]) / (parVars[yjoff] - parVars[ynoff]) + parVars[xnoff])\n"
|
||||
<< "\t\t if (i.x < (parVars[xjoff] - parVars[xnoff]) * (i.y - parVars[ynoff]) / Zeps(parVars[yjoff] - parVars[ynoff]) + parVars[xnoff])\n"
|
||||
<< "\t\t c ^= 1;\n"
|
||||
<< "\n"
|
||||
<< "\t\t j = n;\n"
|
||||
@ -4226,6 +4236,11 @@ public:
|
||||
m_P[5].y = T(0.0000000000000000000000000000000) * m_ScaleY;
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
|
@ -783,9 +783,9 @@ public:
|
||||
if (m_AdjustToLinear == 1)
|
||||
{
|
||||
if (int(m_NumEdges) % 4 == 0)
|
||||
m_AdjustedWeight = m_Weight / (std::sqrt(2 - 2 * std::cos(m_MidAngle * (m_NumEdges / 2 - 1))) / 2);
|
||||
m_AdjustedWeight = m_Weight / Zeps(std::sqrt(2 - 2 * std::cos(m_MidAngle * (m_NumEdges / 2 - 1))) / 2);
|
||||
else
|
||||
m_AdjustedWeight = m_Weight / (std::sqrt(2 - 2 * std::cos(m_MidAngle * std::floor((m_NumEdges / 2)))) / 2);
|
||||
m_AdjustedWeight = m_Weight / Zeps(std::sqrt(2 - 2 * std::cos(m_MidAngle * std::floor((m_NumEdges / 2)))) / 2);
|
||||
}
|
||||
else
|
||||
m_AdjustedWeight = m_Weight;
|
||||
@ -1515,7 +1515,7 @@ public:
|
||||
yTmp = m_Top + rand.Frand01<T>() * m_YInt2;
|
||||
xTmp = m_Right - pow(rand.Frand01<T>(), m_DirectBlur) * m_RatioBlur * m_MinInt2;
|
||||
}
|
||||
while ((yTmp - m_Y0c) / (xTmp - m_X0c) < -1);
|
||||
while ((yTmp - m_Y0c) / Zeps(xTmp - m_X0c) < -1);
|
||||
|
||||
if (secTmp < m_SetProbH)
|
||||
xTmp = m_Left + m_Right - xTmp;
|
||||
@ -1529,7 +1529,7 @@ public:
|
||||
{
|
||||
xTmp = m_Right - rand.Frand01<T>() * m_XInt2;
|
||||
yTmp = m_Top + std::pow(rand.Frand01<T>(), m_DirectBlur) * m_RatioBlur * m_MinInt2;
|
||||
gradTmp = (yTmp - m_Y0c) / (xTmp - m_X0c);
|
||||
gradTmp = (yTmp - m_Y0c) / Zeps(xTmp - m_X0c);
|
||||
}
|
||||
while ((gradTmp <= 0) && (gradTmp > -1));
|
||||
|
||||
@ -1614,7 +1614,7 @@ public:
|
||||
<< "\t\t {\n"
|
||||
<< "\t\t yTmp = " << top << " + MwcNext01(mwc) * " << yInt2 << ";\n"
|
||||
<< "\t\t xTmp = " << right << " - pow(MwcNext01(mwc), " << directBlur << ") * " << ratioBlur << " * " << minInt2 << ";\n"
|
||||
<< "\t\t } while ((yTmp - " << y0c << ") / (xTmp - " << x0c << ") < -1);\n"
|
||||
<< "\t\t } while ((yTmp - " << y0c << ") / Zeps(xTmp - " << x0c << ") < -1);\n"
|
||||
<< "\n"
|
||||
<< "\t\t if (secTmp < " << setProbH << ")\n"
|
||||
<< "\t\t xTmp = " << left << " + " << right << " - xTmp;\n"
|
||||
@ -1628,7 +1628,7 @@ public:
|
||||
<< "\t\t {\n"
|
||||
<< "\t\t xTmp = " << right << " - MwcNext01(mwc) * " << xInt2 << ";\n"
|
||||
<< "\t\t yTmp = " << top << " + pow(MwcNext01(mwc), " << directBlur << ") * " << ratioBlur << " * " << minInt2 << ";\n"
|
||||
<< "\t\t gradTmp = (yTmp - " << y0c << ") / (xTmp - " << x0c << ");\n"
|
||||
<< "\t\t gradTmp = (yTmp - " << y0c << ") / Zeps(xTmp - " << x0c << ");\n"
|
||||
<< "\t\t } while ((gradTmp <= 0) && (gradTmp > -1));\n"
|
||||
<< "\n"
|
||||
<< "\t\t if (secTmp > " << setProbH << ")\n"
|
||||
@ -1737,6 +1737,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
|
@ -957,7 +957,7 @@ template <typename T>
|
||||
class CircleSplitVariation : public ParametricVariation<T>
|
||||
{
|
||||
public:
|
||||
CircleSplitVariation(T weight = 1.0) : ParametricVariation<T>("circlesplit", eVariationId::VAR_CIRCLESPLIT, weight, true, true)
|
||||
CircleSplitVariation(T weight = 1.0) : ParametricVariation<T>("circlesplit", eVariationId::VAR_CIRCLESPLIT, weight, true, true, false, false, true)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
@ -975,7 +975,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
T a = std::atan2(helper.In.y, helper.In.x);
|
||||
T a = helper.m_PrecalcAtanyx;
|
||||
T len = helper.m_PrecalcSqrtSumSquares + m_Split;
|
||||
x1 = std::cos(a) * len;
|
||||
y1 = std::sin(a) * len;
|
||||
@ -983,6 +983,7 @@ public:
|
||||
|
||||
helper.Out.x = m_Weight * x1;
|
||||
helper.Out.y = m_Weight * y1;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
@ -1003,13 +1004,14 @@ public:
|
||||
<< "\t\t}\n"
|
||||
<< "\t\telse\n"
|
||||
<< "\t\t{\n"
|
||||
<< "\t\t\treal_t a = (real_t)atan2(vIn.y, vIn.x);\n"
|
||||
<< "\t\t\treal_t a = precalcAtanyx;\n"
|
||||
<< "\t\t\treal_t len = precalcSqrtSumSquares + " << cs_split << ";\n"
|
||||
<< "\t\t\tx1 = cos(a) * len;\n"
|
||||
<< "\t\t\ty1 = sin(a) * len;\n"
|
||||
<< "\t\t}"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * x1;\n"
|
||||
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * y1;\n"
|
||||
<< "\t\tvOut.z = " << DefaultZCl()
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
@ -1045,6 +1047,7 @@ public:
|
||||
{
|
||||
helper.Out.x = m_Weight * (helper.In.x / Zeps(std::sqrt(SQR(helper.In.x) + 1)));
|
||||
helper.Out.y = m_Weight * helper.In.y;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
@ -1055,6 +1058,7 @@ public:
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x / Zeps(sqrt(SQR(vIn.x) + (real_t)1.0)));\n"
|
||||
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n"
|
||||
<< "\t\tvOut.z = " << DefaultZCl()
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
@ -1086,6 +1090,7 @@ public:
|
||||
T temp = Round(std::log(rand.Frand01<T>()) * (rand.Rand() & 1 ? m_Spread : -m_Spread));
|
||||
helper.Out.x = m_Weight * (helper.In.x + temp);
|
||||
helper.Out.y = m_Weight * helper.In.y;
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
@ -1100,6 +1105,7 @@ public:
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x + temp);\n"
|
||||
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n"
|
||||
<< "\t\tvOut.z = " << DefaultZCl()
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
@ -1341,7 +1347,7 @@ public:
|
||||
m_FinalExponent = m_Exponent > T(2) ? T(2) : (m_Exponent < T(0.001) ? T(0.001) : m_Exponent);
|
||||
m_OneOverEx = T(1) / m_FinalExponent;
|
||||
m_Width = m_ArcWidth > T(1) ? T(1) : (m_ArcWidth < T(0.001) ? T(0.001) : m_ArcWidth);
|
||||
m_Seed2 = std::sqrt(m_Seed * T(1.5)) / (m_Seed * T(0.5)) * T(0.25);
|
||||
m_Seed2 = std::sqrt(m_Seed * T(1.5)) / Zeps(m_Seed * T(0.5)) * T(0.25);
|
||||
m_Rmax = T(0.5) * (std::pow(T(2), m_OneOverEx) - T(1)) * m_Width;
|
||||
m_Scale = T(1) / m_Weight;
|
||||
}
|
||||
|
@ -866,10 +866,10 @@ public:
|
||||
}
|
||||
|
||||
if (m_NeedPrecalcAtanXY)
|
||||
helper.m_PrecalcAtanxy = atan2(helper.m_TransX, helper.m_TransY);
|
||||
helper.m_PrecalcAtanxy = std::atan2(helper.m_TransX, helper.m_TransY);
|
||||
|
||||
if (m_NeedPrecalcAtanYX)
|
||||
helper.m_PrecalcAtanyx = atan2(helper.m_TransY, helper.m_TransX);
|
||||
helper.m_PrecalcAtanyx = std::atan2(helper.m_TransY, helper.m_TransX);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user