fix std:: prefixing for cmath

This commit is contained in:
Dane Springmeyer 2014-08-30 15:13:26 -07:00
parent 8cd198625e
commit 7e74967282
27 changed files with 133 additions and 133 deletions

View file

@ -147,11 +147,11 @@ namespace agg
#pragma warning(pop)
AGG_INLINE unsigned ufloor(double v) //-------ufloor
{
return unsigned(floor(v));
return unsigned(std::floor(v));
}
AGG_INLINE unsigned uceil(double v) //--------uceil
{
return unsigned(ceil(v));
return unsigned(std::ceil(v));
}
#elif defined(AGG_QIFIST)
AGG_INLINE int iround(double v)
@ -164,11 +164,11 @@ namespace agg
}
AGG_INLINE unsigned ufloor(double v)
{
return unsigned(floor(v));
return unsigned(std::floor(v));
}
AGG_INLINE unsigned uceil(double v)
{
return unsigned(ceil(v));
return unsigned(std::ceil(v));
}
#else
AGG_INLINE int iround(double v)
@ -185,7 +185,7 @@ namespace agg
}
AGG_INLINE unsigned uceil(double v)
{
return unsigned(ceil(v));
return unsigned(std::ceil(v));
}
#endif
@ -522,7 +522,7 @@ namespace agg
//------------------------------------------------------------is_equal_eps
template<class T> inline bool is_equal_eps(T v1, T v2, T epsilon)
{
return fabs(v1 - v2) <= double(epsilon);
return std::fabs(v1 - v2) <= double(epsilon);
}
}

View file

@ -117,7 +117,7 @@ namespace agg
}
++m_num_markers;
m_mtx = m_transform;
m_mtx *= trans_affine_rotation(atan2(y2 - y1, x2 - x1));
m_mtx *= trans_affine_rotation(std::atan2(y2 - y1, x2 - x1));
m_mtx *= trans_affine_translation(x1, y1);
m_marker_shapes->rewind(m_marker - 1);
m_status = polygon;

View file

@ -233,9 +233,9 @@ namespace agg
m_y1_lr(line_lr(y1)),
m_x2_lr(line_lr(x2)),
m_y2_lr(line_lr(y2)),
m_ver(abs(m_x2_lr - m_x1_lr) < abs(m_y2_lr - m_y1_lr)),
m_len(m_ver ? abs(m_y2_lr - m_y1_lr) :
abs(m_x2_lr - m_x1_lr)),
m_ver(std::abs(m_x2_lr - m_x1_lr) < std::abs(m_y2_lr - m_y1_lr)),
m_len(m_ver ? std::abs(m_y2_lr - m_y1_lr) :
std::abs(m_x2_lr - m_x1_lr)),
m_inc(m_ver ? ((y2 > y1) ? 1 : -1) : ((x2 > x1) ? 1 : -1)),
m_interpolator(m_ver ? x1 : y1,
m_ver ? x2 : y2,

View file

@ -86,8 +86,8 @@ namespace agg
//------------------------------------------------------------------------
inline void ellipse::calc_num_steps()
{
double ra = (fabs(m_rx) + fabs(m_ry)) / 2;
double da = acos(ra / (ra + 0.125 / m_scale)) * 2;
double ra = (std::fabs(m_rx) + std::fabs(m_ry)) / 2;
double da = std::acos(ra / (ra + 0.125 / m_scale)) * 2;
m_num = uround(2*pi / da);
}
@ -108,8 +108,8 @@ namespace agg
if(m_step > m_num) return path_cmd_stop;
double angle = double(m_step) / double(m_num) * 2.0 * pi;
if(m_cw) angle = 2.0 * pi - angle;
*x = m_x + cos(angle) * m_rx;
*y = m_y + sin(angle) * m_ry;
*x = m_x + std::cos(angle) * m_rx;
*y = m_y + std::sin(angle) * m_ry;
m_step++;
return ((m_step == 1) ? path_cmd_move_to : path_cmd_line_to);
}

View file

@ -126,7 +126,7 @@ namespace agg
static double radius() { return 1.0; }
static double calc_weight(double x)
{
return 0.5 + 0.5 * cos(pi * x);
return 0.5 + 0.5 * std::cos(pi * x);
}
};
@ -137,7 +137,7 @@ namespace agg
static double radius() { return 1.0; }
static double calc_weight(double x)
{
return 0.54 + 0.46 * cos(pi * x);
return 0.54 + 0.46 * std::cos(pi * x);
}
};
@ -326,7 +326,7 @@ namespace agg
{
if(x == 0.0) return 1.0;
x *= pi;
return sin(x) / x;
return std::sin(x) / x;
}
private:
double m_radius;
@ -345,7 +345,7 @@ namespace agg
if(x > m_radius) return 0.0;
x *= pi;
double xr = x / m_radius;
return (sin(x) / x) * (sin(xr) / xr);
return (std::sin(x) / x) * (std::sin(xr) / xr);
}
private:
double m_radius;
@ -364,7 +364,7 @@ namespace agg
if(x > m_radius) return 0.0;
x *= pi;
double xr = x / m_radius;
return (sin(x) / x) * (0.42 + 0.5*cos(xr) + 0.08*cos(2*xr));
return (std::sin(x) / x) * (0.42 + 0.5 * std::cos(xr) + 0.08 * std::cos(2*xr));
}
private:
double m_radius;

View file

@ -84,8 +84,8 @@ namespace agg
line_parameters() {}
line_parameters(int x1_, int y1_, int x2_, int y2_, int len_) :
x1(x1_), y1(y1_), x2(x2_), y2(y2_),
dx(abs(x2_ - x1_)),
dy(abs(y2_ - y1_)),
dx(std::abs(x2_ - x1_)),
dy(std::abs(y2_ - y1_)),
sx((x2_ > x1_) ? 1 : -1),
sy((y2_ > y1_) ? 1 : -1),
vertical(dy >= dx),
@ -124,14 +124,14 @@ namespace agg
lp1.x2 = xmid;
lp1.y2 = ymid;
lp1.len = len2;
lp1.dx = abs(lp1.x2 - lp1.x1);
lp1.dy = abs(lp1.y2 - lp1.y1);
lp1.dx = std::abs(lp1.x2 - lp1.x1);
lp1.dy = std::abs(lp1.y2 - lp1.y1);
lp2.x1 = xmid;
lp2.y1 = ymid;
lp2.len = len2;
lp2.dx = abs(lp2.x2 - lp2.x1);
lp2.dy = abs(lp2.y2 - lp2.y1);
lp2.dx = std::abs(lp2.x2 - lp2.x1);
lp2.dy = std::abs(lp2.y2 - lp2.y1);
}
//---------------------------------------------------------------------

View file

@ -139,7 +139,7 @@ namespace agg
{
double num = (ay-cy) * (dx-cx) - (ax-cx) * (dy-cy);
double den = (bx-ax) * (dy-cy) - (by-ay) * (dx-cx);
if(fabs(den) < intersection_epsilon) return false;
if(std::fabs(den) < intersection_epsilon) return false;
double r = num / den;
*x = ax + r * (bx-ax);
*y = ay + r * (by-ay);
@ -165,7 +165,7 @@ namespace agg
// in terms of boundary conditions.
//--------------------
//double den = (x2-x1) * (y4-y3) - (y2-y1) * (x4-x3);
//if(fabs(den) < intersection_epsilon) return false;
//if(std::fabs(den) < intersection_epsilon) return false;
//double nom1 = (x4-x3) * (y1-y3) - (y4-y3) * (x1-x3);
//double nom2 = (x2-x1) * (y1-y3) - (y2-y1) * (x1-x3);
//double ua = nom1 / den;
@ -200,7 +200,7 @@ namespace agg
double dx3=0.0;
double dy3=0.0;
double loc = cross_product(x1, y1, x2, y2, x3, y3);
if(fabs(loc) > intersection_epsilon)
if(std::fabs(loc) > intersection_epsilon)
{
if(cross_product(x1, y1, x2, y2, x3, y3) > 0.0)
{
@ -370,7 +370,7 @@ namespace agg
}
double d = 1E-6;
double b = 0;
if(fabs(x) <= d)
if(std::fabs(x) <= d)
{
if(n != 0) return 0;
return 1;
@ -378,11 +378,11 @@ namespace agg
double b1 = 0; // b1 is the value from the previous iteration
// Set up a starting order for recurrence
int m1 = (int)fabs(x) + 6;
if(fabs(x) > 5)
if(std::fabs(x) > 5)
{
m1 = (int)(fabs(1.4 * x + 60 / x));
m1 = (int)(std::fabs(1.4 * x + 60 / x));
}
int m2 = (int)(n + 2 + fabs(x) / 4);
int m2 = (int)(n + 2 + std::fabs(x) / 4);
if (m1 > m2)
{
m2 = m1;
@ -422,7 +422,7 @@ namespace agg
}
c4 += c6;
b /= c4;
if(fabs(b - b1) < d)
if(std::fabs(b - b1) < d)
{
return b;
}

View file

@ -160,7 +160,7 @@ namespace agg
//-----------------------------------------------------------------------
template<class VC> void math_stroke<VC>::miter_limit_theta(double t)
{
m_miter_limit = 1.0 / sin(t * 0.5) ;
m_miter_limit = 1.0 / std::sin(t * 0.5) ;
}
//-----------------------------------------------------------------------
@ -170,12 +170,12 @@ namespace agg
double dx1, double dy1,
double dx2, double dy2)
{
double a1 = atan2(dy1 * m_width_sign, dx1 * m_width_sign);
double a2 = atan2(dy2 * m_width_sign, dx2 * m_width_sign);
double a1 = std::atan2(dy1 * m_width_sign, dx1 * m_width_sign);
double a2 = std::atan2(dy2 * m_width_sign, dx2 * m_width_sign);
double da = a1 - a2;
int i, n;
da = acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale)) * 2;
da = std::acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale)) * 2;
add_vertex(vc, x + dx1, y + dy1);
if(m_width_sign > 0)
@ -186,7 +186,7 @@ namespace agg
a1 += da;
for(i = 0; i < n; i++)
{
add_vertex(vc, x + cos(a1) * m_width, y + sin(a1) * m_width);
add_vertex(vc, x + std::cos(a1) * m_width, y + std::sin(a1) * m_width);
a1 += da;
}
}
@ -198,7 +198,7 @@ namespace agg
a1 -= da;
for(i = 0; i < n; i++)
{
add_vertex(vc, x + cos(a1) * m_width, y + sin(a1) * m_width);
add_vertex(vc, x + std::cos(a1) * m_width, y + std::sin(a1) * m_width);
a1 -= da;
}
}
@ -341,7 +341,7 @@ namespace agg
}
else
{
double da = acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale)) * 2;
double da = std::acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale)) * 2;
double a1;
int i;
int n = int(pi / da);
@ -350,23 +350,23 @@ namespace agg
add_vertex(vc, v0.x - dx1, v0.y + dy1);
if(m_width_sign > 0)
{
a1 = atan2(dy1, -dx1);
a1 = std::atan2(dy1, -dx1);
a1 += da;
for(i = 0; i < n; i++)
{
add_vertex(vc, v0.x + cos(a1) * m_width,
v0.y + sin(a1) * m_width);
add_vertex(vc, v0.x + std::cos(a1) * m_width,
v0.y + std::sin(a1) * m_width);
a1 += da;
}
}
else
{
a1 = atan2(-dy1, dx1);
a1 = std::atan2(-dy1, dx1);
a1 -= da;
for(i = 0; i < n; i++)
{
add_vertex(vc, v0.x + cos(a1) * m_width,
v0.y + sin(a1) * m_width);
add_vertex(vc, v0.x + std::cos(a1) * m_width,
v0.y + std::sin(a1) * m_width);
a1 -= da;
}
}

View file

@ -956,8 +956,8 @@ namespace agg
double y0 = 0.0;
m_vertices.last_vertex(&x0, &y0);
rx = fabs(rx);
ry = fabs(ry);
rx = std::fabs(rx);
ry = std::fabs(ry);
// Ensure radii are valid
//-------------------------

View file

@ -478,16 +478,16 @@ namespace agg
m_lp(&lp),
m_li(lp.vertical ? line_dbl_hr(lp.x2 - lp.x1) :
line_dbl_hr(lp.y2 - lp.y1),
lp.vertical ? abs(lp.y2 - lp.y1) :
abs(lp.x2 - lp.x1) + 1),
lp.vertical ? std::abs(lp.y2 - lp.y1) :
std::abs(lp.x2 - lp.x1) + 1),
m_ren(ren),
m_len((lp.vertical == (lp.inc > 0)) ? -lp.len : lp.len),
m_x(lp.x1 >> line_subpixel_shift),
m_y(lp.y1 >> line_subpixel_shift),
m_old_x(m_x),
m_old_y(m_y),
m_count((lp.vertical ? abs((lp.y2 >> line_subpixel_shift) - m_y) :
abs((lp.x2 >> line_subpixel_shift) - m_x))),
m_count((lp.vertical ? std::abs((lp.y2 >> line_subpixel_shift) - m_y) :
std::abs((lp.x2 >> line_subpixel_shift) - m_x))),
m_width(ren.subpixel_width()),
//m_max_extent(m_width >> (line_subpixel_shift - 2)),
m_max_extent((m_width + line_subpixel_mask) >> line_subpixel_shift),
@ -1652,7 +1652,7 @@ namespace agg
}
else
{
while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len)
while(std::abs(sx - lp.x1) + std::abs(sy - lp.y1) > 1 + lp2.len)
{
sx = (lp.x1 + sx) >> 1;
sy = (lp.y1 + sy) >> 1;
@ -1719,7 +1719,7 @@ namespace agg
}
else
{
while(abs(ex - lp.x2) + abs(ey - lp.y2) > 1 + lp2.len)
while(std::abs(ex - lp.x2) + std::abs(ey - lp.y2) > 1 + lp2.len)
{
ex = (lp.x2 + ex) >> 1;
ey = (lp.y2 + ey) >> 1;
@ -1791,7 +1791,7 @@ namespace agg
}
else
{
while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len)
while(std::abs(sx - lp.x1) + std::abs(sy - lp.y1) > 1 + lp2.len)
{
sx = (lp.x1 + sx) >> 1;
sy = (lp.y1 + sy) >> 1;
@ -1804,7 +1804,7 @@ namespace agg
}
else
{
while(abs(ex - lp.x2) + abs(ey - lp.y2) > 1 + lp2.len)
while(std::abs(ex - lp.x2) + std::abs(ey - lp.y2) > 1 + lp2.len)
{
ex = (lp.x2 + ex) >> 1;
ey = (lp.y2 + ey) >> 1;

View file

@ -488,8 +488,8 @@ namespace agg
m_lp(lp),
m_li(lp.vertical ? line_dbl_hr(lp.x2 - lp.x1) :
line_dbl_hr(lp.y2 - lp.y1),
lp.vertical ? abs(lp.y2 - lp.y1) :
abs(lp.x2 - lp.x1) + 1),
lp.vertical ? std::abs(lp.y2 - lp.y1) :
std::abs(lp.x2 - lp.x1) + 1),
m_di(lp.x1, lp.y1, lp.x2, lp.y2, sx, sy, ex, ey, lp.len, scale_x,
lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask),
m_ren(ren),
@ -497,8 +497,8 @@ namespace agg
m_y(lp.y1 >> line_subpixel_shift),
m_old_x(m_x),
m_old_y(m_y),
m_count((lp.vertical ? abs((lp.y2 >> line_subpixel_shift) - m_y) :
abs((lp.x2 >> line_subpixel_shift) - m_x))),
m_count((lp.vertical ? std::abs((lp.y2 >> line_subpixel_shift) - m_y) :
std::abs((lp.x2 >> line_subpixel_shift) - m_x))),
m_width(ren.subpixel_width()),
//m_max_extent(m_width >> (line_subpixel_shift - 2)),
m_max_extent((m_width + line_subpixel_scale) >> line_subpixel_shift),
@ -959,7 +959,7 @@ namespace agg
}
else
{
while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len)
while(std::abs(sx - lp.x1) + std::abs(sy - lp.y1) > 1 + lp2.len)
{
sx = (lp.x1 + sx) >> 1;
sy = (lp.y1 + sy) >> 1;
@ -972,7 +972,7 @@ namespace agg
}
else
{
while(abs(ex - lp.x2) + abs(ey - lp.y2) > 1 + lp2.len)
while(std::abs(ex - lp.x2) + std::abs(ey - lp.y2) > 1 + lp2.len)
{
ex = (lp.x2 + ex) >> 1;
ey = (lp.y2 + ey) >> 1;

View file

@ -406,7 +406,7 @@ namespace agg
{
static AGG_INLINE unsigned calculate(unsigned a, unsigned b)
{
return unsigned(abs(int(a) - int(b)));
return unsigned(std::abs(int(a) - int(b)));
}
};
@ -633,7 +633,7 @@ namespace agg
unsigned num_spans = sl1.num_spans();
for(;;)
{
add_span(span, span->x, abs((int)span->len), sl);
add_span(span, span->x, std::abs((int)span->len), sl);
if(--num_spans == 0) break;
++span;
}
@ -678,8 +678,8 @@ namespace agg
{
int xb1 = span1->x;
int xb2 = span2->x;
int xe1 = xb1 + abs((int)span1->len) - 1;
int xe2 = xb2 + abs((int)span2->len) - 1;
int xe1 = xb1 + std::abs((int)span1->len) - 1;
int xe2 = xb2 + std::abs((int)span2->len) - 1;
// Determine what spans we should advance in the next step
// The span with the least ending X should be advanced
@ -872,7 +872,7 @@ namespace agg
{
span1 = sl1.begin();
xb1 = span1->x;
xe1 = xb1 + abs((int)span1->len) - 1;
xe1 = xb1 + std::abs((int)span1->len) - 1;
--num1;
}
@ -882,7 +882,7 @@ namespace agg
{
span2 = sl2.begin();
xb2 = span2->x;
xe2 = xb2 + abs((int)span2->len) - 1;
xe2 = xb2 + std::abs((int)span2->len) - 1;
--num2;
}
@ -896,7 +896,7 @@ namespace agg
--num1;
++span1;
xb1 = span1->x;
xe1 = xb1 + abs((int)span1->len) - 1;
xe1 = xb1 + std::abs((int)span1->len) - 1;
}
// Retrieve a new span2 if it's invalid
@ -906,7 +906,7 @@ namespace agg
--num2;
++span2;
xb2 = span2->x;
xe2 = xb2 + abs((int)span2->len) - 1;
xe2 = xb2 + std::abs((int)span2->len) - 1;
}
if(xb1 > xe1 && xb2 > xe2) break;
@ -1392,7 +1392,7 @@ namespace agg
// Apply eXclusive OR to two anti-aliased scanline shapes.
// There's the absolute difference used to calculate
// Anti-Aliasing values, that is:
// a XOR b : abs(a-b)
// a XOR b : std::abs(a-b)
// See intersect_shapes_aa for more comments
//----------
template<class ScanlineGen1,

View file

@ -312,7 +312,7 @@ namespace agg
sp.x = span_iterator->x;
sp.len = span_iterator->len;
int len = abs(int(sp.len));
int len = std::abs(int(sp.len));
sp.covers_id =
m_covers.add_cells(span_iterator->covers,
unsigned(len));

View file

@ -51,7 +51,7 @@ namespace agg
unsigned i;
for(i = row; i < Rows; i++)
{
if((tmp = fabs(m[i][row])) > max_val && tmp != 0.0)
if((tmp = std::fabs(m[i][row])) > max_val && tmp != 0.0)
{
max_val = tmp;
k = i;

View file

@ -56,7 +56,7 @@ namespace agg
m_y1 = c1.y - 0.5;
m_dx = c2.x - c1.x;
double dy = c2.y - c1.y;
m_1dy = (fabs(dy) < 1e-10) ? 1e10 : 1.0 / dy;
m_1dy = (std::fabs(dy) < 1e-10) ? 1e10 : 1.0 / dy;
m_v1 = c1.color.v;
m_a1 = c1.color.a;
m_dv = c2.color.v - m_v1;
@ -151,7 +151,7 @@ namespace agg
// Get the horizontal length with subpixel accuracy
// and protect it from division by zero
//-------------------------
int nlen = abs(pc2->m_x - pc1->m_x);
int nlen = std::abs(pc2->m_x - pc1->m_x);
if(nlen <= 0) nlen = 1;
dda_line_interpolator<14> v(pc1->m_v, pc2->m_v, nlen);

View file

@ -163,7 +163,7 @@ namespace agg
// Get the horizontal length with subpixel accuracy
// and protect it from division by zero
//-------------------------
int nlen = abs(pc2->m_x - pc1->m_x);
int nlen = std::abs(pc2->m_x - pc1->m_x);
if(nlen <= 0) nlen = 1;
dda_line_interpolator<14> r(pc1->m_r, pc2->m_r, nlen);

View file

@ -225,7 +225,7 @@ namespace agg
double dy = y - m_fy;
double d2 = dx * m_fy - dy * m_fx;
double d3 = m_r2 * (dx * dx + dy * dy) - d2 * d2;
return iround((dx * m_fx + dy * m_fy + sqrt(fabs(d3))) * m_mul);
return iround((dx * m_fx + dy * m_fy + sqrt(std::fabs(d3))) * m_mul);
}
private:
@ -284,8 +284,8 @@ namespace agg
public:
static AGG_INLINE int calculate(int x, int y, int)
{
int ax = abs(x);
int ay = abs(y);
int ax = std::abs(x);
int ay = std::abs(y);
return ax > ay ? ax : ay;
}
};
@ -296,7 +296,7 @@ namespace agg
public:
static AGG_INLINE int calculate(int x, int y, int d)
{
return abs(x) * abs(y) / d;
return std::abs(x) * std::abs(y) / d;
}
};
@ -306,7 +306,7 @@ namespace agg
public:
static AGG_INLINE int calculate(int x, int y, int)
{
return fast_sqrt(abs(x) * abs(y));
return fast_sqrt(std::abs(x) * std::abs(y));
}
};
@ -316,7 +316,7 @@ namespace agg
public:
static AGG_INLINE int calculate(int x, int y, int d)
{
return uround(fabs(atan2(double(y), double(x))) * double(d) / pi);
return uround(std::fabs(std::atan2(double(y), double(x))) * double(d) / pi);
}
};

View file

@ -335,8 +335,8 @@ namespace agg
//------------------------------------------------------------------------
inline const trans_affine& trans_affine::rotate(double a)
{
double ca = cos(a);
double sa = sin(a);
double ca = std::cos(a);
double sa = std::sin(a);
double t0 = sx * ca - shy * sa;
double t2 = shx * ca - sy * sa;
double t4 = tx * ca - ty * sa;
@ -410,15 +410,15 @@ namespace agg
}
//====================================================trans_affine_rotation
// Rotation matrix. sin() and cos() are calculated twice for the same angle.
// There's no harm because the performance of sin()/cos() is very good on all
// Rotation matrix. std::sin() and std::cos() are calculated twice for the same angle.
// There's no harm because the performance of std::sin()/cos() is very good on all
// modern processors. Besides, this operation is not going to be invoked too
// often.
class trans_affine_rotation : public trans_affine
{
public:
trans_affine_rotation(double a) :
trans_affine(cos(a), sin(a), -sin(a), cos(a), 0.0, 0.0)
trans_affine(std::cos(a), std::sin(a), -std::sin(a), std::cos(a), 0.0, 0.0)
{}
};
@ -452,7 +452,7 @@ namespace agg
{
public:
trans_affine_skewing(double x, double y) :
trans_affine(1.0, tan(y), tan(x), 1.0, 0.0, 0.0)
trans_affine(1.0, std::tan(y), std::tan(x), 1.0, 0.0, 0.0)
{}
};
@ -472,7 +472,7 @@ namespace agg
{
multiply(trans_affine_scaling(sqrt(dx * dx + dy * dy) / dist));
}
multiply(trans_affine_rotation(atan2(dy, dx)));
multiply(trans_affine_rotation(std::atan2(dy, dx)));
multiply(trans_affine_translation(x1, y1));
}
};
@ -503,7 +503,7 @@ namespace agg
{
public:
trans_affine_reflection(double a) :
trans_affine_reflection_unit(cos(a), sin(a))
trans_affine_reflection_unit(std::cos(a), std::sin(a))
{}

View file

@ -643,7 +643,7 @@ namespace agg
//------------------------------------------------------------------------
inline bool trans_perspective::is_valid(double epsilon) const
{
return fabs(sx) > epsilon && fabs(sy) > epsilon && fabs(w2) > epsilon;
return std::fabs(sx) > epsilon && std::fabs(sy) > epsilon && std::fabs(w2) > epsilon;
}
//------------------------------------------------------------------------
@ -692,7 +692,7 @@ namespace agg
double y2 = 0.0;
transform(&x1, &y1);
transform(&x2, &y2);
return atan2(y2-y1, x2-x1);
return std::atan2(y2-y1, x2-x1);
}
//------------------------------------------------------------------------

View file

@ -241,10 +241,10 @@ namespace agg
inline void trans_viewport::update()
{
const double epsilon = 1e-30;
if(fabs(m_world_x1 - m_world_x2) < epsilon ||
fabs(m_world_y1 - m_world_y2) < epsilon ||
fabs(m_device_x1 - m_device_x2) < epsilon ||
fabs(m_device_y1 - m_device_y2) < epsilon)
if(std::fabs(m_world_x1 - m_world_x2) < epsilon ||
std::fabs(m_world_y1 - m_world_y2) < epsilon ||
std::fabs(m_device_x1 - m_device_x2) < epsilon ||
std::fabs(m_device_y1 - m_device_y2) < epsilon)
{
m_wx1 = m_world_x1;
m_wy1 = m_world_y1;

View file

@ -67,14 +67,14 @@ unsigned arc::vertex(double* x, double* y)
if(is_stop(m_path_cmd)) return path_cmd_stop;
if((m_angle < m_end - m_da/4) != m_ccw)
{
*x = m_x + cos(m_end) * m_rx;
*y = m_y + sin(m_end) * m_ry;
*x = m_x + std::cos(m_end) * m_rx;
*y = m_y + std::sin(m_end) * m_ry;
m_path_cmd = path_cmd_stop;
return path_cmd_line_to;
}
*x = m_x + cos(m_angle) * m_rx;
*y = m_y + sin(m_angle) * m_ry;
*x = m_x + std::cos(m_angle) * m_rx;
*y = m_y + std::sin(m_angle) * m_ry;
m_angle += m_da;
@ -86,8 +86,8 @@ unsigned arc::vertex(double* x, double* y)
//------------------------------------------------------------------------
void arc::normalize(double a1, double a2, bool ccw)
{
double ra = (fabs(m_rx) + fabs(m_ry)) / 2;
m_da = acos(ra / (ra + 0.125 / m_scale)) * 2;
double ra = (std::fabs(m_rx) + std::fabs(m_ry)) / 2;
m_da = std::acos(ra / (ra + 0.125 / m_scale)) * 2;
if(ccw)
{
while(a2 < a1) a2 += pi * 2.0;

View file

@ -29,7 +29,7 @@ namespace agg
// This epsilon is used to prevent us from adding degenerate curves
// (converging to a single point).
// The value isn't very critical. Function arc_to_bezier() has a limit
// of the sweep_angle. If fabs(sweep_angle) exceeds pi/2 the curve
// of the sweep_angle. If std::fabs(sweep_angle) exceeds pi/2 the curve
// becomes inaccurate. But slight exceeding is quite appropriate.
//-------------------------------------------------bezier_arc_angle_epsilon
const double bezier_arc_angle_epsilon = 0.01;
@ -39,8 +39,8 @@ void arc_to_bezier(double cx, double cy, double rx, double ry,
double start_angle, double sweep_angle,
double* curve)
{
double x0 = cos(sweep_angle / 2.0);
double y0 = sin(sweep_angle / 2.0);
double x0 = std::cos(sweep_angle / 2.0);
double y0 = std::sin(sweep_angle / 2.0);
double tx = (1.0 - x0) * 4.0 / 3.0;
double ty = y0 - tx * x0 / y0;
double px[4];
@ -54,8 +54,8 @@ void arc_to_bezier(double cx, double cy, double rx, double ry,
px[3] = x0;
py[3] = y0;
double sn = sin(start_angle + sweep_angle / 2.0);
double cs = cos(start_angle + sweep_angle / 2.0);
double sn = std::sin(start_angle + sweep_angle / 2.0);
double cs = std::cos(start_angle + sweep_angle / 2.0);
unsigned i;
for(i = 0; i < 4; i++)
@ -77,14 +77,14 @@ void bezier_arc::init(double x, double y,
if(sweep_angle >= 2.0 * pi) sweep_angle = 2.0 * pi;
if(sweep_angle <= -2.0 * pi) sweep_angle = -2.0 * pi;
if(fabs(sweep_angle) < 1e-10)
if(std::fabs(sweep_angle) < 1e-10)
{
m_num_vertices = 4;
m_cmd = path_cmd_line_to;
m_vertices[0] = x + rx * cos(start_angle);
m_vertices[1] = y + ry * sin(start_angle);
m_vertices[2] = x + rx * cos(start_angle + sweep_angle);
m_vertices[3] = y + ry * sin(start_angle + sweep_angle);
m_vertices[0] = x + rx * std::cos(start_angle);
m_vertices[1] = y + ry * std::sin(start_angle);
m_vertices[2] = x + rx * std::cos(start_angle + sweep_angle);
m_vertices[3] = y + ry * std::sin(start_angle + sweep_angle);
return;
}
@ -152,8 +152,8 @@ void bezier_arc_svg::init(double x0, double y0,
double dx2 = (x0 - x2) / 2.0;
double dy2 = (y0 - y2) / 2.0;
double cos_a = cos(angle);
double sin_a = sin(angle);
double cos_a = std::cos(angle);
double sin_a = std::sin(angle);
// Calculate (x1, y1)
//------------------------
@ -211,7 +211,7 @@ void bezier_arc_svg::init(double x0, double y0,
double v = p / n;
if(v < -1.0) v = -1.0;
if(v > 1.0) v = 1.0;
double start_angle = sign * acos(v);
double start_angle = sign * std::acos(v);
// Calculate the sweep angle
//------------------------
@ -221,7 +221,7 @@ void bezier_arc_svg::init(double x0, double y0,
v = p / n;
if(v < -1.0) v = -1.0;
if(v > 1.0) v = 1.0;
double sweep_angle = sign * acos(v);
double sweep_angle = sign * std::acos(v);
if(!sweep_flag && sweep_angle > 0)
{
sweep_angle -= pi * 2.0;

View file

@ -159,7 +159,7 @@ void curve3_div::recursive_bezier(double x1, double y1,
double dx = x3-x1;
double dy = y3-y1;
double d = fabs(((x2 - x3) * dy - (y2 - y3) * dx));
double d = std::fabs(((x2 - x3) * dy - (y2 - y3) * dx));
double da;
if(d > curve_collinearity_epsilon)
@ -179,7 +179,7 @@ void curve3_div::recursive_bezier(double x1, double y1,
// Angle & Cusp Condition
//----------------------
da = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1));
da = std::fabs(std::atan2(y3 - y2, x3 - x2) - std::atan2(y2 - y1, x2 - x1));
if(da >= pi) da = 2*pi - da;
if(da < m_angle_tolerance)
@ -419,8 +419,8 @@ void curve4_div::recursive_bezier(double x1, double y1,
double dx = x4-x1;
double dy = y4-y1;
double d2 = fabs(((x2 - x4) * dy - (y2 - y4) * dx));
double d3 = fabs(((x3 - x4) * dy - (y3 - y4) * dx));
double d2 = std::fabs(((x2 - x4) * dy - (y2 - y4) * dx));
double d3 = std::fabs(((x3 - x4) * dy - (y3 - y4) * dx));
double da1, da2, k;
switch((int(d2 > curve_collinearity_epsilon) << 1) +
@ -489,7 +489,7 @@ void curve4_div::recursive_bezier(double x1, double y1,
// Angle Condition
//----------------------
da1 = fabs(atan2(y4 - y3, x4 - x3) - atan2(y3 - y2, x3 - x2));
da1 = std::fabs(std::atan2(y4 - y3, x4 - x3) - std::atan2(y3 - y2, x3 - x2));
if(da1 >= pi) da1 = 2*pi - da1;
if(da1 < m_angle_tolerance)
@ -523,7 +523,7 @@ void curve4_div::recursive_bezier(double x1, double y1,
// Angle Condition
//----------------------
da1 = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1));
da1 = std::fabs(std::atan2(y3 - y2, x3 - x2) - std::atan2(y2 - y1, x2 - x1));
if(da1 >= pi) da1 = 2*pi - da1;
if(da1 < m_angle_tolerance)
@ -560,9 +560,9 @@ void curve4_div::recursive_bezier(double x1, double y1,
// Angle & Cusp Condition
//----------------------
k = atan2(y3 - y2, x3 - x2);
da1 = fabs(k - atan2(y2 - y1, x2 - x1));
da2 = fabs(atan2(y4 - y3, x4 - x3) - k);
k = std::atan2(y3 - y2, x3 - x2);
da1 = std::fabs(k - std::atan2(y2 - y1, x2 - x1));
da2 = std::fabs(std::atan2(y4 - y3, x4 - x3) - k);
if(da1 >= pi) da1 = 2*pi - da1;
if(da2 >= pi) da2 = 2*pi - da2;

View file

@ -78,8 +78,8 @@ void rounded_rect::radius(double rx1, double ry1, double rx2, double ry2,
//--------------------------------------------------------------------
void rounded_rect::normalize_radius()
{
double dx = fabs(m_x2 - m_x1);
double dy = fabs(m_y2 - m_y1);
double dx = std::fabs(m_x2 - m_x1);
double dy = std::fabs(m_y2 - m_y1);
double k = 1.0;
double t;

View file

@ -142,7 +142,7 @@ bool trans_affine::is_identity(double epsilon) const
//------------------------------------------------------------------------
bool trans_affine::is_valid(double epsilon) const
{
return fabs(sx) > epsilon && fabs(sy) > epsilon;
return std::fabs(sx) > epsilon && std::fabs(sy) > epsilon;
}
//------------------------------------------------------------------------
@ -165,7 +165,7 @@ double trans_affine::rotation() const
double y2 = 0.0;
transform(&x1, &y1);
transform(&x2, &y2);
return atan2(y2-y1, x2-x1);
return std::atan2(y2-y1, x2-x1);
}
//------------------------------------------------------------------------

View file

@ -67,7 +67,7 @@ void vcgen_dash::add_dash(double dash_len, double gap_len)
void vcgen_dash::dash_start(double ds)
{
m_dash_start = ds;
calc_dash_start(fabs(ds));
calc_dash_start(std::fabs(ds));
}

View file

@ -2267,13 +2267,13 @@ void Clipper::IntersectEdges(TEdge *e1, TEdge *e2,
else if (e1->PolyTyp != e2->PolyTyp)
{
//toggle subj open path OutIdx on/off when Abs(clip.WndCnt) == 1 ...
if ((e1->WindDelta == 0) && abs(e2->WindCnt) == 1 &&
if ((e1->WindDelta == 0) && std::abs(e2->WindCnt) == 1 &&
(m_ClipType != ctUnion || e2->WindCnt2 == 0))
{
AddOutPt(e1, Pt);
if (e1Contributing) e1->OutIdx = Unassigned;
}
else if ((e2->WindDelta == 0) && (abs(e1->WindCnt) == 1) &&
else if ((e2->WindDelta == 0) && (std::abs(e1->WindCnt) == 1) &&
(m_ClipType != ctUnion || e1->WindCnt2 == 0))
{
AddOutPt(e2, Pt);
@ -4035,7 +4035,7 @@ OffsetBuilder(const Paths& in_polys, Paths& out_polys,
if (limit <= 0) limit = 0.25;
else if (limit > std::fabs(Delta)*0.25) limit = std::fabs(Delta)*0.25;
//m_Steps360: see offset_triginometry2.svg in the documentation folder ...
m_Steps360 = pi / acos(1 - limit / std::fabs(Delta));
m_Steps360 = pi / std::acos(1 - limit / std::fabs(Delta));
m_sin = std::sin(2 * pi / m_Steps360);
m_cos = std::cos(2 * pi / m_Steps360);
m_Steps360 /= pi * 2;