Explicitly namespace calls to sqrt and isnan

osx/linux have alternative top-level implementations of these methods, so the calls are ambiguous given the  - so these should be used explicitly
This commit is contained in:
Simon Detheridge 2015-04-13 12:32:58 +01:00
parent 0a5a492ab6
commit 63b8a3134d
14 changed files with 107 additions and 107 deletions

View File

@ -232,7 +232,7 @@ private:
denom = (w->x * s3) + (w->y * s2 * 3 * t) + (w->z * s * 3 * t2) + (w->w * t3);
if (isnan(nom_x) || isnan(nom_y) || isnan(denom) || denom == 0)
if (std::isnan(nom_x) || std::isnan(nom_y) || std::isnan(denom) || denom == 0)
return;
solution.x = nom_x / denom;

View File

@ -185,7 +185,7 @@ public:
{
for (dek = -m_FilterWidth; dek <= m_FilterWidth; dek++)
{
filterVal = sqrt(T(dej * dej + dek * dek)) / filterHeight;
filterVal = std::sqrt(T(dej * dej + dek * dek)) / filterHeight;
//Only populate the coefs within this radius.
if (filterVal <= 1.0)
@ -200,7 +200,7 @@ public:
{
for (dek = 0; dek <= dej; dek++)
{
filterVal = sqrt(T(dej * dej + dek * dek)) / filterHeight;
filterVal = std::sqrt(T(dej * dej + dek * dek)) / filterHeight;
//Only populate the coefs within this radius.
if (filterVal > 1.0)

View File

@ -634,7 +634,7 @@ public:
}
cxAng[k][col] = atan2(c1[1], c1[0]);
cxMag[k][col] = sqrt(c1[0] * c1[0] + c1[1] * c1[1]);
cxMag[k][col] = std::sqrt(c1[0] * c1[0] + c1[1] * c1[1]);
if (cxMag[k][col] == 0)
zlm[col] = 1;

View File

@ -868,7 +868,7 @@ public:
//Scale the image so that the total number of pixels is ~10,000.
pixTotal = ember.m_FinalRasW * ember.m_FinalRasH;
scalar = sqrt(T(10000) / pixTotal);
scalar = std::sqrt(T(10000) / pixTotal);
adjustedEmber.m_FinalRasW = static_cast<size_t>(ember.m_FinalRasW * scalar);
adjustedEmber.m_FinalRasH = static_cast<size_t>(ember.m_FinalRasH * scalar);
adjustedEmber.m_PixelsPerUnit *= scalar;

View File

@ -269,7 +269,7 @@ public:
/// <returns>The filtered value</returns>
virtual T Filter(T t) const
{
return exp(-2 * t * t) * sqrt(2 / T(M_PI));
return exp(-2 * t * t) * std::sqrt(2 / T(M_PI));
}
};

View File

@ -518,7 +518,7 @@ static inline T SafeSqrt(T x)
if (x <= 0)
return 0;
return sqrt(x);
return std::sqrt(x);
}
template <typename T>
@ -567,7 +567,7 @@ static inline T Cube(T t)
template <typename T>
static inline T Hypot(T x, T y)
{
return sqrt(SQR(x) + SQR(y));
return std::sqrt(SQR(x) + SQR(y));
}
/// <summary>

View File

@ -1110,7 +1110,7 @@ public:
if (m_NeedPrecalcSqrtSumSquares)
{
iteratorHelper.m_PrecalcSqrtSumSquares = sqrt(iteratorHelper.m_PrecalcSumSquares);
iteratorHelper.m_PrecalcSqrtSumSquares = std::sqrt(iteratorHelper.m_PrecalcSumSquares);
if (m_NeedPrecalcAngles)
{
@ -1134,7 +1134,7 @@ public:
if (m_NeedPrecalcSqrtSumSquares)
{
iteratorHelper.m_PrecalcSqrtSumSquares = sqrt(iteratorHelper.m_PrecalcSumSquares);
iteratorHelper.m_PrecalcSqrtSumSquares = std::sqrt(iteratorHelper.m_PrecalcSumSquares);
if (m_NeedPrecalcAngles)
{

View File

@ -213,7 +213,7 @@ public:
/// <summary>
/// Polar:
/// nx = atan2(tx, ty) / M_PI;
/// ny = sqrt(tx * tx + ty * ty) - 1.0;
/// ny = std::sqrt(tx * tx + ty * ty) - 1.0;
/// p[0] += weight * nx;
/// p[1] += weight * ny;
/// </summary>
@ -250,7 +250,7 @@ public:
/// <summary>
/// Handkerchief:
/// a = atan2(tx, ty);
/// r = sqrt(tx * tx + ty * ty);
/// r = std::sqrt(tx * tx + ty * ty);
/// p[0] += weight * sin(a + r) * r;
/// p[1] += weight * cos(a - r) * r;
/// </summary>
@ -287,7 +287,7 @@ public:
/// <summary>
/// Heart:
/// a = atan2(tx, ty);
/// r = sqrt(tx * tx + ty * ty);
/// r = std::sqrt(tx * tx + ty * ty);
/// a *= r;
/// p[0] += weight * sin(a) * r;
/// p[1] += weight * cos(a) * -r;
@ -333,7 +333,7 @@ public:
/// nx = tx * M_PI;
/// ny = ty * M_PI;
/// a = atan2(nx, ny);
/// r = sqrt(nx * nx + ny * ny);
/// r = std::sqrt(nx * nx + ny * ny);
/// p[0] += weight * sin(r) * a / M_PI;
/// p[1] += weight * cos(r) * a / M_PI;
/// </summary>
@ -399,7 +399,7 @@ private:
/// <summary>
/// Spiral:
/// a = atan2(tx, ty);
/// r = sqrt(tx * tx + ty * ty) + 1e-6;
/// r = std::sqrt(tx * tx + ty * ty) + 1e-6;
/// p[0] += weight * (cos(a) + sin(r)) / r;
/// p[1] += weight * (sin(a) - cos(r)) / r;
/// </summary>
@ -442,7 +442,7 @@ public:
/// <summary>
/// Hyperbolic:
/// a = atan2(tx, ty);
/// r = sqrt(tx * tx + ty * ty) + 1e-6;
/// r = std::sqrt(tx * tx + ty * ty) + 1e-6;
/// p[0] += weight * sin(a) / r;
/// p[1] += weight * cos(a) * r;
/// </summary>
@ -483,7 +483,7 @@ public:
/// <summary>
/// Diamond:
/// a = atan2(tx, ty);
/// r = sqrt(tx * tx + ty * ty);
/// r = std::sqrt(tx * tx + ty * ty);
/// p[0] += weight * sin(a) * cos(r);
/// p[1] += weight * cos(a) * sin(r);
/// </summary>
@ -520,7 +520,7 @@ public:
/// <summary>
/// Ex:
/// a = atan2(tx, ty);
/// r = sqrt(tx * tx + ty * ty);
/// r = std::sqrt(tx * tx + ty * ty);
/// n0 = sin(a + r);
/// n1 = cos(a - r);
/// m0 = n0 * n0 * n0 * r;
@ -592,7 +592,7 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T r = m_Weight * sqrt(helper.m_PrecalcSqrtSumSquares);
T r = m_Weight * std::sqrt(helper.m_PrecalcSqrtSumSquares);
T a = T(0.5) * helper.m_PrecalcAtanxy;
if (rand.RandBit())
@ -755,7 +755,7 @@ private:
/// <summary>
/// Fisheye:
/// a = atan2(tx, ty);
/// r = sqrt(tx * tx + ty * ty);
/// r = std::sqrt(tx * tx + ty * ty);
/// r = 2 * r / (r + 1);
/// nx = r * cos(a);
/// ny = r * sin(a);
@ -894,7 +894,7 @@ public:
/// Power:
/// a = atan2(tx, ty);
/// sa = sin(a);
/// r = sqrt(tx * tx + ty * ty);
/// r = std::sqrt(tx * tx + ty * ty);
/// r = pow(r, sa);
/// nx = r * precalc_cosa;
/// ny = r * sa;
@ -984,7 +984,7 @@ public:
/// Rings:
/// dx = coef[2][0];
/// dx = dx * dx + EPS;
/// r = sqrt(tx * tx + ty * ty);
/// r = std::sqrt(tx * tx + ty * ty);
/// r = fmod(r + dx, 2 * dx) - dx + r * (1 - dx);
/// a = atan2(tx, ty);
/// nx = cos(a) * r;
@ -1037,7 +1037,7 @@ public:
/// dx = M_PI * (dx * dx + EPS);
/// dx2 = dx / 2;
/// a = atan(tx, ty);
/// r = sqrt(tx * tx + ty * ty);
/// r = std::sqrt(tx * tx + ty * ty);
/// a += (fmod(a + dy, dx) > dx2) ? -dx2 : dx2;
/// nx = cos(a) * r;
/// ny = sin(a) * r;
@ -1090,7 +1090,7 @@ public:
/// <summary>
/// Blob:
/// a = atan2(tx, ty);
/// r = sqrt(tx * tx + ty * ty);
/// r = std::sqrt(tx * tx + ty * ty);
/// r = r * (bloblow + (blobhigh - bloblow) * (0.5 + 0.5 * sin(blobwaves * a)));
/// nx = sin(a) * r;
/// ny = cos(a) * r;
@ -3473,7 +3473,7 @@ public:
{
T wx = m_Weight * T(1.3029400317411197908970256609023);//This precision came from the original.
T y2 = helper.In.y * 2;
T r = wx * sqrt(fabs(helper.In.y * helper.In.x) / Zeps(SQR(helper.In.x) + SQR(y2)));
T r = wx * std::sqrt(fabs(helper.In.y * helper.In.x) / Zeps(SQR(helper.In.x) + SQR(y2)));
helper.Out.x = r * helper.In.x;
helper.Out.y = r * y2;
@ -3827,10 +3827,10 @@ public:
{
T tmp = helper.m_PrecalcSumSquares + 1;
T tmp2 = 2 * helper.In.x;
T r1 = sqrt(tmp + tmp2);
T r2 = sqrt(tmp - tmp2);
T r1 = std::sqrt(tmp + tmp2);
T r2 = std::sqrt(tmp - tmp2);
T xmax = (r1 + r2) * T(0.5);
T a1 = log(xmax + sqrt(xmax - 1));
T a1 = log(xmax + std::sqrt(xmax - 1));
T a2 = -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;
@ -3897,7 +3897,7 @@ public:
{
T tmp = helper.m_PrecalcSumSquares + 1;
T x2 = 2 * helper.In.x;
T xmax = T(0.5) * (sqrt(tmp + x2) + sqrt(tmp - x2));
T xmax = T(0.5) * (std::sqrt(tmp + x2) + std::sqrt(tmp - x2));
T a = helper.In.x / xmax;
T b = 1 - a * a;
T ssx = xmax - 1;
@ -3906,12 +3906,12 @@ public:
if (b < 0)
b = 0;
else
b = sqrt(b);
b = std::sqrt(b);
if (ssx < 0)
ssx = 0;
else
ssx = sqrt(ssx);
ssx = std::sqrt(ssx);
helper.Out.x = w * atan2(a, b);
@ -4139,7 +4139,7 @@ public:
{
T x = helper.In.x - m_X;
T y = helper.In.y + m_Y;
T r = sqrt(x * x + y * y);
T r = std::sqrt(x * x + y * y);
if (r < m_Weight)
{
@ -4257,7 +4257,7 @@ public:
{
if (helper.m_PrecalcSumSquares < m_W2 && helper.m_PrecalcSumSquares != 0)
{
T r = m_Weight * sqrt((m_W2 / helper.m_PrecalcSumSquares) - 1);
T r = m_Weight * std::sqrt((m_W2 / helper.m_PrecalcSumSquares) - 1);
helper.Out.x = r * helper.In.x;
helper.Out.y = r * helper.In.y;
@ -4726,14 +4726,14 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
if (helper.In.x > 0.0)
helper.Out.x = m_Weight * (sqrt(SQR(helper.In.x) + m_XX) - helper.In.x * m_XInside);
helper.Out.x = m_Weight * (std::sqrt(SQR(helper.In.x) + m_XX) - helper.In.x * m_XInside);
else
helper.Out.x = -(m_Weight * (sqrt(SQR(helper.In.x) + m_XX) + helper.In.x * m_XInside));
helper.Out.x = -(m_Weight * (std::sqrt(SQR(helper.In.x) + m_XX) + helper.In.x * m_XInside));
if (helper.In.y > 0.0)
helper.Out.y = m_Weight * (sqrt(SQR(helper.In.y) + m_YY) - helper.In.y * m_YInside);
helper.Out.y = m_Weight * (std::sqrt(SQR(helper.In.y) + m_YY) - helper.In.y * m_YInside);
else
helper.Out.y = -(m_Weight * (sqrt(SQR(helper.In.y) + m_YY) + helper.In.y * m_YInside));
helper.Out.y = -(m_Weight * (std::sqrt(SQR(helper.In.y) + m_YY) + helper.In.y * m_YInside));
helper.Out.z = m_Weight * helper.In.z;
}
@ -6158,12 +6158,12 @@ public:
T xpw = helper.In.x + m_Weight;
T xmw = helper.In.x - m_Weight;
T yy = SQR(helper.In.y);
T frac = sqrt(yy + SQR(xmw));
T frac = std::sqrt(yy + SQR(xmw));
if (frac == 0)
frac = 1;
T avgr = m_Weight * (m_Spr * sqrt(sqrt(yy + SQR(xpw)) / frac));
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);
helper.Out.x = avgr * cos(avga);

View File

@ -17,7 +17,7 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T t = m_Weight / sqrt(helper.m_PrecalcSumSquares + 1);
T t = m_Weight / std::sqrt(helper.m_PrecalcSumSquares + 1);
helper.Out.x = helper.In.x * t;
helper.Out.y = helper.In.y * t;
@ -705,7 +705,7 @@ public:
T x = helper.In.x * m_Scale;
T y = helper.In.y * m_Scale;
T r = sqrt(SQR(x) + SQR(y));
T r = std::sqrt(SQR(x) + SQR(y));
if (r <= 1)
{
@ -1519,7 +1519,7 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T r = m_Weight * sqrt(helper.m_PrecalcSumSquares + sin(helper.m_PrecalcAtanyx * m_A) + 1);
T r = m_Weight * std::sqrt(helper.m_PrecalcSumSquares + sin(helper.m_PrecalcAtanyx * m_A) + 1);
helper.Out.x = r * helper.m_PrecalcCosa;
helper.Out.y = r * helper.m_PrecalcSina;
@ -2016,7 +2016,7 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T s, c;
T avgr = m_Weight * (sqrt(SQR(helper.In.y) + SQR(helper.In.x + 1)) / sqrt(SQR(helper.In.y) + SQR(helper.In.x - 1)));
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;
sincos(avga, &s, &c);
@ -2435,14 +2435,14 @@ public:
{
if (rand.Frand01<T>() > T(0.5))
{
d = sqrt(r + helper.In.x);
d = std::sqrt(r + helper.In.x);
helper.Out.x = m_V2 * d;
helper.Out.y = -(m_V2 / d * helper.In.y);
}
else
{
d = r + helper.In.x;
r = m_Weight / sqrt(r * (SQR(helper.In.y) + SQR(d)));
r = m_Weight / std::sqrt(r * (SQR(helper.In.y) + SQR(d)));
helper.Out.x = r * d;
helper.Out.y = r * helper.In.y;
}
@ -2451,14 +2451,14 @@ public:
{
if (rand.Frand01<T>() > T(0.5))
{
d = sqrt(r + helper.In.x);
d = std::sqrt(r + helper.In.x);
helper.Out.x = -(m_V2 * d);
helper.Out.y = -(m_V2 / d * helper.In.y);
}
else
{
d = r + helper.In.x;
r = m_Weight / sqrt(r * (SQR(helper.In.y) + SQR(d)));
r = m_Weight / std::sqrt(r * (SQR(helper.In.y) + SQR(d)));
helper.Out.x = -(r * d);
helper.Out.y = r * helper.In.y;
}
@ -2519,7 +2519,7 @@ public:
virtual void Precalc() override
{
m_V2 = m_Weight * sqrt(T(2)) / 2;
m_V2 = m_Weight * std::sqrt(T(2)) / 2;
}
protected:
@ -2818,7 +2818,7 @@ public:
T a = m_N * pa;
if (r > 0)
r = 1 / sqrt(r);
r = 1 / std::sqrt(r);
else
r = 1;
@ -2916,7 +2916,7 @@ public:
(cos(2 * T(M_PI) / m_P) + cos(2 * T(M_PI) / m_Q));
if (r2 > 0)
m_R = 1 / sqrt(r2);
m_R = 1 / std::sqrt(r2);
else
m_R = 1;
@ -3011,7 +3011,7 @@ public:
(cos(2 * T(M_PI) / m_P) + cos(2 * T(M_PI) / m_Q));
if (r2 > 0)
m_R = 1 / sqrt(r2);
m_R = 1 / std::sqrt(r2);
else
m_R = 1;
@ -3105,7 +3105,7 @@ public:
T na = m_N * pa;
if (r > 0)
r = 1 / sqrt(1 + r);
r = 1 / std::sqrt(1 + r);
else
r = 1;
@ -3226,7 +3226,7 @@ public:
T r = -(cos(pa) - 1) / (cos(pa) + cos(qa));
if (r > 0)
r = 1 / sqrt(1 + r);
r = 1 / std::sqrt(1 + r);
else
r = 1;
@ -3330,7 +3330,7 @@ public:
T r = -(cos(pa) - 1) / (cos(pa) + cos(qa));
if (r > 0)
r = 1 / sqrt(1 + r);
r = 1 / std::sqrt(1 + r);
else
r = 1;
@ -3949,7 +3949,7 @@ public:
if (helper.In.x >= 0)
{
xo = (r + 1) / (2 * helper.In.x);
ro = sqrt(SQR(helper.In.x - xo) + SQR(helper.In.y));
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;
sincos(a, &s, &c);
@ -3960,7 +3960,7 @@ public:
else
{
xo = - (r + 1) / (2 * helper.In.x);
ro = sqrt(SQR(-helper.In.x - xo) + SQR(helper.In.y));
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;
sincos(a, &s, &c);
@ -3971,7 +3971,7 @@ public:
}
else
{
r = 1 / sqrt(r);
r = 1 / std::sqrt(r);
ts = sin(helper.m_PrecalcAtanyx);
tc = cos(helper.m_PrecalcAtanyx);
x = r * tc;
@ -3980,7 +3980,7 @@ public:
if (x >= 0)
{
xo = (SQR(x) + SQR(y) + 1) / (2 * x);
ro = sqrt(SQR(x - xo) + SQR(y));
ro = std::sqrt(SQR(x - xo) + SQR(y));
theta = atan2(T(1), ro);
a = fmod(m_Out * theta + atan2(y, xo - x) + theta, 2 * theta) - theta;
sincos(a, &s, &c);
@ -3989,7 +3989,7 @@ public:
y = s * ro;
theta = atan2(y, x);
sincos(theta, &ts, &tc);
r = 1 / sqrt(SQR(x) + SQR(y));
r = 1 / std::sqrt(SQR(x) + SQR(y));
helper.Out.x = m_Weight * r * tc;
helper.Out.y = m_Weight * r * ts;
@ -3997,7 +3997,7 @@ public:
else
{
xo = - (SQR(x) + SQR(y) + 1) / (2 * x);
ro = sqrt(SQR(-x - xo) + SQR(y));
ro = std::sqrt(SQR(-x - xo) + SQR(y));
theta = atan2(T(1), ro);
a = fmod(m_Out * theta + atan2(y, xo + x) + theta, 2 * theta) - theta;
sincos(a, &s, &c);
@ -4006,7 +4006,7 @@ public:
y = s * ro;
theta = atan2(y, x);
sincos(theta, &ts, &tc);
r = 1 / sqrt(SQR(x) + SQR(y));
r = 1 / std::sqrt(SQR(x) + SQR(y));
helper.Out.x = -(m_Weight * r * tc);
helper.Out.y = m_Weight * r * ts;
@ -4186,8 +4186,8 @@ public:
virtual void Precalc() override
{
m_C1d = sqrt(1 + SQR(m_C1r));
m_C2d = sqrt(1 + SQR(m_C2r));
m_C1d = std::sqrt(1 + SQR(m_C1r));
m_C2d = std::sqrt(1 + SQR(m_C2r));
m_C1x = m_C1d * cos(fmod(m_C1a, T(M_PI)));
m_C1y = m_C1d * sin(fmod(m_C1a, T(M_PI)));
@ -4610,7 +4610,7 @@ public:
T y = (helper.In.y * m_S) + m_CenterY;
//Calculate distance from center but constrain it to EPS.
T d = std::max(EPS, sqrt(SQR(x) * SQR(y)));
T d = std::max(EPS, std::sqrt(SQR(x) * SQR(y)));
//Normalize x and y.
T nx = x / d;
@ -5393,8 +5393,8 @@ public:
T v = (dot00 * dot12 - dot01 * dot02) * invDenom;
// now combine with input
T um = sqrt(SQR(u) + SQR(helper.In.x)) * Sign<T>(u);
T vm = sqrt(SQR(v) + SQR(helper.In.y)) * Sign<T>(v);
T um = std::sqrt(SQR(u) + SQR(helper.In.x)) * Sign<T>(u);
T vm = std::sqrt(SQR(v) + SQR(helper.In.y)) * Sign<T>(v);
helper.Out.x = m_Weight * um;
helper.Out.y = m_Weight * vm;

View File

@ -185,7 +185,7 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T u = sqrt(ClampGte0<T>(Zeps(m_A) * SQR(helper.In.x) + Zeps(m_B) * SQR(helper.In.y)));//Original did not clamp.
T u = std::sqrt(ClampGte0<T>(Zeps(m_A) * SQR(helper.In.x) + Zeps(m_B) * SQR(helper.In.y)));//Original did not clamp.
helper.Out.x = cos(u) * SafeTan<T>(helper.In.x) * m_Weight;
helper.Out.y = sin(u) * SafeTan<T>(helper.In.y) * m_Weight;
@ -928,14 +928,14 @@ public:
f -= angle;
T x = f * m_Length;
T z = sqrt(1 + SQR(x) - 2 * x * cos(m_Alpha));
T z = std::sqrt(1 + SQR(x) - 2 * x * cos(m_Alpha));
if (int(angle) % 2)
angle = M_2PI / m_Power * (int(angle) / 2) + asin(sin(m_Alpha) * x / z);
else
angle = M_2PI / m_Power * (int(angle) / 2) - asin(sin(m_Alpha) * x / z);
z *= sqrt(rand.Frand01<T>());
z *= std::sqrt(rand.Frand01<T>());
T temp = angle - T(M_PI_2);
@ -984,7 +984,7 @@ public:
virtual void Precalc() override
{
m_Alpha = T(M_PI) / m_Power;
m_Length = sqrt(1 + SQR(m_Range) - 2 * m_Range * cos(m_Alpha));
m_Length = std::sqrt(1 + SQR(m_Range) - 2 * m_Range * cos(m_Alpha));
m_Alpha = asin(sin(m_Alpha) * m_Range / m_Length);
}
@ -1081,7 +1081,7 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T rad = sqrt(rand.Frand01<T>());
T rad = std::sqrt(rand.Frand01<T>());
T temp = rand.Frand01<T>() * M_2PI;
helper.Out.x = m_Weight * cos(temp) * rad;
@ -2588,7 +2588,7 @@ public:
y = (imU * reV - reU * imV) / radV;
z = 1 / z;
r = pow(sqrt(SQR(x) + SQR(y)), z);
r = pow(std::sqrt(SQR(x) + SQR(y)), z);
n = Floor<T>(m_Power * rand.Frand01<T>());
alpha = (atan2(y, x) + n * M_2PI) / Floor<T>(m_Power);
@ -3637,7 +3637,7 @@ public:
if (fabs(helper.In.y) <= m_Weight)
{
c2 = sqrt(SQR(m_Weight) - SQR(helper.In.y));
c2 = std::sqrt(SQR(m_Weight) - SQR(helper.In.y));
if (fabs(helper.In.x) <= c2)
{
@ -3877,7 +3877,7 @@ public:
}
helper.Out.x = m_Weight * xmax * cos(nu);
helper.Out.y = m_Weight * sqrt(xmax - 1) * sqrt(xmax + 1) * sin(nu);
helper.Out.y = m_Weight * std::sqrt(xmax - 1) * std::sqrt(xmax + 1) * sin(nu);
helper.Out.z = m_Weight * helper.In.z;
}
@ -4403,7 +4403,7 @@ public:
nu = fmod(nu + m_Rotate + T(M_PI), M_2PI) - T(M_PI);
helper.Out.x = m_Weight * xmax * cos(nu);
helper.Out.y = m_Weight * sqrt(xmax - 1) * sqrt(xmax + 1) * sin(nu);
helper.Out.y = m_Weight * std::sqrt(xmax - 1) * std::sqrt(xmax + 1) * sin(nu);
helper.Out.z = m_Weight * helper.In.z;
}

View File

@ -1150,7 +1150,7 @@ public:
{
T sx = helper.In.x - m_CenterX;
T sy = helper.In.y - m_CenterY;
T r = sqrt(SQR(sx) + SQR(sy)) - m_Offset;
T r = std::sqrt(SQR(sx) + SQR(sy)) - m_Offset;
r = r < 0 ? 0 : r;
r *= m_S2;
@ -1394,7 +1394,7 @@ public:
y = T(DiscreteNoise(int(l + 21 * m1 + 33 * n1 + m_YSeed)) + n1) * m_Step;
offsetX = helper.In.x - x;
offsetY = helper.In.y - y;
r = sqrt(SQR(offsetX) + SQR(offsetY));
r = std::sqrt(SQR(offsetX) + SQR(offsetY));
if (r < rMin)
{
@ -1985,7 +1985,7 @@ public:
T xi = helper.In.x - m_X;//Original altered the input pointed to for reg, but not for pre/post. Don't do that here.
T yi = helper.In.y - m_Y;
const T rad = sqrt(SQR(xi) + SQR(yi));
const T rad = std::sqrt(SQR(xi) + SQR(yi));
const T ang = atan2(yi, xi);
const T rdc = m_Radius + (rand.Frand01<T>() * T(0.5) * m_Ca);
const T s = sin(ang);
@ -2242,7 +2242,7 @@ public:
if (r2 < m_SqrWeight)
{
T r = m_Weight * sqrt(m_SqrWeight / r2 - 1);
T r = m_Weight * std::sqrt(m_SqrWeight / r2 - 1);
helper.Out.x = r * helper.In.x;
helper.Out.y = r * helper.In.y;
@ -2257,7 +2257,7 @@ public:
{
T x = helper.In.x - m_X;
T y = helper.In.y + m_Y;
T r = sqrt(SQR(x) + SQR(y));
T r = std::sqrt(SQR(x) + SQR(y));
if (r < m_Weight)
{
@ -2807,7 +2807,7 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T r = sqrt(fabs(helper.m_PrecalcSumSquares + helper.In.z));
T r = std::sqrt(fabs(helper.m_PrecalcSumSquares + helper.In.z));
r += m_Ar * sin(fma(m_Br, r, m_Cr));
@ -3351,7 +3351,7 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T sysz = SQR(helper.In.y) + SQR(helper.In.z);
T absV = sqrt(sysz);
T absV = std::sqrt(sysz);
T ni = m_Weight / (SQR(helper.In.x) + sysz);
T s = sin(helper.In.x);
T c = cos(helper.In.x);
@ -3410,7 +3410,7 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T sysz = SQR(helper.In.y) + SQR(helper.In.z);
T absV = sqrt(sysz);
T absV = std::sqrt(sysz);
T ni = m_Weight / (SQR(helper.In.x) + sysz);
T s = sin(absV);
T c = cos(absV);
@ -3563,7 +3563,7 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T sysz = SQR(helper.In.y) + SQR(helper.In.z);
T absV = sqrt(sysz);
T absV = std::sqrt(sysz);
T ni = m_Weight / (SQR(helper.In.x) + sysz);
T s = sin(helper.In.x);
T c = cos(helper.In.x);
@ -3622,7 +3622,7 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T sysz = SQR(helper.In.y) + SQR(helper.In.z);
T absV = sqrt(sysz);
T absV = std::sqrt(sysz);
T ni = m_Weight / (SQR(helper.In.x) + sysz);
T s = sin(absV);
T c = cos(absV);
@ -4023,7 +4023,7 @@ public:
T xx = (rand.Frand01<T>() - T(0.5)) * 2;
T yy = (rand.Frand01<T>() - T(0.5)) * 2;
T k = SignNz(yy);
T yymax = ((m_A * pow(fabs(xx), m_P) + k * m_B * sqrt(fabs(1 - SQR(xx)))) - m_A);
T yymax = ((m_A * pow(fabs(xx), m_P) + k * m_B * std::sqrt(fabs(1 - SQR(xx)))) - m_A);
//The function must be in a range 0-1 to work properly.
yymax /= Zeps(fabs(m_A) + fabs(m_B));
@ -4381,7 +4381,7 @@ public:
{
m_OneOverEx = 1 / m_Exponent;
m_AbsSeed = fabs(m_Seed);
m_Seed2 = sqrt(Zeps(m_AbsSeed + (m_AbsSeed / 2))) / Zeps((m_AbsSeed * T(0.5))) * T(0.25);
m_Seed2 = std::sqrt(Zeps(m_AbsSeed + (m_AbsSeed / 2))) / Zeps((m_AbsSeed * T(0.5))) * T(0.25);
m_OneOverRmax = 1 / (T(0.5) * (pow(T(2), 1 / m_Exponent) - 1) * m_ArcWidth);
m_Scale = (cos(-m_Rotation) - sin(-m_Rotation)) / m_Weight;
}
@ -4610,7 +4610,7 @@ public:
helper.Out.y = m_Weight * helper.In.y;
helper.Out.z = m_Weight * helper.In.z;
T t = m_Weight / Zeps((sqrt(SQR(helper.In.x)) + sqrt(helper.In.z) + sqrt(SQR(helper.In.y)) + sqrt(helper.In.z)));
T t = m_Weight / Zeps((std::sqrt(SQR(helper.In.x)) + std::sqrt(helper.In.z) + std::sqrt(SQR(helper.In.y)) + std::sqrt(helper.In.z)));
if (r >= 0)
{
@ -4740,7 +4740,7 @@ public:
if (helper.In.x > 0)
{
c1mx = m_C1 - helper.In.x;
r = sqrt(SQR(c1mx) + SQR(helper.In.y));
r = std::sqrt(SQR(c1mx) + SQR(helper.In.y));
if (r <= m_R1)
{
@ -4759,7 +4759,7 @@ public:
else
{
c1mx = -m_C2 - helper.In.x;
r = sqrt(SQR(c1mx) + SQR(helper.In.y));
r = std::sqrt(SQR(c1mx) + SQR(helper.In.y));
if (r <= m_R2)
{
@ -5086,8 +5086,8 @@ public:
T tmp = helper.m_PrecalcSumSquares + 1;
T x2 = 2 * helper.In.x;
T y2 = 2 * helper.In.y;
T xmax = T(0.5) * (sqrt(tmp + x2) + sqrt(tmp - x2));
T ymax = T(0.5) * (sqrt(tmp + y2) + sqrt(tmp - y2));
T xmax = T(0.5) * (std::sqrt(tmp + x2) + std::sqrt(tmp - x2));
T ymax = T(0.5) * (std::sqrt(tmp + y2) + std::sqrt(tmp - y2));
T a = helper.In.x / Zeps(xmax);
T b = SafeSqrt(1 - SQR(a));

View File

@ -761,7 +761,7 @@ public:
if (fabs(m_Xpand) <= 1)
m_Fill = m_Xpand * T(0.5);
else
m_Fill = sqrt(m_Xpand) * T(0.5);
m_Fill = std::sqrt(m_Xpand) * T(0.5);
if (fabs(m_Weight) <= T(0.5))
m_Smooth = m_Weight * 2;//Causes full effect above m_Weight = 0.5.
@ -996,7 +996,7 @@ public:
if (fabs(m_Xpand) <= 1)
m_Fill = m_Xpand * T(0.5);
else
m_Fill = sqrt(m_Xpand) * T(0.5);
m_Fill = std::sqrt(m_Xpand) * T(0.5);
}
protected:
@ -1289,7 +1289,7 @@ public:
m_Uy = sin(m_Delta * T(M_PI)) * cos(m_Phi * T(M_PI));
m_Uz = sin(m_Phi * T(M_PI));
T r = sqrt(SQR(m_Ux) + SQR(m_Uy) + SQR(m_Uz));
T r = std::sqrt(SQR(m_Ux) + SQR(m_Uy) + SQR(m_Uz));
//Normalize.
m_Ux /= r;
@ -1340,7 +1340,7 @@ public:
if (r2 < m_Vv)
{
T r = m_Weight * sqrt(m_Vv / r2 - 1);
T r = m_Weight * std::sqrt(m_Vv / r2 - 1);
helper.Out.x = r * helper.In.x;
helper.Out.y = r * helper.In.y;
@ -1767,7 +1767,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 / (sqrt(t) * (t + m_InvWeight));
T r = 1 / (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;
@ -2118,7 +2118,7 @@ public:
const T ax = rand.Frand<T>(T(-0.5), T(0.5));
const T ay = rand.Frand<T>(T(-0.5), T(0.5));
const T az = rand.Frand<T>(T(-0.5), T(0.5));
const T r = sqrt(Sqr(helper.In.x - m_X0) + Sqr(helper.In.y - m_Y0) + Sqr(helper.In.z - m_Z0));
const T r = std::sqrt(Sqr(helper.In.x - m_X0) + Sqr(helper.In.y - m_Y0) + Sqr(helper.In.z - m_Z0));
const T rc = ((m_Invert != 0 ? std::max<T>(1 - r, 0) : std::max<T>(r, 0)) - m_MinDist) * m_InternalScatter;//Original called a macro named min, which internally performed max.
const T rs = std::max<T>(rc, 0);
@ -2278,7 +2278,7 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
const v4T random(rand.Frand<T>(T(-0.5), T(0.5)), rand.Frand<T>(T(-0.5), T(0.5)), rand.Frand<T>(T(-0.5), T(0.5)), rand.Frand<T>(T(-0.5), T(0.5)));
const T distA = sqrt(Sqr(helper.In.x - m_X0) + Sqr(helper.In.y - m_Y0) + Sqr(helper.In.z - m_Z0));
const T distA = std::sqrt(Sqr(helper.In.x - m_X0) + Sqr(helper.In.y - m_Y0) + Sqr(helper.In.z - m_Z0));
const T distB = m_Invert != 0 ? std::max<T>(1 - distA, 0) : std::max<T>(distA, 0);//Original called a macro named min, which internally performed max.
const T dist = std::max<T>((distB - m_MinDist) * m_RMax, 0);
@ -2301,7 +2301,7 @@ public:
}
else
{
const T rIn = sqrt(helper.m_PrecalcSumSquares + SQR(helper.In.z));
const T rIn = std::sqrt(helper.m_PrecalcSumSquares + SQR(helper.In.z));
const T sigma = asin(helper.In.z / rIn) + m_MulZ * random.z * dist;
const T phi = helper.m_PrecalcAtanyx + m_MulY * random.y * dist;
const T r = rIn + m_MulX * random.x * dist;
@ -2480,7 +2480,7 @@ public:
switch (int(m_BlurShape))
{
case 0://Circle.
radius = sqrt(Sqr(helper.In.x - m_CenterX) + Sqr(helper.In.y - m_CenterY) + Sqr(helper.In.z - m_CenterZ));
radius = std::sqrt(Sqr(helper.In.x - m_CenterX) + Sqr(helper.In.y - m_CenterY) + Sqr(helper.In.z - m_CenterZ));
break;
case 1://Square.
default:
@ -2517,7 +2517,7 @@ public:
}
else
{
const T rIn = sqrt(helper.m_PrecalcSumSquares + SQR(helper.In.z));
const T rIn = std::sqrt(helper.m_PrecalcSumSquares + SQR(helper.In.z));
const T sigma = asin(helper.In.z / rIn) + m_MulZ * random.z * dist;
const T phi = helper.m_PrecalcAtanyx + m_MulY * random.y * dist;
const T r = rIn + m_MulX * random.x * dist;

View File

@ -894,7 +894,7 @@ public:
if (m_NeedPrecalcSqrtSumSquares)
{
helper.m_PrecalcSqrtSumSquares = sqrt(helper.m_PrecalcSumSquares);
helper.m_PrecalcSqrtSumSquares = std::sqrt(helper.m_PrecalcSumSquares);
if (m_NeedPrecalcAngles)
{

View File

@ -207,7 +207,7 @@ T DEOpenCLKernelCreator<T>::SolveMaxDERad(uint maxBoxSize, T desiredFilterSize,
template <typename T>
uint DEOpenCLKernelCreator<T>::SolveMaxBoxSize(uint localMem)
{
return uint(floor(sqrt(floor(T(localMem) / 16.0))));//Divide by 16 because each element is float4.
return uint(floor(std::sqrt(floor(T(localMem) / 16.0))));//Divide by 16 because each element is float4.
}
/// <summary>