remove duplicated constants (#296)
This commit is contained in:
parent
5162807399
commit
ee259ffaf7
64 changed files with 193 additions and 384 deletions
|
@ -25,6 +25,8 @@ if(WIN32)
|
||||||
endif()
|
endif()
|
||||||
set(QT_LIB_PATH ${QT_PATH})
|
set(QT_LIB_PATH ${QT_PATH})
|
||||||
set(CMAKE_PREFIX_PATH "${QT_PATH}/lib/cmake/")
|
set(CMAKE_PREFIX_PATH "${QT_PATH}/lib/cmake/")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4251")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251")
|
||||||
add_definitions(-DVC_EXTRALEAN -DNOMINMAX -D_USE_MATH_DEFINES)
|
add_definitions(-DVC_EXTRALEAN -DNOMINMAX -D_USE_MATH_DEFINES)
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
message("Apple System")
|
message("Apple System")
|
||||||
|
|
|
@ -19,17 +19,6 @@
|
||||||
#include "tmathutil.h"
|
#include "tmathutil.h"
|
||||||
#include "tstencilcontrol.h"
|
#include "tstencilcontrol.h"
|
||||||
|
|
||||||
//***************************************************************************
|
|
||||||
// Local namesapce stuff
|
|
||||||
//***************************************************************************
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
const double pi2 = TConsts::pi * 2.0;
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
// MovingModifier implementation
|
// MovingModifier implementation
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
@ -311,10 +300,10 @@ double ShadowStyle::getParamValue(TColorStyle::double_tag, int index) const
|
||||||
case 0:
|
case 0:
|
||||||
degree = asin(m_shadowDirection.y);
|
degree = asin(m_shadowDirection.y);
|
||||||
if (m_shadowDirection.x < 0)
|
if (m_shadowDirection.x < 0)
|
||||||
degree = TConsts::pi - degree;
|
degree = M_PI - degree;
|
||||||
if (degree < 0)
|
if (degree < 0)
|
||||||
degree += pi2;
|
degree += M_2PI;
|
||||||
return degree * TConsts::invOf_pi_180;
|
return degree * M_180_PI;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
return m_density;
|
return m_density;
|
||||||
|
@ -336,7 +325,7 @@ void ShadowStyle::setParamValue(int index, double value)
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
degree = value * TConsts::pi_180;
|
degree = value * M_PI_180;
|
||||||
m_shadowDirection.x = cos(degree);
|
m_shadowDirection.x = cos(degree);
|
||||||
m_shadowDirection.y = sin(degree);
|
m_shadowDirection.y = sin(degree);
|
||||||
break;
|
break;
|
||||||
|
@ -703,12 +692,12 @@ double ShadowStyle2::getParamValue(TColorStyle::double_tag, int index) const
|
||||||
|
|
||||||
double degree = asin(m_shadowDirection.y);
|
double degree = asin(m_shadowDirection.y);
|
||||||
if (m_shadowDirection.x < 0)
|
if (m_shadowDirection.x < 0)
|
||||||
degree = TConsts::pi - degree;
|
degree = M_PI - degree;
|
||||||
|
|
||||||
if (degree < 0)
|
if (degree < 0)
|
||||||
degree += pi2;
|
degree += M_2PI;
|
||||||
|
|
||||||
return degree * TConsts::invOf_pi_180;
|
return degree * M_180_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -740,7 +729,7 @@ void ShadowStyle2::setParamValue(int index, double value)
|
||||||
if (index == 1) {
|
if (index == 1) {
|
||||||
m_shadowLength = value;
|
m_shadowLength = value;
|
||||||
} else {
|
} else {
|
||||||
double degree = value * TConsts::pi_180;
|
double degree = value * M_PI_180;
|
||||||
m_shadowDirection.x = cos(degree);
|
m_shadowDirection.x = cos(degree);
|
||||||
m_shadowDirection.y = sin(degree);
|
m_shadowDirection.y = sin(degree);
|
||||||
}
|
}
|
||||||
|
@ -1323,10 +1312,10 @@ double TPointShadowFillStyle::getParamValue(TColorStyle::double_tag, int index)
|
||||||
case 0:
|
case 0:
|
||||||
degree = asin(m_shadowDirection.y);
|
degree = asin(m_shadowDirection.y);
|
||||||
if (m_shadowDirection.x < 0)
|
if (m_shadowDirection.x < 0)
|
||||||
degree = TConsts::pi - degree;
|
degree = M_PI - degree;
|
||||||
if (degree < 0)
|
if (degree < 0)
|
||||||
degree += pi2;
|
degree += M_2PI;
|
||||||
return degree * TConsts::invOf_pi_180;
|
return degree * M_180_PI;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
return m_density;
|
return m_density;
|
||||||
|
@ -1352,7 +1341,7 @@ void TPointShadowFillStyle::setParamValue(int index, double value)
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
degree = value * TConsts::pi_180;
|
degree = value * M_PI_180;
|
||||||
m_shadowDirection.x = cos(degree);
|
m_shadowDirection.x = cos(degree);
|
||||||
m_shadowDirection.y = sin(degree);
|
m_shadowDirection.y = sin(degree);
|
||||||
|
|
||||||
|
@ -2284,7 +2273,7 @@ void ArtisticModifier::modify(TRegionOutline &outline) const
|
||||||
}
|
}
|
||||||
double wave = 1;
|
double wave = 1;
|
||||||
if (maxcounter)
|
if (maxcounter)
|
||||||
wave = sin(pi2 * counter / maxcounter);
|
wave = sin(M_2PI * counter / maxcounter);
|
||||||
|
|
||||||
pIt->x += m_move.x * wave;
|
pIt->x += m_move.x * wave;
|
||||||
pIt->y += m_move.y * wave;
|
pIt->y += m_move.y * wave;
|
||||||
|
|
|
@ -132,7 +132,7 @@ inline void tglVertex(const T3DPointD &p)
|
||||||
TFurStrokeStyle::TFurStrokeStyle()
|
TFurStrokeStyle::TFurStrokeStyle()
|
||||||
: m_color(TPixel32::Black), m_angle(120.0), m_length(1.0), m_cs(0.0), m_sn(0.0)
|
: m_color(TPixel32::Black), m_angle(120.0), m_length(1.0), m_cs(0.0), m_sn(0.0)
|
||||||
{
|
{
|
||||||
double rad = TConsts::pi_180 * m_angle;
|
double rad = m_angle * M_PI_180;
|
||||||
m_cs = cos(rad);
|
m_cs = cos(rad);
|
||||||
m_sn = sin(rad);
|
m_sn = sin(rad);
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ void TFurStrokeStyle::setParamValue(int index, double value)
|
||||||
assert(0 <= index && index < getParamCount());
|
assert(0 <= index && index < getParamCount());
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
m_angle = value;
|
m_angle = value;
|
||||||
double rad = TConsts::pi_180 * m_angle;
|
double rad = m_angle * M_PI_180;
|
||||||
m_cs = cos(rad);
|
m_cs = cos(rad);
|
||||||
m_sn = sin(rad);
|
m_sn = sin(rad);
|
||||||
} else
|
} else
|
||||||
|
@ -209,7 +209,6 @@ void TFurStrokeStyle::setParamValue(int index, double value)
|
||||||
|
|
||||||
void TFurStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const
|
void TFurStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const
|
||||||
{
|
{
|
||||||
using TConsts::pi;
|
|
||||||
//TStroke *stroke = getStroke();
|
//TStroke *stroke = getStroke();
|
||||||
double length = stroke->getLength();
|
double length = stroke->getLength();
|
||||||
|
|
||||||
|
@ -249,7 +248,6 @@ void TFurStrokeStyle::computeData(Points &positions,
|
||||||
const TStroke *stroke,
|
const TStroke *stroke,
|
||||||
const TColorFunction *cf) const
|
const TColorFunction *cf) const
|
||||||
{
|
{
|
||||||
using TConsts::pi;
|
|
||||||
double length = stroke->getLength();
|
double length = stroke->getLength();
|
||||||
|
|
||||||
double s = 0.0;
|
double s = 0.0;
|
||||||
|
@ -2114,7 +2112,7 @@ void TBraidStrokeStyle::drawStroke(const TColorFunction *cf, const TStroke *stro
|
||||||
const double stripethickness = 0.3;
|
const double stripethickness = 0.3;
|
||||||
int period = (int)(101 - m_period) * 20;
|
int period = (int)(101 - m_period) * 20;
|
||||||
double step = period / (double)ntick;
|
double step = period / (double)ntick;
|
||||||
double freq = 2 * TConsts::pi / ntick;
|
double freq = M_2PI / ntick;
|
||||||
int swapcount = 0;
|
int swapcount = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
bool firstRing = true;
|
bool firstRing = true;
|
||||||
|
@ -2201,7 +2199,7 @@ void TBraidStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const
|
||||||
const double stripethickness = 0.3;
|
const double stripethickness = 0.3;
|
||||||
int period = (int)(101 - m_period) * 20;
|
int period = (int)(101 - m_period) * 20;
|
||||||
double step = period / (double)ntick;
|
double step = period / (double)ntick;
|
||||||
double freq = 2 * TConsts::pi / ntick;
|
double freq = M_2PI / ntick;
|
||||||
int swapcount = 0;
|
int swapcount = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
bool firstRing = true;
|
bool firstRing = true;
|
||||||
|
@ -3936,7 +3934,7 @@ void TTwirlStrokeStyle::computeData(Doubles &data, const TStroke *stroke, const
|
||||||
} // non dovrebbe succedere mai, ma per prudenza....
|
} // non dovrebbe succedere mai, ma per prudenza....
|
||||||
u = normalize(u);
|
u = normalize(u);
|
||||||
TPointD v = rotate90(u) * (pos.thick);
|
TPointD v = rotate90(u) * (pos.thick);
|
||||||
double shift = sin((TConsts::pi / hperiod) * s);
|
double shift = sin((M_PI / hperiod) * s);
|
||||||
|
|
||||||
app = pos + v * shift;
|
app = pos + v * shift;
|
||||||
data.push_back(app.x);
|
data.push_back(app.x);
|
||||||
|
@ -4035,7 +4033,7 @@ void TTwirlStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const
|
||||||
} // non dovrebbe succedere mai, ma per prudenza....
|
} // non dovrebbe succedere mai, ma per prudenza....
|
||||||
u = normalize(u);
|
u = normalize(u);
|
||||||
TPointD v = rotate90(u) * (pos.thick);
|
TPointD v = rotate90(u) * (pos.thick);
|
||||||
double shift = sin((TConsts::pi / hperiod) * s);
|
double shift = sin((M_PI / hperiod) * s);
|
||||||
points1.push_back(pos + v * shift);
|
points1.push_back(pos + v * shift);
|
||||||
points2.push_back(pos - v * shift);
|
points2.push_back(pos - v * shift);
|
||||||
blendval = get_inout_intensityslope(m_blend, 1.0 - m_blend, (s - ((int)(s / hperiod) * hperiod)) / hperiod);
|
blendval = get_inout_intensityslope(m_blend, 1.0 - m_blend, (s - ((int)(s / hperiod) * hperiod)) / hperiod);
|
||||||
|
@ -5156,7 +5154,6 @@ void TFriezeStrokeStyle2::computeData(Points &positions,
|
||||||
const TStroke *stroke,
|
const TStroke *stroke,
|
||||||
const TColorFunction *cf) const
|
const TColorFunction *cf) const
|
||||||
{
|
{
|
||||||
using TConsts::pi;
|
|
||||||
//TStroke *stroke = getStroke();
|
//TStroke *stroke = getStroke();
|
||||||
double length = stroke->getLength();
|
double length = stroke->getLength();
|
||||||
|
|
||||||
|
@ -5185,10 +5182,10 @@ void TFriezeStrokeStyle2::computeData(Points &positions,
|
||||||
double thickness = pos.thick; // 5; //(1-t)*40 + t * 10;
|
double thickness = pos.thick; // 5; //(1-t)*40 + t * 10;
|
||||||
|
|
||||||
if (thickness > 0) {
|
if (thickness > 0) {
|
||||||
double omega = pi * 2 / (thickness * 2);
|
double omega = M_PI / thickness;
|
||||||
|
|
||||||
double q = 0.5 * (1 - cos(phi));
|
double q = 0.5 * (1 - cos(phi));
|
||||||
double theta = pi * 0.5 - pi * m_parameter * q;
|
double theta = M_PI_2 - M_PI * m_parameter * q;
|
||||||
double r = thickness * sin(phi);
|
double r = thickness * sin(phi);
|
||||||
double r1 = r * thick;
|
double r1 = r * thick;
|
||||||
double costheta = cos(theta);
|
double costheta = cos(theta);
|
||||||
|
@ -5241,7 +5238,6 @@ void TFriezeStrokeStyle2::drawStroke(const TColorFunction *cf, Points &positions
|
||||||
|
|
||||||
void TFriezeStrokeStyle2::drawStroke(TFlash &flash, const TStroke *stroke) const
|
void TFriezeStrokeStyle2::drawStroke(TFlash &flash, const TStroke *stroke) const
|
||||||
{
|
{
|
||||||
using TConsts::pi;
|
|
||||||
//TStroke *stroke = getStroke();
|
//TStroke *stroke = getStroke();
|
||||||
double length = stroke->getLength();
|
double length = stroke->getLength();
|
||||||
|
|
||||||
|
@ -5265,10 +5261,10 @@ void TFriezeStrokeStyle2::drawStroke(TFlash &flash, const TStroke *stroke) const
|
||||||
double thickness = pos.thick; // 5; //(1-t)*40 + t * 10;
|
double thickness = pos.thick; // 5; //(1-t)*40 + t * 10;
|
||||||
|
|
||||||
if (thickness > 0) {
|
if (thickness > 0) {
|
||||||
double omega = pi * 2 / (thickness * 2);
|
double omega = M_PI / thickness;
|
||||||
|
|
||||||
double q = 0.5 * (1 - cos(phi));
|
double q = 0.5 * (1 - cos(phi));
|
||||||
double theta = pi * 0.5 - pi * m_parameter * q;
|
double theta = M_PI_2 - M_PI * m_parameter * q;
|
||||||
double r = thickness * sin(phi);
|
double r = thickness * sin(phi);
|
||||||
double r1 = r * thick;
|
double r1 = r * thick;
|
||||||
double costheta = cos(theta);
|
double costheta = cos(theta);
|
||||||
|
|
|
@ -552,8 +552,8 @@ int rootForCubicEquation(const std::vector<double> &p, std::vector<double> &sol)
|
||||||
double Q_sqrt = sqrt(Q);
|
double Q_sqrt = sqrt(Q);
|
||||||
double theta = acos(R / (Q * Q_sqrt));
|
double theta = acos(R / (Q * Q_sqrt));
|
||||||
sol.push_back(-2 * Q_sqrt * cos(theta * inv_3) - a * inv_3);
|
sol.push_back(-2 * Q_sqrt * cos(theta * inv_3) - a * inv_3);
|
||||||
sol.push_back(-2 * Q_sqrt * cos((theta - TConsts::pi * 2.0) * inv_3) - a * inv_3);
|
sol.push_back(-2 * Q_sqrt * cos((theta - M_2PI) * inv_3) - a * inv_3);
|
||||||
sol.push_back(-2 * Q_sqrt * cos((theta + TConsts::pi * 2.0) * inv_3) - a * inv_3);
|
sol.push_back(-2 * Q_sqrt * cos((theta + M_2PI) * inv_3) - a * inv_3);
|
||||||
std::sort(sol.begin(), sol.end());
|
std::sort(sol.begin(), sol.end());
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
@ -893,8 +893,8 @@ double cubicRoot(double a, double b, double c, double d)
|
||||||
double root[3];
|
double root[3];
|
||||||
root[0] = root[1] = root[2] = -2.0 * sqrt(Q);
|
root[0] = root[1] = root[2] = -2.0 * sqrt(Q);
|
||||||
root[0] *= cos(theta / 3.0);
|
root[0] *= cos(theta / 3.0);
|
||||||
root[1] *= cos((theta + 2 * TConsts::pi) / 3.0);
|
root[1] *= cos((theta + M_2PI) / 3.0);
|
||||||
root[2] *= cos((theta - 2 * TConsts::pi) / 3.0);
|
root[2] *= cos((theta - M_2PI) / 3.0);
|
||||||
root[0] -= b / 3.0;
|
root[0] -= b / 3.0;
|
||||||
root[1] -= b / 3.0;
|
root[1] -= b / 3.0;
|
||||||
root[2] -= b / 3.0;
|
root[2] -= b / 3.0;
|
||||||
|
|
|
@ -513,7 +513,7 @@ double computeStep(const TQuadratic &quad, double pixelSize)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (A_len > 0)
|
if (A_len > 0)
|
||||||
step = TConsts::sqrt2 * sqrt(pixelSize / A_len);
|
step = sqrt(2 * pixelSize / A_len);
|
||||||
|
|
||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,7 @@ TRotation::TRotation(double degrees)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rad = degrees * (TConsts::pi_180);
|
rad = degrees * M_PI_180;
|
||||||
sn = sin(rad);
|
sn = sin(rad);
|
||||||
cs = cos(rad);
|
cs = cos(rad);
|
||||||
if (sn == 1 || sn == -1)
|
if (sn == 1 || sn == -1)
|
||||||
|
|
|
@ -52,11 +52,11 @@ int computeSlices(double radius, double pixelSize = 1.0)
|
||||||
if (fabs(1.0 - temp) <= 1)
|
if (fabs(1.0 - temp) <= 1)
|
||||||
thetaStep = acos(1.0 - temp);
|
thetaStep = acos(1.0 - temp);
|
||||||
else
|
else
|
||||||
thetaStep = TConsts::pi_2 * 0.5;
|
thetaStep = M_PI_4;
|
||||||
|
|
||||||
assert(thetaStep != 0.0);
|
assert(thetaStep != 0.0);
|
||||||
|
|
||||||
int numberOfSlices = (int)(2.0 * TConsts::pi / thetaStep);
|
int numberOfSlices = (int)(M_2PI / thetaStep);
|
||||||
|
|
||||||
return numberOfSlices != 0 ? numberOfSlices : 2;
|
return numberOfSlices != 0 ? numberOfSlices : 2;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ void tglDrawCircle(const TPointD ¢er, double radius)
|
||||||
if (slices <= 0)
|
if (slices <= 0)
|
||||||
slices = computeSlices(radius, pixelSize) >> 1;
|
slices = computeSlices(radius, pixelSize) >> 1;
|
||||||
|
|
||||||
double step = TConsts::pi / slices;
|
double step = M_PI / slices;
|
||||||
double step2 = 2.0 * step;
|
double step2 = 2.0 * step;
|
||||||
|
|
||||||
double
|
double
|
||||||
|
@ -160,7 +160,7 @@ void tglDrawCircle(const TPointD ¢er, double radius)
|
||||||
|
|
||||||
cos_t = radius /* *1.0*/;
|
cos_t = radius /* *1.0*/;
|
||||||
sin_t = 0.0;
|
sin_t = 0.0;
|
||||||
for (t = 0; t + step < TConsts::pi_2; t += step2) {
|
for (t = 0; t + step < M_PI_2; t += step2) {
|
||||||
cos_ts = radius * cos(t + step);
|
cos_ts = radius * cos(t + step);
|
||||||
sin_ts = radius * sin(t + step);
|
sin_ts = radius * sin(t + step);
|
||||||
|
|
||||||
|
|
|
@ -286,7 +286,7 @@ void erodilate_quarters(int lx, int ly,
|
||||||
double radius, double shift, Func func)
|
double radius, double shift, Func func)
|
||||||
{
|
{
|
||||||
double sqRadius = sq(radius);
|
double sqRadius = sq(radius);
|
||||||
double squareHeight = radius / tcg::consts::sqrt2;
|
double squareHeight = radius * M_SQRT1_2;
|
||||||
int squareHeightI = tfloor(squareHeight);
|
int squareHeightI = tfloor(squareHeight);
|
||||||
|
|
||||||
// For every arc point
|
// For every arc point
|
||||||
|
@ -378,7 +378,7 @@ void circular_erodilate(const TRasterPT<Pix> &src, const TRasterPT<Pix> &dst, do
|
||||||
bool dilate = (radius >= 0.0);
|
bool dilate = (radius >= 0.0);
|
||||||
radius = fabs(radius);
|
radius = fabs(radius);
|
||||||
|
|
||||||
double inner_square_diameter = radius * tcg::consts::sqrt2;
|
double inner_square_diameter = radius * M_SQRT2;
|
||||||
|
|
||||||
double shift = 0.25 * inner_square_diameter; // Shift of the bent square SE needed to avoid
|
double shift = 0.25 * inner_square_diameter; // Shift of the bent square SE needed to avoid
|
||||||
// touching the circumference on the other side
|
// touching the circumference on the other side
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace
|
||||||
|
|
||||||
inline double gauss(double x, double y, double x0, double y0, double s)
|
inline double gauss(double x, double y, double x0, double y0, double s)
|
||||||
{
|
{
|
||||||
return exp(-((x - x0) * (x - x0) + (y - y0) * (y - y0)) / s) / (s * TConsts::pi);
|
return exp(-((x - x0) * (x - x0) + (y - y0) * (y - y0)) / s) / (s * M_PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
|
@ -159,12 +159,12 @@ inline TINT32 Double2Int(double val)
|
||||||
|
|
||||||
inline double sinc0(double x, int a)
|
inline double sinc0(double x, int a)
|
||||||
{
|
{
|
||||||
return sin((pi / (a)) * (x)) / ((pi / (a)) * (x));
|
return sin((M_PI / (a)) * (x)) / ((M_PI / (a)) * (x));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double sinc(double x, int a)
|
inline double sinc(double x, int a)
|
||||||
{
|
{
|
||||||
return (x) == 0.0 ? 1.0 : sin((pi / (a)) * (x)) / ((pi / (a)) * (x));
|
return (x) == 0.0 ? 1.0 : sin((M_PI / (a)) * (x)) / ((M_PI / (a)) * (x));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline UCHAR TO8BIT(float X)
|
inline UCHAR TO8BIT(float X)
|
||||||
|
@ -486,7 +486,7 @@ static inline double flt_hann2(double x)
|
||||||
if (x <= -2.0)
|
if (x <= -2.0)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
if (x < 2.0)
|
if (x < 2.0)
|
||||||
return sinc(x, 1) * (0.5 + 0.5 * cos((pi / 2) * x));
|
return sinc(x, 1) * (0.5 + 0.5 * cos(M_PI_2 * x));
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ static inline double flt_hann3(double x)
|
||||||
if (x <= -3.0)
|
if (x <= -3.0)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
if (x < 3.0)
|
if (x < 3.0)
|
||||||
return sinc(x, 1) * (0.5 + 0.5 * cos((pi / 3) * x));
|
return sinc(x, 1) * (0.5 + 0.5 * cos(M_PI_3 * x));
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ static inline double flt_hamming2(double x)
|
||||||
if (x <= -2.0)
|
if (x <= -2.0)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
if (x < 2.0)
|
if (x < 2.0)
|
||||||
return sinc(x, 1) * (0.54 + 0.46 * cos((pi / 2) * x));
|
return sinc(x, 1) * (0.54 + 0.46 * cos(M_PI_2 * x));
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +522,7 @@ static inline double flt_hamming3(double x)
|
||||||
if (x <= -3.0)
|
if (x <= -3.0)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
if (x < 3.0)
|
if (x < 3.0)
|
||||||
return sinc(x, 1) * (0.54 + 0.46 * cos((pi / 3) * x));
|
return sinc(x, 1) * (0.54 + 0.46 * cos(M_PI_3 * x));
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,7 +558,7 @@ static inline double flt_gauss(double x)
|
||||||
if (x <= -2.0)
|
if (x <= -2.0)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
if (x < 2.0)
|
if (x < 2.0)
|
||||||
return exp((-pi) * x * x);
|
return exp(-M_PI * x * x);
|
||||||
return 0.0; /* exp(-M_PI*2*2)~=3.5*10^-6 */
|
return 0.0; /* exp(-M_PI*2*2)~=3.5*10^-6 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1100,25 +1100,25 @@ inline double get_filter_value(TRop::ResampleFilterType flt_type, double x)
|
||||||
case TRop::Hann2:
|
case TRop::Hann2:
|
||||||
if (x <= -2.0) return 0.0;
|
if (x <= -2.0) return 0.0;
|
||||||
if (x < 2.0)
|
if (x < 2.0)
|
||||||
return sinc0(x, 1) * (0.5 + 0.5 * cos((pi / 2) * x));
|
return sinc0(x, 1) * (0.5 + 0.5 * cos(M_PI_2 * x));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRop::Hann3:
|
case TRop::Hann3:
|
||||||
if (x <= -3.0) return 0.0;
|
if (x <= -3.0) return 0.0;
|
||||||
if (x < 3.0)
|
if (x < 3.0)
|
||||||
return sinc0(x, 1) * (0.5 + 0.5 * cos((pi / 3) * x));
|
return sinc0(x, 1) * (0.5 + 0.5 * cos(M_PI_3 * x));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRop::Hamming2:
|
case TRop::Hamming2:
|
||||||
if (x <= -2.0) return 0.0;
|
if (x <= -2.0) return 0.0;
|
||||||
if (x < 2.0)
|
if (x < 2.0)
|
||||||
return sinc0(x, 1) * (0.54 + 0.46 * cos((pi / 2) * x));
|
return sinc0(x, 1) * (0.54 + 0.46 * cos(M_PI_2 * x));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRop::Hamming3:
|
case TRop::Hamming3:
|
||||||
if (x <= -3.0) return 0.0;
|
if (x <= -3.0) return 0.0;
|
||||||
if (x < 3.0)
|
if (x < 3.0)
|
||||||
return sinc0(x, 1) * (0.54 + 0.46 * cos((pi / 3) * x));
|
return sinc0(x, 1) * (0.54 + 0.46 * cos(M_PI_3 * x));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRop::Lanczos2:
|
case TRop::Lanczos2:
|
||||||
|
@ -1136,7 +1136,7 @@ inline double get_filter_value(TRop::ResampleFilterType flt_type, double x)
|
||||||
case TRop::Gauss:
|
case TRop::Gauss:
|
||||||
if (x <= -2.0) return 0.0;
|
if (x <= -2.0) return 0.0;
|
||||||
if (x < 2.0)
|
if (x < 2.0)
|
||||||
return exp((-pi) * x * x); /* exp(-M_PI*2*2)~=3.5*10^-6 */
|
return exp(-M_PI * x * x); /* exp(-M_PI*2*2)~=3.5*10^-6 */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(!"bad filter type");
|
assert(!"bad filter type");
|
||||||
|
|
|
@ -65,8 +65,8 @@ typedef struct
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
|
||||||
#define M_PIF ((float)TConsts::pi)
|
#define M_PIF float(M_PI)
|
||||||
#define SINC0(x, a) (sin((TConsts::pi / (a)) * (x)) / ((TConsts::pi / (a)) * (x)))
|
#define SINC0(x, a) (sin((M_PI / (a)) * (x)) / ((M_PI / (a)) * (x)))
|
||||||
#define SINC0F(x, a) (sinf((M_PIF / (a)) * (x)) / ((M_PIF / (a)) * (x)))
|
#define SINC0F(x, a) (sinf((M_PIF / (a)) * (x)) / ((M_PIF / (a)) * (x)))
|
||||||
#define SINC(x, a) ((x) == 0.0 ? 1.0 : SINC0(x, a))
|
#define SINC(x, a) ((x) == 0.0 ? 1.0 : SINC0(x, a))
|
||||||
#define SINCF(x, a) ((x) == 0.0F ? 1.0F : SINC0F(x, a))
|
#define SINCF(x, a) ((x) == 0.0F ? 1.0F : SINC0F(x, a))
|
||||||
|
@ -190,22 +190,22 @@ double filterValue(FLT_TYPE flt_type, double x)
|
||||||
|
|
||||||
case FLT_HANN2:
|
case FLT_HANN2:
|
||||||
if (x <= -2.0) result = 0.0;
|
if (x <= -2.0) result = 0.0;
|
||||||
else if (x < 2.0) result = SINC0(x, 1) * (0.5 + 0.5 * cos((TConsts::pi_2)*x));
|
else if (x < 2.0) result = SINC0(x, 1) * (0.5 + 0.5 * cos(M_PI_2 * x));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FLT_HANN3:
|
case FLT_HANN3:
|
||||||
if (x <= -3.0) result = 0.0;
|
if (x <= -3.0) result = 0.0;
|
||||||
else if (x < 3.0) result = SINC0(x, 1) * (0.5 + 0.5 * cos((TConsts::pi / 3) * x));
|
else if (x < 3.0) result = SINC0(x, 1) * (0.5 + 0.5 * cos((M_PI / 3) * x));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FLT_HAMMING2:
|
case FLT_HAMMING2:
|
||||||
if (x <= -2.0) result = 0.0;
|
if (x <= -2.0) result = 0.0;
|
||||||
else if (x < 2.0) result = SINC0(x, 1) * (0.54 + 0.46 * cos((TConsts::pi_2)*x));
|
else if (x < 2.0) result = SINC0(x, 1) * (0.54 + 0.46 * cos(M_PI_2 * x));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FLT_HAMMING3:
|
case FLT_HAMMING3:
|
||||||
if (x <= -3.0) result = 0.0;
|
if (x <= -3.0) result = 0.0;
|
||||||
else if (x < 3.0) result = SINC0(x, 1) * (0.54 + 0.46 * cos((TConsts::pi / 3) * x));
|
else if (x < 3.0) result = SINC0(x, 1) * (0.54 + 0.46 * cos((M_PI / 3) * x));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FLT_LANCZOS2:
|
case FLT_LANCZOS2:
|
||||||
|
@ -220,7 +220,7 @@ double filterValue(FLT_TYPE flt_type, double x)
|
||||||
|
|
||||||
case FLT_GAUSS:
|
case FLT_GAUSS:
|
||||||
if (x <= -2.0) result = 0.0;
|
if (x <= -2.0) result = 0.0;
|
||||||
else if (x < 2.0) result = exp((-TConsts::pi) * x * x);
|
else if (x < 2.0) result = exp((-M_PI) * x * x);
|
||||||
/* exp(-M_PI*2*2)~=3.5*10^-6 */
|
/* exp(-M_PI*2*2)~=3.5*10^-6 */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -71,8 +71,8 @@ class TangentConverter : public TUnitConverter
|
||||||
public:
|
public:
|
||||||
TangentConverter() {}
|
TangentConverter() {}
|
||||||
TUnitConverter *clone() const { return new TangentConverter(*this); }
|
TUnitConverter *clone() const { return new TangentConverter(*this); }
|
||||||
double convertTo(double v) const { return 180.0 * atan(v) / TConsts::pi; }
|
double convertTo(double v) const { return atan(v) * (M_1_PI * 180.0); }
|
||||||
double convertFrom(double v) const { return tan(TConsts::pi * v / 180.0); }
|
double convertFrom(double v) const { return tan(v * M_PI_180); }
|
||||||
};
|
};
|
||||||
|
|
||||||
//===================================================================
|
//===================================================================
|
||||||
|
|
|
@ -57,7 +57,7 @@ double localComputeStep(const TQuadratic &quad, double pixelSize)
|
||||||
|
|
||||||
double A_len = norm(A);
|
double A_len = norm(A);
|
||||||
if (A_len > 0)
|
if (A_len > 0)
|
||||||
step = TConsts::sqrt2 * sqrt(pixelSize / A_len);
|
step = sqrt(2 * pixelSize / A_len);
|
||||||
|
|
||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1082,8 +1082,8 @@ inline void insertBranch(Intersection &in, IntersectedStroke &item, bool getting
|
||||||
|
|
||||||
double getAngle(const TPointD &p0, const TPointD &p1)
|
double getAngle(const TPointD &p0, const TPointD &p1)
|
||||||
{
|
{
|
||||||
double angle1 = 180 * atan2(p0.x, p0.y) / TConsts::pi;
|
double angle1 = atan2(p0.x, p0.y) * M_180_PI;
|
||||||
double angle2 = 180 * atan2(p1.x, p1.y) / TConsts::pi;
|
double angle2 = atan2(p1.x, p1.y) * M_180_PI;
|
||||||
|
|
||||||
if (angle1 < 0)
|
if (angle1 < 0)
|
||||||
angle1 = 360 + angle1;
|
angle1 = 360 + angle1;
|
||||||
|
|
|
@ -3150,7 +3150,7 @@ void splitStroke(const TStroke &tq,
|
||||||
|
|
||||||
void detectCorners(const TStroke *stroke, double minDegree, std::vector<int> &corners)
|
void detectCorners(const TStroke *stroke, double minDegree, std::vector<int> &corners)
|
||||||
{
|
{
|
||||||
const double minSin = fabs(sin(minDegree * TConsts::pi_180));
|
const double minSin = fabs(sin(minDegree * M_PI_180));
|
||||||
|
|
||||||
const TThickQuadratic *quad1 = 0;
|
const TThickQuadratic *quad1 = 0;
|
||||||
const TThickQuadratic *quad2 = 0;
|
const TThickQuadratic *quad2 = 0;
|
||||||
|
@ -3575,11 +3575,11 @@ void computeQuadraticsFromCubic(const TThickCubic &cubic,
|
||||||
double cs2 = sq(tmp) / (4 * norm2_side0p * norm2_side3p);
|
double cs2 = sq(tmp) / (4 * norm2_side0p * norm2_side3p);
|
||||||
//assert (0 <= cs2 && cs2 <= 1 + TConsts::epsilon);
|
//assert (0 <= cs2 && cs2 <= 1 + TConsts::epsilon);
|
||||||
assert(areAlmostEqual(tsign(cs_sign) * sqrt(cs2), tmp / (2 * sqrt(norm2_side0p) * sqrt(norm2_side3p))));
|
assert(areAlmostEqual(tsign(cs_sign) * sqrt(cs2), tmp / (2 * sqrt(norm2_side0p) * sqrt(norm2_side3p))));
|
||||||
assert(!(cs_sign < 0) || acos(-sqrt(cs2)) > 10 * TConsts::pi_180); // cs_sign < 0 => acos(-sqrt(cs2)) > 10°
|
assert(!(cs_sign < 0) || acos(-sqrt(cs2)) > 10 * M_PI_180); // cs_sign < 0 => acos(-sqrt(cs2)) > 10°
|
||||||
if (cs_sign < 0 || cs2 < 0.969846) // cos(10°)^2 = 0.969846
|
if (cs_sign < 0 || cs2 < 0.969846) // cos(10°)^2 = 0.969846
|
||||||
{ // limita distanza di intersection: elimina quadratiche "cappio" (con p1 "lontano")
|
{ // limita distanza di intersection: elimina quadratiche "cappio" (con p1 "lontano")
|
||||||
//assert (acos(tsign(cs_sign)*sqrt(cs2)) > 10*TConsts::pi_180);
|
//assert (acos(tsign(cs_sign)*sqrt(cs2)) > 10*M_PI_180);
|
||||||
assert(tsign(cs_sign) * sqrt(cs2) < cos(10 * TConsts::pi_180));
|
assert(tsign(cs_sign) * sqrt(cs2) < cos(10 * M_PI_180));
|
||||||
TPointD intersection = p0 + t01 * (p1 - p0); // = p2 + t32*(p2 - p3)
|
TPointD intersection = p0 + t01 * (p1 - p0); // = p2 + t32*(p2 - p3)
|
||||||
TThickPoint p(intersection.x, intersection.y, 0.5 * (cubic.getThickP1().thick + cubic.getThickP2().thick)); // compatibilita' precedente funzione
|
TThickPoint p(intersection.x, intersection.y, 0.5 * (cubic.getThickP1().thick + cubic.getThickP2().thick)); // compatibilita' precedente funzione
|
||||||
chunkArray.push_back(new TThickQuadratic(cubic.getThickP0(), p, cubic.getThickP3()));
|
chunkArray.push_back(new TThickQuadratic(cubic.getThickP0(), p, cubic.getThickP3()));
|
||||||
|
|
|
@ -903,14 +903,12 @@ void tellipticbrush::OutlineBuilder::addRoundSideCaps(
|
||||||
|
|
||||||
//The only dangerous case is when the directions are near-opposed
|
//The only dangerous case is when the directions are near-opposed
|
||||||
if (prevD * nextD < 0) {
|
if (prevD * nextD < 0) {
|
||||||
const double twice_pi = 2 * TConsts::pi;
|
|
||||||
|
|
||||||
//Here, we must make one angle its (sign-opposite) 2*pi complement.
|
//Here, we must make one angle its (sign-opposite) 2*pi complement.
|
||||||
//Keep the angle with the least fabs (smallest 'butterfly intersection')
|
//Keep the angle with the least fabs (smallest 'butterfly intersection')
|
||||||
if (fabs(totAngleL) < fabs(totAngleR))
|
if (fabs(totAngleL) < fabs(totAngleR))
|
||||||
totAngleR = (totAngleR > 0) ? totAngleR - twice_pi : totAngleR + twice_pi;
|
totAngleR = (totAngleR > 0) ? totAngleR - M_2PI : totAngleR + M_2PI;
|
||||||
else
|
else
|
||||||
totAngleL = (totAngleL > 0) ? totAngleL - twice_pi : totAngleL + twice_pi;
|
totAngleL = (totAngleL > 0) ? totAngleL - M_2PI : totAngleL + M_2PI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ void eraseSmallAngles(std::vector<std::pair<int, double>> &corners, double angle
|
||||||
void detectCorners(const TStroke *stroke, double minDegree,
|
void detectCorners(const TStroke *stroke, double minDegree,
|
||||||
std::vector<std::pair<int, double>> &corners, double &min, double &max)
|
std::vector<std::pair<int, double>> &corners, double &min, double &max)
|
||||||
{
|
{
|
||||||
const double minSin = fabs(sin(minDegree * TConsts::pi_180));
|
const double minSin = fabs(sin(minDegree * M_PI_180));
|
||||||
double angle, vectorialProduct, metaCornerLen, partialLen;
|
double angle, vectorialProduct, metaCornerLen, partialLen;
|
||||||
|
|
||||||
UINT quadCount1 = stroke->getChunkCount();
|
UINT quadCount1 = stroke->getChunkCount();
|
||||||
|
@ -213,7 +213,7 @@ void detectCorners(const TStroke *stroke, double minDegree,
|
||||||
vectorialProduct = fabs(cross(tan1, tan2));
|
vectorialProduct = fabs(cross(tan1, tan2));
|
||||||
|
|
||||||
if (tan1 * tan2 < 0) {
|
if (tan1 * tan2 < 0) {
|
||||||
angle = 180 - asin(tcrop(vectorialProduct, -1.0, 1.0)) * TConsts::invOf_pi_180;
|
angle = 180 - asin(tcrop(vectorialProduct, -1.0, 1.0)) * M_180_PI;
|
||||||
corners.push_back(std::make_pair(j, angle));
|
corners.push_back(std::make_pair(j, angle));
|
||||||
|
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
@ -226,7 +226,7 @@ void detectCorners(const TStroke *stroke, double minDegree,
|
||||||
if (max < angle)
|
if (max < angle)
|
||||||
max = angle;
|
max = angle;
|
||||||
} else if (vectorialProduct >= minSin) {
|
} else if (vectorialProduct >= minSin) {
|
||||||
angle = asin(tcrop(vectorialProduct, -1.0, 1.0)) * TConsts::invOf_pi_180;
|
angle = asin(tcrop(vectorialProduct, -1.0, 1.0)) * M_180_PI;
|
||||||
corners.push_back(std::make_pair(j, angle));
|
corners.push_back(std::make_pair(j, angle));
|
||||||
|
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
@ -262,7 +262,7 @@ void detectCorners(const TStroke *stroke, double minDegree,
|
||||||
vectorialProduct = fabs(cross(tan1, tan2));
|
vectorialProduct = fabs(cross(tan1, tan2));
|
||||||
|
|
||||||
if (tan1 * tan2 < 0) {
|
if (tan1 * tan2 < 0) {
|
||||||
angle = 180 - asin(tcrop(vectorialProduct, -1.0, 1.0)) * TConsts::invOf_pi_180;
|
angle = 180 - asin(tcrop(vectorialProduct, -1.0, 1.0)) * M_180_PI;
|
||||||
|
|
||||||
metaCornerLen = ratioLen * (stroke->getChunk(j - 1)->getLength() + stroke->getChunk(j)->getLength());
|
metaCornerLen = ratioLen * (stroke->getChunk(j - 1)->getLength() + stroke->getChunk(j)->getLength());
|
||||||
partialLen = 0;
|
partialLen = 0;
|
||||||
|
@ -280,7 +280,7 @@ void detectCorners(const TStroke *stroke, double minDegree,
|
||||||
tan2 = normalize(tan2);
|
tan2 = normalize(tan2);
|
||||||
|
|
||||||
vectorialProduct = fabs(cross(tan1, tan2));
|
vectorialProduct = fabs(cross(tan1, tan2));
|
||||||
double nearAngle = asin(tcrop(vectorialProduct, -1.0, 1.0)) * TConsts::invOf_pi_180;
|
double nearAngle = asin(tcrop(vectorialProduct, -1.0, 1.0)) * M_180_PI;
|
||||||
if (tan1 * tan2 < 0)
|
if (tan1 * tan2 < 0)
|
||||||
nearAngle = 180 - nearAngle;
|
nearAngle = 180 - nearAngle;
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ void detectCorners(const TStroke *stroke, double minDegree,
|
||||||
tan2 = normalize(tan2);
|
tan2 = normalize(tan2);
|
||||||
|
|
||||||
vectorialProduct = fabs(cross(tan1, tan2));
|
vectorialProduct = fabs(cross(tan1, tan2));
|
||||||
double nearAngle = asin(tcrop(vectorialProduct, -1.0, 1.0)) * TConsts::invOf_pi_180;
|
double nearAngle = asin(tcrop(vectorialProduct, -1.0, 1.0)) * M_180_PI;
|
||||||
if (tan1 * tan2 < 0)
|
if (tan1 * tan2 < 0)
|
||||||
nearAngle = 180 - nearAngle;
|
nearAngle = 180 - nearAngle;
|
||||||
|
|
||||||
|
@ -1031,7 +1031,7 @@ void TInbetween::Imp::computeTransformation()
|
||||||
totalRadRotation += radRotation;
|
totalRadRotation += radRotation;
|
||||||
}
|
}
|
||||||
totalRadRotation /= (cornerSize - 1);
|
totalRadRotation /= (cornerSize - 1);
|
||||||
transform.m_rotation = TConsts::invOf_pi_180 * totalRadRotation;
|
transform.m_rotation = totalRadRotation * M_180_PI;
|
||||||
|
|
||||||
if (isAlmostZero(transform.m_rotation, 2)) {
|
if (isAlmostZero(transform.m_rotation, 2)) {
|
||||||
transform.m_rotation = 0.0;
|
transform.m_rotation = 0.0;
|
||||||
|
|
|
@ -57,7 +57,7 @@ struct bowlPotential {
|
||||||
if (radiusToTest > m_radiusOuter)
|
if (radiusToTest > m_radiusOuter)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
return 0.5 * (1.0 + cos((radiusToTest - m_radiusInner) / (m_radiusOuter - m_radiusInner) * TConsts::pi));
|
return 0.5 * (1.0 + cos((radiusToTest - m_radiusInner) / (m_radiusOuter - m_radiusInner) * M_PI));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual double gradient(double radiusToTest)
|
virtual double gradient(double radiusToTest)
|
||||||
|
@ -66,7 +66,7 @@ struct bowlPotential {
|
||||||
if (radiusToTest <= m_radiusInner || radiusToTest > m_radiusOuter)
|
if (radiusToTest <= m_radiusInner || radiusToTest > m_radiusOuter)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
double den = TConsts::pi / (m_radiusOuter - m_radiusInner);
|
double den = M_PI / (m_radiusOuter - m_radiusInner);
|
||||||
|
|
||||||
return -0.5 * den * sin(den * (radiusToTest - m_radiusInner));
|
return -0.5 * den * sin(den * (radiusToTest - m_radiusInner));
|
||||||
}
|
}
|
||||||
|
@ -542,7 +542,7 @@ double TStrokeBenderDeformation::getDelta(const TStroke &s, double w) const
|
||||||
double totalLenght = s.getLength();
|
double totalLenght = s.getLength();
|
||||||
|
|
||||||
if (totalLenght != 0) {
|
if (totalLenght != 0) {
|
||||||
double val = s.getLength(w) / totalLenght * TConsts::pi * 10.0;
|
double val = s.getLength(w) / totalLenght * (M_PI * 10.0);
|
||||||
|
|
||||||
return sin(val);
|
return sin(val);
|
||||||
}
|
}
|
||||||
|
@ -598,7 +598,7 @@ double TStrokeTwirlDeformation::getDelta(const TStroke &stroke, double s) const
|
||||||
|
|
||||||
if(totalLenght != 0)
|
if(totalLenght != 0)
|
||||||
{
|
{
|
||||||
double val = stroke.getLength(s)/totalLenght * TConsts::pi *11.0;
|
double val = stroke.getLength(s)/totalLenght * (M_PI * 11.0);
|
||||||
|
|
||||||
return sin(val);
|
return sin(val);
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ void detectEdges(const std::vector<TPointD> &pointArray, std::vector<UINT> &edge
|
||||||
const double dMin2 = dMin * dMin;
|
const double dMin2 = dMin * dMin;
|
||||||
const double dMax2 = dMax * dMax;
|
const double dMax2 = dMax * dMax;
|
||||||
std::vector<double> sharpnessArray;
|
std::vector<double> sharpnessArray;
|
||||||
sharpnessArray.push_back(TConsts::pi); // il primo punto e' un corner
|
sharpnessArray.push_back(M_PI); // il primo punto e' un corner
|
||||||
int nodeCount;
|
int nodeCount;
|
||||||
for (nodeCount = 1; nodeCount < size - 1; ++nodeCount) { // scorre la sharpPointArray escludendo gli estremi
|
for (nodeCount = 1; nodeCount < size - 1; ++nodeCount) { // scorre la sharpPointArray escludendo gli estremi
|
||||||
sharpnessArray.push_back(0);
|
sharpnessArray.push_back(0);
|
||||||
|
@ -219,7 +219,7 @@ void detectEdges(const std::vector<TPointD> &pointArray, std::vector<UINT> &edge
|
||||||
if (alpha > alphaMax)
|
if (alpha > alphaMax)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
double sharpness = TConsts::pi - alpha;
|
double sharpness = M_PI - alpha;
|
||||||
|
|
||||||
if (sharpnessArray[nodeCount] < sharpness)
|
if (sharpnessArray[nodeCount] < sharpness)
|
||||||
sharpnessArray[nodeCount] = sharpness;
|
sharpnessArray[nodeCount] = sharpness;
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef TCG_CONSTS_H
|
|
||||||
#define TCG_CONSTS_H
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\file consts.h
|
|
||||||
|
|
||||||
\brief This file contains several useful constants to be used with tcg.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//*************************************************************************************
|
|
||||||
// TCG Constants
|
|
||||||
//*************************************************************************************
|
|
||||||
|
|
||||||
namespace tcg
|
|
||||||
{
|
|
||||||
|
|
||||||
//! Contains several useful constants to be used with tcg.
|
|
||||||
namespace consts
|
|
||||||
{
|
|
||||||
|
|
||||||
const double pi = 3.1415926535897932384626433832795; //!< The Pi constant.
|
|
||||||
const double pi_half = 1.5707963267948966192313216916398; //!< Half of Pi.
|
|
||||||
const double pi_3half = 3.0 * pi_half; //!< Three halves of Pi.
|
|
||||||
const double pi_twice = 2.0 * pi; //!< Twice Pi.
|
|
||||||
|
|
||||||
const double rad_to_deg = 180.0 / pi; //!< Radians to degrees factor.
|
|
||||||
const double deg_to_rad = pi / 180.0; //!< Degrees to radians factor.
|
|
||||||
|
|
||||||
const double sqrt2 = 1.4142135623730950488016887242097; //!< Square root of 2.
|
|
||||||
const double sqrt2_half = 0.7071067811865475244008443621048; //!< Half of the square root of 2.
|
|
||||||
}
|
|
||||||
} // namespace tcg::consts
|
|
||||||
|
|
||||||
#endif // TCG_CONSTS_H
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
// tcg includes
|
// tcg includes
|
||||||
#include "point.h"
|
#include "point.h"
|
||||||
#include "consts.h"
|
|
||||||
#include "numeric_ops.h"
|
#include "numeric_ops.h"
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -308,7 +307,7 @@ inline typename point_traits<Point>::value_type rad(const Point &p)
|
||||||
template <typename Point>
|
template <typename Point>
|
||||||
inline typename point_traits<Point>::value_type angle(const Point &v1, const Point &v2)
|
inline typename point_traits<Point>::value_type angle(const Point &v1, const Point &v2)
|
||||||
{
|
{
|
||||||
return numeric_ops::mod<typename point_traits<Point>::value_type>(rad(v2) - rad(v1), -consts::pi, consts::pi);
|
return numeric_ops::mod<typename point_traits<Point>::value_type>(rad(v2) - rad(v1), -M_PI, M_PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// tcg includes
|
// tcg includes
|
||||||
#include "consts.h"
|
|
||||||
#include "numeric_ops.h"
|
#include "numeric_ops.h"
|
||||||
#include "poly_ops.h"
|
#include "poly_ops.h"
|
||||||
#include "point_ops.h"
|
#include "point_ops.h"
|
||||||
|
|
|
@ -63,18 +63,17 @@ int nanosleep(struct timespec *, int);
|
||||||
#include <map>
|
#include <map>
|
||||||
// .. and so on
|
// .. and so on
|
||||||
|
|
||||||
/* the value of pi defined in IRIX-math.h is not defined neither in WIN32-math.h nor elsewhere */
|
|
||||||
namespace TConsts
|
namespace TConsts
|
||||||
{
|
{
|
||||||
const double pi = 3.1415926535897932384626433832795;
|
|
||||||
const double pi_2 = 1.5707963267948966192313216916398;
|
|
||||||
const double epsilon = 1e-8;
|
const double epsilon = 1e-8;
|
||||||
const double sqrt2 = 1.4142135623730950488016887242097;
|
|
||||||
const double sqrt2_2 = 0.7071067811865475244008443621048;
|
|
||||||
const double pi_180 = pi / 180.0;
|
|
||||||
const double invOf_pi_180 = 180.0 / pi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use macros insted of constexprs, because MSVC2013 does not support `constexpr`.
|
||||||
|
#define M_PI_3 (M_PI / 3)
|
||||||
|
#define M_PI_180 (M_PI_4 / 45)
|
||||||
|
#define M_180_PI (90 * M_2_PI)
|
||||||
|
#define M_2PI (2 * M_PI)
|
||||||
|
|
||||||
// typedef's
|
// typedef's
|
||||||
|
|
||||||
#include "tnztypes.h"
|
#include "tnztypes.h"
|
||||||
|
|
|
@ -98,7 +98,7 @@ inline int intGE(double x)
|
||||||
*/
|
*/
|
||||||
inline double rad2degree(double rad)
|
inline double rad2degree(double rad)
|
||||||
{
|
{
|
||||||
return rad * TConsts::invOf_pi_180;
|
return rad * M_180_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! convert degree to radiant
|
//! convert degree to radiant
|
||||||
|
@ -109,7 +109,7 @@ inline double rad2degree(double rad)
|
||||||
*/
|
*/
|
||||||
inline double degree2rad(double degree)
|
inline double degree2rad(double degree)
|
||||||
{
|
{
|
||||||
return degree * TConsts::pi_180;
|
return degree * M_PI_180;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Sign of argument.
|
//! Sign of argument.
|
||||||
|
|
|
@ -174,9 +174,9 @@ void ColorEmbossFx::doCompute(TTile &tile, double frame, const TRenderSettings &
|
||||||
double scale = sqrt(fabs(ri.m_affine.det()));
|
double scale = sqrt(fabs(ri.m_affine.det()));
|
||||||
double radius = m_radius->getValue(frame) * scale;
|
double radius = m_radius->getValue(frame) * scale;
|
||||||
double direction = m_direction->getValue(frame);
|
double direction = m_direction->getValue(frame);
|
||||||
double elevation = (m_elevation->getValue(frame)) * TConsts::pi / 180;
|
double elevation = (m_elevation->getValue(frame)) * M_PI_180;
|
||||||
double intensity = m_intensity->getValue(frame);
|
double intensity = m_intensity->getValue(frame);
|
||||||
double azimuth = direction * TConsts::pi / 180;
|
double azimuth = direction * M_PI_180;
|
||||||
|
|
||||||
int border = radius + 1;
|
int border = radius + 1;
|
||||||
TRasterP srcRas = tile.getRaster()->create(tile.getRaster()->getLx() + border * 2, tile.getRaster()->getLy() + border * 2);
|
TRasterP srcRas = tile.getRaster()->create(tile.getRaster()->getLx() + border * 2, tile.getRaster()->getLy() + border * 2);
|
||||||
|
|
|
@ -159,9 +159,9 @@ void EmbossFx::doCompute(TTile &tile, double frame, const TRenderSettings &ri)
|
||||||
double scale = sqrt(fabs(ri.m_affine.det()));
|
double scale = sqrt(fabs(ri.m_affine.det()));
|
||||||
double radius = tcrop(m_radius->getValue(frame), min, max) * scale;
|
double radius = tcrop(m_radius->getValue(frame), min, max) * scale;
|
||||||
double direction = (m_direction->getValue(frame));
|
double direction = (m_direction->getValue(frame));
|
||||||
double elevation = (m_elevation->getValue(frame)) * TConsts::pi / 180;
|
double elevation = (m_elevation->getValue(frame)) * M_PI_180;
|
||||||
double intensity = m_intensity->getValue(frame);
|
double intensity = m_intensity->getValue(frame);
|
||||||
double azimuth = direction * TConsts::pi / 180;
|
double azimuth = direction * M_PI_180;
|
||||||
|
|
||||||
//NOTE: This enlargement is perhaps needed in the calculation of the fx - but no output will
|
//NOTE: This enlargement is perhaps needed in the calculation of the fx - but no output will
|
||||||
//be generated for it - so there is no trace of it in the doGetBBox function...
|
//be generated for it - so there is no trace of it in the doGetBBox function...
|
||||||
|
|
|
@ -4,13 +4,10 @@
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
#ifndef M_PI /* for vc2005 */
|
|
||||||
#define M_PI 3.14159265358979323846
|
|
||||||
#endif
|
|
||||||
bool inside_polygon_(
|
bool inside_polygon_(
|
||||||
double radius, int odd_diameter, double xp, double yp, int polygon_num, double degree)
|
double radius, int odd_diameter, double xp, double yp, int polygon_num, double degree)
|
||||||
{
|
{
|
||||||
double radian = degree * M_PI / 180.0,
|
double radian = degree * (M_PI / 180),
|
||||||
add_radian = 2.0 * M_PI / polygon_num,
|
add_radian = 2.0 * M_PI / polygon_num,
|
||||||
x1 = 0, y1 = 0, x2, y2,
|
x1 = 0, y1 = 0, x2, y2,
|
||||||
xa = -odd_diameter,
|
xa = -odd_diameter,
|
||||||
|
|
|
@ -1160,7 +1160,7 @@ double calculator_geometry::get_d_radian(double d_xv, double d_yv)
|
||||||
}
|
}
|
||||||
/* 第2象限 (第1象限に置き換えて... 0 <= angle < 90) */
|
/* 第2象限 (第1象限に置き換えて... 0 <= angle < 90) */
|
||||||
else if ((d_xv <= 0.0) && (0.0 < d_yv)) {
|
else if ((d_xv <= 0.0) && (0.0 < d_yv)) {
|
||||||
d_radian = atan(-d_xv / d_yv) + M_PI / 2.0;
|
d_radian = atan(-d_xv / d_yv) + M_PI_2;
|
||||||
}
|
}
|
||||||
/* 第3象限 (第1象限に置き換えて... 0 <= angle < 90) */
|
/* 第3象限 (第1象限に置き換えて... 0 <= angle < 90) */
|
||||||
else if ((d_xv < 0.0) && (d_yv <= 0.0)) {
|
else if ((d_xv < 0.0) && (d_yv <= 0.0)) {
|
||||||
|
@ -1168,7 +1168,7 @@ double calculator_geometry::get_d_radian(double d_xv, double d_yv)
|
||||||
}
|
}
|
||||||
/* 第4象限 (第1象限に置き換えて... 0 <= angle < 90) */
|
/* 第4象限 (第1象限に置き換えて... 0 <= angle < 90) */
|
||||||
else if ((0.0 <= d_xv) && (d_yv < 0.0)) {
|
else if ((0.0 <= d_xv) && (d_yv < 0.0)) {
|
||||||
d_radian = atan(d_xv / -d_yv) + M_PI + M_PI / 2.0;
|
d_radian = atan(d_xv / -d_yv) + M_PI + M_PI_2;
|
||||||
}
|
}
|
||||||
return d_radian;
|
return d_radian;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ bool inside_polygon_(
|
||||||
if (polygon_number < 3) { /* equal less than 2 is circle */
|
if (polygon_number < 3) { /* equal less than 2 is circle */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
double radian = roll_degree * M_PI / 180.0, add_radian = 2.0 * M_PI / polygon_number;
|
double radian = roll_degree * (M_PI / 180), add_radian = 2.0 * M_PI / polygon_number;
|
||||||
double x1 = radius * cos(radian), y1 = radius * sin(radian), x2 = 0, y2 = 0, xa = odd_diameter, xb = odd_diameter;
|
double x1 = radius * cos(radian), y1 = radius * sin(radian), x2 = 0, y2 = 0, xa = odd_diameter, xb = odd_diameter;
|
||||||
radian += add_radian;
|
radian += add_radian;
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ double length_to_polygon_(
|
||||||
/* 多角形の辺の2点 */
|
/* 多角形の辺の2点 */
|
||||||
double x1 = 0.0, y1 = 0.0, x2 = 0.0, y2 = 0.0;
|
double x1 = 0.0, y1 = 0.0, x2 = 0.0, y2 = 0.0;
|
||||||
const double add_radian = 2.0 * M_PI / polygon_number;
|
const double add_radian = 2.0 * M_PI / polygon_number;
|
||||||
double radian1 = roll_degree * M_PI / 180.0;
|
double radian1 = roll_degree * (M_PI / 180);
|
||||||
/* rad1だとMS-VC++_v10でエラー!!! */
|
/* rad1だとMS-VC++_v10でエラー!!! */
|
||||||
while (radian1 < 0.0) {
|
while (radian1 < 0.0) {
|
||||||
radian1 += add_radian;
|
radian1 += add_radian;
|
||||||
|
|
|
@ -119,7 +119,7 @@ void Iwa_DirectionalBlurFx::doCompute(TTile &tile,
|
||||||
}
|
}
|
||||||
|
|
||||||
TPointD blurVector;
|
TPointD blurVector;
|
||||||
double angle = m_angle->getValue(frame) * (TConsts::pi / 180);
|
double angle = m_angle->getValue(frame) * M_PI_180;
|
||||||
double intensity = m_intensity->getValue(frame);
|
double intensity = m_intensity->getValue(frame);
|
||||||
bool bidirectional = m_bidirectional->getValue();
|
bool bidirectional = m_bidirectional->getValue();
|
||||||
|
|
||||||
|
@ -567,7 +567,7 @@ bool Iwa_DirectionalBlurFx::doGetBBox(double frame,
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
TPointD blur;
|
TPointD blur;
|
||||||
double angle = m_angle->getValue(frame) * (TConsts::pi / 180);
|
double angle = m_angle->getValue(frame) * M_PI_180;
|
||||||
double intensity = m_intensity->getValue(frame);
|
double intensity = m_intensity->getValue(frame);
|
||||||
bool bidirectional = m_bidirectional->getValue();
|
bool bidirectional = m_bidirectional->getValue();
|
||||||
|
|
||||||
|
|
|
@ -389,11 +389,11 @@ void Iwa_Particle::update_Swing(const particles_values &values,
|
||||||
|
|
||||||
if (values.swingmode_val == Iwa_TiledParticlesFx::SWING_SMOOTH) {
|
if (values.swingmode_val == Iwa_TiledParticlesFx::SWING_SMOOTH) {
|
||||||
if (smperiodx)
|
if (smperiodx)
|
||||||
dummy.x = smswingx * randomxreference * sin((TConsts::pi * changesignx) / smperiodx);
|
dummy.x = smswingx * randomxreference * sin((M_PI * changesignx) / smperiodx);
|
||||||
else
|
else
|
||||||
dummy.x = 0;
|
dummy.x = 0;
|
||||||
if (smperiody)
|
if (smperiody)
|
||||||
dummy.y = smswingy * randomyreference * sin((TConsts::pi * changesigny) / smperiody);
|
dummy.y = smswingy * randomyreference * sin((M_PI * changesigny) / smperiody);
|
||||||
else
|
else
|
||||||
dummy.y = 0;
|
dummy.y = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -409,7 +409,7 @@ void Iwa_Particle::update_Swing(const particles_values &values,
|
||||||
|
|
||||||
if (values.rotswingmode_val == Iwa_TiledParticlesFx::SWING_SMOOTH) {
|
if (values.rotswingmode_val == Iwa_TiledParticlesFx::SWING_SMOOTH) {
|
||||||
if (smperioda)
|
if (smperioda)
|
||||||
dummy.a = smswinga * sin((TConsts::pi * changesigna) / smperioda);
|
dummy.a = smswinga * sin((M_PI * changesigna) / smperioda);
|
||||||
else
|
else
|
||||||
dummy.a = 0;
|
dummy.a = 0;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -516,10 +516,10 @@ void Iwa_Particles_Engine::normalize_values(struct particles_values &values,
|
||||||
(values.trailopacity_val.second) = (values.trailopacity_val.second) * 0.01;
|
(values.trailopacity_val.second) = (values.trailopacity_val.second) * 0.01;
|
||||||
(values.mblur_val) = (values.mblur_val) * 0.01;
|
(values.mblur_val) = (values.mblur_val) * 0.01;
|
||||||
(values.friction_val) = -(values.friction_val) * 0.01;
|
(values.friction_val) = -(values.friction_val) * 0.01;
|
||||||
(values.windangle_val) = (values.windangle_val) * (TConsts::pi / 180);
|
(values.windangle_val) = (values.windangle_val) * M_PI_180;
|
||||||
(values.g_angle_val) = (values.g_angle_val + 180) * (TConsts::pi / 180);
|
(values.g_angle_val) = (values.g_angle_val + 180) * M_PI_180;
|
||||||
(values.speeda_val.first) = (values.speeda_val.first) * (TConsts::pi / 180);
|
(values.speeda_val.first) = (values.speeda_val.first) * M_PI_180;
|
||||||
(values.speeda_val.second) = (values.speeda_val.second) * (TConsts::pi / 180);
|
(values.speeda_val.second) = (values.speeda_val.second) * M_PI_180;
|
||||||
if (values.step_val < 1)
|
if (values.step_val < 1)
|
||||||
values.step_val = 1;
|
values.step_val = 1;
|
||||||
values.genfadecol_val = (values.genfadecol_val) * 0.01;
|
values.genfadecol_val = (values.genfadecol_val) * 0.01;
|
||||||
|
@ -527,8 +527,8 @@ void Iwa_Particles_Engine::normalize_values(struct particles_values &values,
|
||||||
values.foutfadecol_val = (values.foutfadecol_val) * 0.01;
|
values.foutfadecol_val = (values.foutfadecol_val) * 0.01;
|
||||||
(values.curl_val) = (values.curl_val) * dpicorr * 0.1;
|
(values.curl_val) = (values.curl_val) * dpicorr * 0.1;
|
||||||
/*- ひらひら粒子に照明を当てる normalize_values()内で Degree → Radian 化する -*/
|
/*- ひらひら粒子に照明を当てる normalize_values()内で Degree → Radian 化する -*/
|
||||||
(values.iw_light_theta_val) = (values.iw_light_theta_val) * (TConsts::pi / 180);
|
(values.iw_light_theta_val) = (values.iw_light_theta_val) * M_PI_180;
|
||||||
(values.iw_light_phi_val) = (values.iw_light_phi_val) * (TConsts::pi / 180);
|
(values.iw_light_phi_val) = (values.iw_light_phi_val) * M_PI_180;
|
||||||
/*- 読み込みマージン -*/
|
/*- 読み込みマージン -*/
|
||||||
(values.margin_val) = (values.margin_val) * dpicorr;
|
(values.margin_val) = (values.margin_val) * dpicorr;
|
||||||
}
|
}
|
||||||
|
@ -961,7 +961,7 @@ void Iwa_Particles_Engine::do_render(TFlash *flash,
|
||||||
double aim_angle = 0;
|
double aim_angle = 0;
|
||||||
if (values.pathaim_val) {
|
if (values.pathaim_val) {
|
||||||
float arctan = atan2f(part->vy, part->vx);
|
float arctan = atan2f(part->vy, part->vx);
|
||||||
aim_angle = (180 / TConsts::pi) * arctan;
|
aim_angle = arctan * M_180_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*- 粒子の回転、スケールをアフィン行列に入れる -*/
|
/*- 粒子の回転、スケールをアフィン行列に入れる -*/
|
||||||
|
|
|
@ -138,7 +138,7 @@ void Iwa_PNPerspectiveFx::getPNParameters(TTile &tile, double frame,
|
||||||
(double)camHeight * aff_pn.a22);
|
(double)camHeight * aff_pn.a22);
|
||||||
params.fy_2 = sqrtf(vec_p0p1.x * vec_p0p1.x + vec_p0p1.y * vec_p0p1.y) / 2.0f;
|
params.fy_2 = sqrtf(vec_p0p1.x * vec_p0p1.x + vec_p0p1.y * vec_p0p1.y) / 2.0f;
|
||||||
|
|
||||||
float fov_radian_2 = (fov / 2.0f) * M_PI / 180.0f;
|
float fov_radian_2 = (fov / 2.0f) * float(M_PI_180);
|
||||||
|
|
||||||
/* カメラから投影面への距離 */
|
/* カメラから投影面への距離 */
|
||||||
float D = params.fy_2 / tanf(fov_radian_2);
|
float D = params.fy_2 / tanf(fov_radian_2);
|
||||||
|
|
|
@ -38,7 +38,7 @@ int KaleidoDistorter::invMap(const TPointD &p, TPointD *results) const
|
||||||
// Build p's angular position
|
// Build p's angular position
|
||||||
double qAngle = atan2(q.y, q.x);
|
double qAngle = atan2(q.y, q.x);
|
||||||
if (qAngle < 0.0)
|
if (qAngle < 0.0)
|
||||||
qAngle += 2.0 * TConsts::pi;
|
qAngle += 2.0 * M_PI;
|
||||||
|
|
||||||
assert(qAngle >= 0.0);
|
assert(qAngle >= 0.0);
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ private:
|
||||||
void KaleidoFx::buildSectionRect(TRectD &inRect, double angle)
|
void KaleidoFx::buildSectionRect(TRectD &inRect, double angle)
|
||||||
{
|
{
|
||||||
inRect.y0 = std::max(inRect.y0, 0.0);
|
inRect.y0 = std::max(inRect.y0, 0.0);
|
||||||
if (angle <= TConsts::pi_2) {
|
if (angle <= M_PI_2) {
|
||||||
inRect.x0 = std::max(inRect.x0, 0.0);
|
inRect.x0 = std::max(inRect.x0, 0.0);
|
||||||
inRect.y1 = std::min(inRect.y1, inRect.x1 * tan(angle));
|
inRect.y1 = std::min(inRect.y1, inRect.x1 * tan(angle));
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ TAffine KaleidoFx::buildInputReference(
|
||||||
const TRectD &outRect, const TRenderSettings &outInfo)
|
const TRectD &outRect, const TRenderSettings &outInfo)
|
||||||
{
|
{
|
||||||
double scale = fabs(sqrt(outInfo.m_affine.det()));
|
double scale = fabs(sqrt(outInfo.m_affine.det()));
|
||||||
double angle = TConsts::pi / m_count->getValue();
|
double angle = M_PI / m_count->getValue();
|
||||||
|
|
||||||
inInfo.m_affine = TRotation(-m_angle->getValue(frame) - angle) *
|
inInfo.m_affine = TRotation(-m_angle->getValue(frame) - angle) *
|
||||||
TScale(scale).place(m_center->getValue(frame), TPointD());
|
TScale(scale).place(m_center->getValue(frame), TPointD());
|
||||||
|
@ -178,7 +178,7 @@ bool KaleidoFx::doGetBBox(double frame, TRectD &bBox, const TRenderSettings &inf
|
||||||
if (!m_input.getFx())
|
if (!m_input.getFx())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
double angle = TConsts::pi / m_count->getValue();
|
double angle = M_PI / m_count->getValue();
|
||||||
|
|
||||||
TRenderSettings inInfo(info);
|
TRenderSettings inInfo(info);
|
||||||
inInfo.m_affine = TRotation(-m_angle->getValue(frame) - angle) *
|
inInfo.m_affine = TRotation(-m_angle->getValue(frame) - angle) *
|
||||||
|
@ -267,7 +267,7 @@ void KaleidoFx::doCompute(TTile &tile, double frame, const TRenderSettings &info
|
||||||
m_input->allocateAndCompute(inTile, inRect.getP00(), inDim, tile.getRaster(), frame, inInfo);
|
m_input->allocateAndCompute(inTile, inRect.getP00(), inDim, tile.getRaster(), frame, inInfo);
|
||||||
|
|
||||||
// Now, perform kaleido
|
// Now, perform kaleido
|
||||||
double angle = TConsts::pi / m_count->getValue();
|
double angle = M_PI / m_count->getValue();
|
||||||
KaleidoDistorter distorter(angle, outRefToInRef, -inRect.getP00());
|
KaleidoDistorter distorter(angle, outRefToInRef, -inRect.getP00());
|
||||||
|
|
||||||
TRasterP inRas(inTile.getRaster());
|
TRasterP inRas(inTile.getRaster());
|
||||||
|
|
|
@ -146,7 +146,7 @@ public:
|
||||||
double w_amplitude = m_amplitude->getValue(frame) / info.m_shrinkX;
|
double w_amplitude = m_amplitude->getValue(frame) / info.m_shrinkX;
|
||||||
double w_freq = m_frequency->getValue(frame) * info.m_shrinkX;
|
double w_freq = m_frequency->getValue(frame) * info.m_shrinkX;
|
||||||
double w_phase = m_phase->getValue(frame);
|
double w_phase = m_phase->getValue(frame);
|
||||||
w_freq = (w_freq * 0.01 * TConsts::pi) / 180;
|
w_freq *= 0.01 * M_PI_180;
|
||||||
double angle = -m_angle->getValue(frame);
|
double angle = -m_angle->getValue(frame);
|
||||||
|
|
||||||
//The warper is calculated on a standard reference, with fixed dpi. This makes sure
|
//The warper is calculated on a standard reference, with fixed dpi. This makes sure
|
||||||
|
|
|
@ -465,7 +465,7 @@ bool DirectionalBlurBaseFx::doGetBBox(double frame, TRectD &bBox, const TRenderS
|
||||||
if (m_isMotionBlur)
|
if (m_isMotionBlur)
|
||||||
blur = getBlurVector(frame);
|
blur = getBlurVector(frame);
|
||||||
else {
|
else {
|
||||||
double angle = m_angle->getValue(frame) * (TConsts::pi / 180);
|
double angle = m_angle->getValue(frame) * M_PI_180;
|
||||||
blur.x = m_intensity->getValue(frame) * cos(angle);
|
blur.x = m_intensity->getValue(frame) * cos(angle);
|
||||||
blur.y = m_intensity->getValue(frame) * sin(angle);
|
blur.y = m_intensity->getValue(frame) * sin(angle);
|
||||||
}
|
}
|
||||||
|
@ -490,7 +490,7 @@ void DirectionalBlurBaseFx::doCompute(TTile &tile, double frame, const TRenderSe
|
||||||
if (m_isMotionBlur) {
|
if (m_isMotionBlur) {
|
||||||
blurVector = getBlurVector(frame);
|
blurVector = getBlurVector(frame);
|
||||||
} else {
|
} else {
|
||||||
double angle = m_angle->getValue(frame) * (TConsts::pi / 180);
|
double angle = m_angle->getValue(frame) * M_PI_180;
|
||||||
blurVector.x = m_intensity->getValue(frame) * cos(angle);
|
blurVector.x = m_intensity->getValue(frame) * cos(angle);
|
||||||
blurVector.y = m_intensity->getValue(frame) * sin(angle);
|
blurVector.y = m_intensity->getValue(frame) * sin(angle);
|
||||||
}
|
}
|
||||||
|
@ -556,7 +556,7 @@ int DirectionalBlurBaseFx::getMemoryRequirement(const TRectD &rect, double frame
|
||||||
if (m_isMotionBlur) {
|
if (m_isMotionBlur) {
|
||||||
blurVector = getBlurVector(frame);
|
blurVector = getBlurVector(frame);
|
||||||
} else {
|
} else {
|
||||||
double angle = m_angle->getValue(frame) * (TConsts::pi / 180);
|
double angle = m_angle->getValue(frame) * M_PI_180;
|
||||||
blurVector.x = m_intensity->getValue(frame) * cos(angle);
|
blurVector.x = m_intensity->getValue(frame) * cos(angle);
|
||||||
blurVector.y = m_intensity->getValue(frame) * sin(angle);
|
blurVector.y = m_intensity->getValue(frame) * sin(angle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
sigma = 257.0 * 2.0 * sigma * sigma * sigma * sigma;
|
sigma = 257.0 * 2.0 * sigma * sigma * sigma * sigma;
|
||||||
for (int i = 0; i < PIXEL::maxChannelValue + 1; i++) {
|
for (int i = 0; i < PIXEL::maxChannelValue + 1; i++) {
|
||||||
noise_buf[i] = sigma * sqrt(-log(1.0 - random.getFloat())) *
|
noise_buf[i] = sigma * sqrt(-log(1.0 - random.getFloat())) *
|
||||||
cos(TConsts::pi * (2.0 * random.getFloat() - 1.0));
|
cos(M_PI * (2.0 * random.getFloat() - 1.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double get_value(int index)
|
double get_value(int index)
|
||||||
|
|
|
@ -399,11 +399,11 @@ void Particle::update_Swing(const particles_values &values,
|
||||||
|
|
||||||
if (values.swingmode_val == ParticlesFx::SWING_SMOOTH) {
|
if (values.swingmode_val == ParticlesFx::SWING_SMOOTH) {
|
||||||
if (smperiodx)
|
if (smperiodx)
|
||||||
dummy.x = smswingx * randomxreference * sin((TConsts::pi * changesignx) / smperiodx);
|
dummy.x = smswingx * randomxreference * sin((M_PI * changesignx) / smperiodx);
|
||||||
else
|
else
|
||||||
dummy.x = 0;
|
dummy.x = 0;
|
||||||
if (smperiody)
|
if (smperiody)
|
||||||
dummy.y = smswingy * randomyreference * sin((TConsts::pi * changesigny) / smperiody);
|
dummy.y = smswingy * randomyreference * sin((M_PI * changesigny) / smperiody);
|
||||||
else
|
else
|
||||||
dummy.y = 0;
|
dummy.y = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -419,7 +419,7 @@ void Particle::update_Swing(const particles_values &values,
|
||||||
|
|
||||||
if (values.rotswingmode_val == ParticlesFx::SWING_SMOOTH) {
|
if (values.rotswingmode_val == ParticlesFx::SWING_SMOOTH) {
|
||||||
if (smperioda)
|
if (smperioda)
|
||||||
dummy.a = smswinga * sin((TConsts::pi * changesigna) / smperioda);
|
dummy.a = smswinga * sin((M_PI * changesigna) / smperioda);
|
||||||
else
|
else
|
||||||
dummy.a = 0;
|
dummy.a = 0;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -370,10 +370,10 @@ void Particles_Engine::normalize_values(struct particles_values &values,
|
||||||
(values.trailopacity_val.second) = (values.trailopacity_val.second) * 0.01;
|
(values.trailopacity_val.second) = (values.trailopacity_val.second) * 0.01;
|
||||||
(values.mblur_val) = (values.mblur_val) * 0.01;
|
(values.mblur_val) = (values.mblur_val) * 0.01;
|
||||||
(values.friction_val) = -(values.friction_val) * 0.01;
|
(values.friction_val) = -(values.friction_val) * 0.01;
|
||||||
(values.windangle_val) = (values.windangle_val) * (TConsts::pi / 180);
|
(values.windangle_val) = (values.windangle_val) * M_PI_180;
|
||||||
(values.g_angle_val) = (values.g_angle_val + 180) * (TConsts::pi / 180);
|
(values.g_angle_val) = (values.g_angle_val + 180) * M_PI_180;
|
||||||
(values.speeda_val.first) = (values.speeda_val.first) * (TConsts::pi / 180);
|
(values.speeda_val.first) = (values.speeda_val.first) * M_PI_180;
|
||||||
(values.speeda_val.second) = (values.speeda_val.second) * (TConsts::pi / 180);
|
(values.speeda_val.second) = (values.speeda_val.second) * M_PI_180;
|
||||||
if (values.step_val < 1)
|
if (values.step_val < 1)
|
||||||
values.step_val = 1;
|
values.step_val = 1;
|
||||||
values.genfadecol_val = (values.genfadecol_val) * 0.01;
|
values.genfadecol_val = (values.genfadecol_val) * 0.01;
|
||||||
|
@ -599,7 +599,7 @@ void Particles_Engine::do_render(TFlash *flash, Particle *part, TTile *tile,
|
||||||
double aim_angle = 0;
|
double aim_angle = 0;
|
||||||
if (values.pathaim_val) {
|
if (values.pathaim_val) {
|
||||||
double arctan = atan2(part->vy, part->vx);
|
double arctan = atan2(part->vy, part->vx);
|
||||||
aim_angle = (180 / TConsts::pi) * arctan;
|
aim_angle = arctan * M_180_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the rotational and scale components we have to apply on the particle
|
// Calculate the rotational and scale components we have to apply on the particle
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
double radius = m_radius->getValue(frame) * scale;
|
double radius = m_radius->getValue(frame) * scale;
|
||||||
double blur = m_blur->getValue(frame);
|
double blur = m_blur->getValue(frame);
|
||||||
|
|
||||||
double intensity = blur * (TConsts::pi / 180);
|
double intensity = blur * M_PI_180;
|
||||||
|
|
||||||
TPointD p1 = bBox.getP00() - point;
|
TPointD p1 = bBox.getP00() - point;
|
||||||
TPointD p2 = bBox.getP01() - point;
|
TPointD p2 = bBox.getP01() - point;
|
||||||
|
@ -121,7 +121,7 @@ void doRadialBlur(const TRasterPT<PIXEL> rout, const TRasterPT<PIXEL> rin, doubl
|
||||||
double CROP_VAL = (double)MAX_CHANNEL_VALUE;
|
double CROP_VAL = (double)MAX_CHANNEL_VALUE;
|
||||||
CHANNEL_TYPE U_CROP_VAL = MAX_CHANNEL_VALUE;
|
CHANNEL_TYPE U_CROP_VAL = MAX_CHANNEL_VALUE;
|
||||||
|
|
||||||
double intensity = blur * (TConsts::pi / 180);
|
double intensity = blur * M_PI_180;
|
||||||
|
|
||||||
/*-出力サイズの画面の中の、ブラーのセンター位置-*/
|
/*-出力サイズの画面の中の、ブラーのセンター位置-*/
|
||||||
int cx = lx / 2 + dx;
|
int cx = lx / 2 + dx;
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
double radius = m_radius->getValue(frame) * scale;
|
double radius = m_radius->getValue(frame) * scale;
|
||||||
double blur = 0.001 * m_blur->getValue(frame) / scale;
|
double blur = 0.001 * m_blur->getValue(frame) / scale;
|
||||||
|
|
||||||
double intensity = blur * (TConsts::pi / 180);
|
double intensity = blur * M_PI_180;
|
||||||
|
|
||||||
TPointD p1 = bBox.getP00() - point;
|
TPointD p1 = bBox.getP00() - point;
|
||||||
TPointD p2 = bBox.getP01() - point;
|
TPointD p2 = bBox.getP01() - point;
|
||||||
|
@ -56,8 +56,8 @@ public:
|
||||||
blurangle = intensity * ((dist - radius));
|
blurangle = intensity * ((dist - radius));
|
||||||
else
|
else
|
||||||
blurangle = 0;
|
blurangle = 0;
|
||||||
if (blurangle > TConsts::pi)
|
if (blurangle > M_PI)
|
||||||
blurangle = TConsts::pi;
|
blurangle = M_PI;
|
||||||
return tround(4 * blurangle * dist);
|
return tround(4 * blurangle * dist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ void doSpinBlur(const TRasterPT<PIXEL> rout, const TRasterPT<PIXEL> rin, double
|
||||||
double CROP_VAL = (double)MAX_CHANNEL_VALUE;
|
double CROP_VAL = (double)MAX_CHANNEL_VALUE;
|
||||||
CHANNEL_TYPE U_CROP_VAL = MAX_CHANNEL_VALUE;
|
CHANNEL_TYPE U_CROP_VAL = MAX_CHANNEL_VALUE;
|
||||||
|
|
||||||
double intensity = blur * (TConsts::pi / 180);
|
double intensity = blur * M_PI_180;
|
||||||
int cx = lx / 2 + dx;
|
int cx = lx / 2 + dx;
|
||||||
int cy = ly / 2 + dy;
|
int cy = ly / 2 + dy;
|
||||||
|
|
||||||
|
@ -152,8 +152,8 @@ void doSpinBlur(const TRasterPT<PIXEL> rout, const TRasterPT<PIXEL> rin, double
|
||||||
blurangle = intensity * ((dist - radius));
|
blurangle = intensity * ((dist - radius));
|
||||||
else
|
else
|
||||||
blurangle = 0;
|
blurangle = 0;
|
||||||
if (blurangle > TConsts::pi)
|
if (blurangle > M_PI)
|
||||||
blurangle = TConsts::pi;
|
blurangle = M_PI;
|
||||||
range = (int)(4 * blurangle * dist);
|
range = (int)(4 * blurangle * dist);
|
||||||
if (range >= 1) {
|
if (range >= 1) {
|
||||||
angle = atan2((double)vy, (double)vx) - blurangle;
|
angle = atan2((double)vy, (double)vx) - blurangle;
|
||||||
|
|
|
@ -357,7 +357,7 @@ void LinearGradientFx::doCompute(TTile &tile, double frame, const TRenderSetting
|
||||||
double w_amplitude = m_wave_amplitude->getValue(frame) / ri.m_shrinkX;
|
double w_amplitude = m_wave_amplitude->getValue(frame) / ri.m_shrinkX;
|
||||||
double w_freq = m_wave_freq->getValue(frame) * ri.m_shrinkX;
|
double w_freq = m_wave_freq->getValue(frame) * ri.m_shrinkX;
|
||||||
double w_phase = m_wave_phase->getValue(frame);
|
double w_phase = m_wave_phase->getValue(frame);
|
||||||
w_freq = (w_freq * 0.01 * TConsts::pi) / 180;
|
w_freq *= 0.01 * M_PI_180;
|
||||||
|
|
||||||
TSpectrum::ColorKey colors[] = {
|
TSpectrum::ColorKey colors[] = {
|
||||||
TSpectrum::ColorKey(0, m_color1->getValue(frame)),
|
TSpectrum::ColorKey(0, m_color1->getValue(frame)),
|
||||||
|
@ -395,7 +395,7 @@ void MultiLinearGradientFx::doCompute(TTile &tile, double frame, const TRenderSe
|
||||||
double w_amplitude = m_wave_amplitude->getValue(frame) / ri.m_shrinkX;
|
double w_amplitude = m_wave_amplitude->getValue(frame) / ri.m_shrinkX;
|
||||||
double w_freq = m_wave_freq->getValue(frame) * ri.m_shrinkX;
|
double w_freq = m_wave_freq->getValue(frame) * ri.m_shrinkX;
|
||||||
double w_phase = m_wave_phase->getValue(frame);
|
double w_phase = m_wave_phase->getValue(frame);
|
||||||
w_freq = (w_freq * 0.01 * TConsts::pi) / 180;
|
w_freq *= 0.01 * M_PI_180;
|
||||||
|
|
||||||
TAffine aff = ri.m_affine.inv();
|
TAffine aff = ri.m_affine.inv();
|
||||||
TPointD posTrasf = aff * tile.m_pos;
|
TPointD posTrasf = aff * tile.m_pos;
|
||||||
|
|
|
@ -70,7 +70,7 @@ void doTargetSpot(const TRasterPT<PIXEL> &ras, TPixel32 m_color0, double sizex,
|
||||||
double normx = 1 / sizex;
|
double normx = 1 / sizex;
|
||||||
double normy = 1 / sizey;
|
double normy = 1 / sizey;
|
||||||
double reference = 5 * z;
|
double reference = 5 * z;
|
||||||
angle = (TConsts::pi * angle) / 180;
|
angle = angle * M_PI_180;
|
||||||
double ttan;
|
double ttan;
|
||||||
ttan = tan(angle);
|
ttan = tan(angle);
|
||||||
|
|
||||||
|
|
|
@ -745,7 +745,7 @@ degree2cos(int degree)
|
||||||
degree == 270)
|
degree == 270)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
return cos(degree * TConsts::pi_180);
|
return cos(degree * M_PI_180);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -101,7 +101,7 @@ double buildAngle(const PlasticSkeleton &skeleton, int v)
|
||||||
dir = vxParent.P() - vxGrandParent.P();
|
dir = vxParent.P() - vxGrandParent.P();
|
||||||
}
|
}
|
||||||
|
|
||||||
return tcg::consts::rad_to_deg * tcg::point_ops::angle(dir, vx.P() - vxParent.P());
|
return tcg::point_ops::angle(dir, vx.P() - vxParent.P()) * M_180_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -595,7 +595,7 @@ void PlasticSkeletonDeformation::Imp::updateBranchPositions(
|
||||||
// Now, rebuild vx's position
|
// Now, rebuild vx's position
|
||||||
const SkVD &vd = m_vds.find(dvx.name())->m_vd;
|
const SkVD &vd = m_vds.find(dvx.name())->m_vd;
|
||||||
|
|
||||||
double a = tcg::consts::rad_to_deg * tcg::point_ops::angle(oDir, ovxPos - ovxParentPos);
|
double a = tcg::point_ops::angle(oDir, ovxPos - ovxParentPos) * M_180_PI;
|
||||||
double d = tcg::point_ops::dist(ovxParentPos, ovxPos);
|
double d = tcg::point_ops::dist(ovxParentPos, ovxPos);
|
||||||
|
|
||||||
double aDelta = vd.m_params[SkVD::ANGLE]->getValue(frame);
|
double aDelta = vd.m_params[SkVD::ANGLE]->getValue(frame);
|
||||||
|
@ -1022,7 +1022,7 @@ void PlasticSkeletonDeformation::updatePosition(
|
||||||
// NOTE: The following aDelta calculation should be done as a true difference - this is still ok and spares
|
// NOTE: The following aDelta calculation should be done as a true difference - this is still ok and spares
|
||||||
// access to v's grandParent...
|
// access to v's grandParent...
|
||||||
|
|
||||||
double aDelta = tcg::consts::rad_to_deg * tcg::point_ops::angle(vPos - vParentPos, pos - vParentPos),
|
double aDelta = tcg::point_ops::angle(vPos - vParentPos, pos - vParentPos) * M_180_PI,
|
||||||
dDelta = tcg::point_ops::dist(vParentPos, pos) - tcg::point_ops::dist(vParentPos, vPos),
|
dDelta = tcg::point_ops::dist(vParentPos, pos) - tcg::point_ops::dist(vParentPos, vPos),
|
||||||
|
|
||||||
a = tcrop(vd.m_params[SkVD::ANGLE]->getValue(frame) + aDelta, vx.m_minAngle, vx.m_maxAngle),
|
a = tcrop(vd.m_params[SkVD::ANGLE]->getValue(frame) + aDelta, vx.m_minAngle, vx.m_maxAngle),
|
||||||
|
@ -1049,7 +1049,7 @@ void PlasticSkeletonDeformation::updateAngle(
|
||||||
|
|
||||||
SkVD &vd = m_imp->m_vds.find(vx.name())->m_vd;
|
SkVD &vd = m_imp->m_vds.find(vx.name())->m_vd;
|
||||||
|
|
||||||
double aDelta = tcg::consts::rad_to_deg * tcg::point_ops::angle(vx.P() - vParentPos, pos - vParentPos),
|
double aDelta = tcg::point_ops::angle(vx.P() - vParentPos, pos - vParentPos) * M_180_PI,
|
||||||
a = tcrop(vd.m_params[SkVD::ANGLE]->getValue(frame) + aDelta, vx.m_minAngle, vx.m_maxAngle);
|
a = tcrop(vd.m_params[SkVD::ANGLE]->getValue(frame) + aDelta, vx.m_minAngle, vx.m_maxAngle);
|
||||||
|
|
||||||
vd.m_params[SkVD::ANGLE]->setValue(frame, a);
|
vd.m_params[SkVD::ANGLE]->setValue(frame, a);
|
||||||
|
@ -1277,7 +1277,7 @@ void PlasticSkeletonDeformation::loadData_prerelease(TIStream &is)
|
||||||
// Now, rebuild vx's position
|
// Now, rebuild vx's position
|
||||||
SkVD &vd = sd.m_imp->m_vds.find(vx.name())->m_vd;
|
SkVD &vd = sd.m_imp->m_vds.find(vx.name())->m_vd;
|
||||||
|
|
||||||
double a = tcg::consts::rad_to_deg * tcg::point_ops::angle(dir, vxPos - vxParentPos);
|
double a = tcg::point_ops::angle(dir, vxPos - vxParentPos) * M_180_PI;
|
||||||
double d = tcg::point_ops::dist(vxParentPos, vxPos);
|
double d = tcg::point_ops::dist(vxParentPos, vxPos);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -427,7 +427,7 @@ public:
|
||||||
if (a2 < eps || b2 < eps)
|
if (a2 < eps || b2 < eps)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double dang = 180 * asin(cross(a, b) / sqrt(a2 * b2)) / TConsts::pi;
|
double dang = asin(cross(a, b) / sqrt(a2 * b2)) * M_180_PI;
|
||||||
setValue(getValue(0) + dang);
|
setValue(getValue(0) + dang);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -570,7 +570,7 @@ void AngleFxGadget::leftButtonDrag(const TPointD &pos, const TMouseEvent &)
|
||||||
{
|
{
|
||||||
TPointD d = pos - m_pos;
|
TPointD d = pos - m_pos;
|
||||||
double phi = atan2(d.y, d.x);
|
double phi = atan2(d.y, d.x);
|
||||||
setValue(m_param, TConsts::invOf_pi_180 * phi);
|
setValue(m_param, phi * M_180_PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -883,7 +883,7 @@ public:
|
||||||
glPopName();
|
glPopName();
|
||||||
|
|
||||||
if (isSelected()) {
|
if (isSelected()) {
|
||||||
double phiRad = TConsts::pi_180 * phi;
|
double phiRad = phi * M_PI_180;
|
||||||
TPointD toolTipPos = m_pos + r * TPointD(cos(phiRad), sin(phiRad));
|
TPointD toolTipPos = m_pos + r * TPointD(cos(phiRad), sin(phiRad));
|
||||||
drawTooltip(toolTipPos, getLabel());
|
drawTooltip(toolTipPos, getLabel());
|
||||||
}
|
}
|
||||||
|
@ -895,7 +895,7 @@ public:
|
||||||
TPointD d = pos - m_pos;
|
TPointD d = pos - m_pos;
|
||||||
double phi = atan2(d.y, d.x);
|
double phi = atan2(d.y, d.x);
|
||||||
double length = norm(d);
|
double length = norm(d);
|
||||||
setValue(m_phiParam, TConsts::invOf_pi_180 * phi);
|
setValue(m_phiParam, phi * M_180_PI);
|
||||||
setValue(m_lengthParam, length);
|
setValue(m_lengthParam, length);
|
||||||
}
|
}
|
||||||
void leftButtonUp(const TPointD &pos, const TMouseEvent &) {}
|
void leftButtonUp(const TPointD &pos, const TMouseEvent &) {}
|
||||||
|
|
|
@ -1116,7 +1116,7 @@ void RectanglePrimitive::leftButtonDrag(const TPointD &realPos, const TMouseEven
|
||||||
|
|
||||||
TPointD pos;
|
TPointD pos;
|
||||||
if (e.isShiftPressed()) {
|
if (e.isShiftPressed()) {
|
||||||
double distance = tdistance(realPos, m_startPoint) / TConsts::sqrt2;
|
double distance = tdistance(realPos, m_startPoint) * M_SQRT1_2;
|
||||||
pos.x = (realPos.x > m_startPoint.x) ? m_startPoint.x + distance
|
pos.x = (realPos.x > m_startPoint.x) ? m_startPoint.x + distance
|
||||||
: m_startPoint.x - distance;
|
: m_startPoint.x - distance;
|
||||||
pos.y = (realPos.y > m_startPoint.y) ? m_startPoint.y + distance
|
pos.y = (realPos.y > m_startPoint.y) ? m_startPoint.y + distance
|
||||||
|
@ -1845,7 +1845,7 @@ void EllipsePrimitive::leftButtonDrag(const TPointD &realPos, const TMouseEvent
|
||||||
|
|
||||||
TPointD pos;
|
TPointD pos;
|
||||||
if (e.isShiftPressed()) {
|
if (e.isShiftPressed()) {
|
||||||
double distance = tdistance(realPos, m_startPoint) / TConsts::sqrt2;
|
double distance = tdistance(realPos, m_startPoint) * M_SQRT1_2;
|
||||||
pos.x = (realPos.x > m_startPoint.x) ? m_startPoint.x + distance : m_startPoint.x - distance;
|
pos.x = (realPos.x > m_startPoint.x) ? m_startPoint.x + distance : m_startPoint.x - distance;
|
||||||
pos.y = (realPos.y > m_startPoint.y) ? m_startPoint.y + distance : m_startPoint.y - distance;
|
pos.y = (realPos.y > m_startPoint.y) ? m_startPoint.y + distance : m_startPoint.y - distance;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2086,8 +2086,8 @@ void PolygonPrimitive::draw()
|
||||||
if (edgeCount == 0)
|
if (edgeCount == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double angleDiff = TConsts::pi * 2.0 / edgeCount;
|
double angleDiff = M_2PI / edgeCount;
|
||||||
double angle = (3 * TConsts::pi + angleDiff) * 0.5;
|
double angle = (3 * M_PI + angleDiff) * 0.5;
|
||||||
|
|
||||||
glBegin(GL_LINE_LOOP);
|
glBegin(GL_LINE_LOOP);
|
||||||
for (int i = 0; i < edgeCount; i++) {
|
for (int i = 0; i < edgeCount; i++) {
|
||||||
|
@ -2145,8 +2145,8 @@ TStroke *PolygonPrimitive::makeStroke() const
|
||||||
if (edgeCount == 0)
|
if (edgeCount == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
double angleDiff = TConsts::pi * 2.0 / (double)edgeCount;
|
double angleDiff = M_2PI / (double)edgeCount;
|
||||||
double angle = (3 * TConsts::pi + angleDiff) * 0.5;
|
double angle = (3 * M_PI + angleDiff) * 0.5;
|
||||||
|
|
||||||
TStroke *stroke = 0;
|
TStroke *stroke = 0;
|
||||||
if (m_param->m_targetType & TTool::Vectors) {
|
if (m_param->m_targetType & TTool::Vectors) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ inline double computeStep(const TQuadratic& quad, double invOfPixelSize)
|
||||||
|
|
||||||
TPointD A = quad.getP0() - 2.0*quad.getP1() + quad.getP2(); // 2*A is the acceleration of the curve
|
TPointD A = quad.getP0() - 2.0*quad.getP1() + quad.getP2(); // 2*A is the acceleration of the curve
|
||||||
double A_len = norm(A);
|
double A_len = norm(A);
|
||||||
if (A_len > 0) step = TConsts::sqrt2 * sqrt(invOfPixelSize/A_len);
|
if (A_len > 0) step = sqrt(2 * invOfPixelSize / A_len);
|
||||||
|
|
||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2013,14 +2013,13 @@ void PlasticTool::drawAngleLimits(const SkDP &sd, int skelId, int v, double pixe
|
||||||
|
|
||||||
// Retrieve angular data
|
// Retrieve angular data
|
||||||
double angleShift = sd->vertexDeformation(skelId, v)->m_params[SkVD::ANGLE]->getValue(::frame());
|
double angleShift = sd->vertexDeformation(skelId, v)->m_params[SkVD::ANGLE]->getValue(::frame());
|
||||||
double defaultAngleValue = tcg::consts::rad_to_deg * tcg::point_ops::angle(
|
double defaultAngleValue = tcg::point_ops::angle(dirFromGrandParent, dirFromParent) * M_180_PI;
|
||||||
dirFromGrandParent, dirFromParent);
|
|
||||||
|
|
||||||
// Convert to radians
|
// Convert to radians
|
||||||
double currentBranchAngle_rad = tcg::point_ops::rad(dirFromDeformedGrandParent);
|
double currentBranchAngle_rad = tcg::point_ops::rad(dirFromDeformedGrandParent);
|
||||||
|
|
||||||
double currentAngle_rad = currentBranchAngle_rad + tcg::consts::deg_to_rad * (angleShift + defaultAngleValue);
|
double currentAngle_rad = currentBranchAngle_rad + (angleShift + defaultAngleValue) * M_PI_180;
|
||||||
double limitDirection_rad = currentBranchAngle_rad + tcg::consts::deg_to_rad * (angleLimit + defaultAngleValue);
|
double limitDirection_rad = currentBranchAngle_rad + (angleLimit + defaultAngleValue) * M_PI_180;
|
||||||
|
|
||||||
glColor4ub(0, 0, 255, 128);
|
glColor4ub(0, 0, 255, 128);
|
||||||
|
|
||||||
|
@ -2038,7 +2037,7 @@ void PlasticTool::drawAngleLimits(const SkDP &sd, int skelId, int v, double pixe
|
||||||
|
|
||||||
// Draw limit annulus arc
|
// Draw limit annulus arc
|
||||||
angleLimit = tcrop(angleLimit, angleShift - 180.0, angleShift + 180.0);
|
angleLimit = tcrop(angleLimit, angleShift - 180.0, angleShift + 180.0);
|
||||||
limitDirection_rad = currentBranchAngle_rad + tcg::consts::deg_to_rad * (angleLimit + defaultAngleValue);
|
limitDirection_rad = currentBranchAngle_rad + (angleLimit + defaultAngleValue) * M_PI_180;
|
||||||
|
|
||||||
double radius = tcg::point_ops::dist(defVx.P(), defVxParent.P()) * 0.25;
|
double radius = tcg::point_ops::dist(defVx.P(), defVxParent.P()) * 0.25;
|
||||||
|
|
||||||
|
|
|
@ -502,7 +502,7 @@ void DragSelectionTool::Rotation::leftButtonDrag(const TPointD &pos, const TMous
|
||||||
double scale = 1;
|
double scale = 1;
|
||||||
if (a2 <= epsilon || b2 <= epsilon)
|
if (a2 <= epsilon || b2 <= epsilon)
|
||||||
return;
|
return;
|
||||||
dang = -180 * asin(cross(a, b) / sqrt(a2 * b2)) / TConsts::pi;
|
dang = asin(cross(a, b) / sqrt(a2 * b2)) * -M_180_PI;
|
||||||
if (e.isShiftPressed()) {
|
if (e.isShiftPressed()) {
|
||||||
m_dstAng += dang;
|
m_dstAng += dang;
|
||||||
double ang = tfloor((int)(m_dstAng + 22.5), 45);
|
double ang = tfloor((int)(m_dstAng + 22.5), 45);
|
||||||
|
|
|
@ -240,7 +240,7 @@ void DragRotationTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &)
|
||||||
if (a2 < eps || b2 < eps)
|
if (a2 < eps || b2 < eps)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double dang = 180 * asin(cross(a, b) / sqrt(a2 * b2)) / TConsts::pi;
|
double dang = asin(cross(a, b) / sqrt(a2 * b2)) * M_180_PI;
|
||||||
|
|
||||||
if (m_snapped) {
|
if (m_snapped) {
|
||||||
if (fabs(dang) < 2)
|
if (fabs(dang) < 2)
|
||||||
|
@ -923,7 +923,7 @@ void IKTool::setAngleOffsets()
|
||||||
int frame = TTool::getApplication()->getCurrentFrame()->getFrame();
|
int frame = TTool::getApplication()->getCurrentFrame()->getFrame();
|
||||||
for (int i = 0; i < (int)m_joints.size(); i++) {
|
for (int i = 0; i < (int)m_joints.size(); i++) {
|
||||||
double angle = m_joints[i].m_bone->getStageObject()->getParam(TStageObject::T_Angle, frame);
|
double angle = m_joints[i].m_bone->getStageObject()->getParam(TStageObject::T_Angle, frame);
|
||||||
double theta0 = TConsts::pi_180 * angle;
|
double theta0 = angle * M_PI_180;
|
||||||
double theta1 = m_joints[i].m_sign * m_engine.getJointAngle(i);
|
double theta1 = m_joints[i].m_sign * m_engine.getJointAngle(i);
|
||||||
m_joints[i].m_angleOffset = theta1 - theta0;
|
m_joints[i].m_angleOffset = theta1 - theta0;
|
||||||
}
|
}
|
||||||
|
@ -978,7 +978,7 @@ void IKTool::apply()
|
||||||
TStageObject *obj = m_joints[i].m_bone->getStageObject();
|
TStageObject *obj = m_joints[i].m_bone->getStageObject();
|
||||||
TDoubleParam *param = obj->getParam(TStageObject::T_Angle);
|
TDoubleParam *param = obj->getParam(TStageObject::T_Angle);
|
||||||
double theta = m_joints[i].m_sign * m_engine.getJointAngle(i) - m_joints[i].m_angleOffset;
|
double theta = m_joints[i].m_sign * m_engine.getJointAngle(i) - m_joints[i].m_angleOffset;
|
||||||
theta *= TConsts::invOf_pi_180;
|
theta *= M_180_PI;
|
||||||
double oldTheta = param->getValue(frame);
|
double oldTheta = param->getValue(frame);
|
||||||
double delta = theta - oldTheta;
|
double delta = theta - oldTheta;
|
||||||
if (fabs(delta) > 180)
|
if (fabs(delta) > 180)
|
||||||
|
|
|
@ -535,7 +535,7 @@ void EraserTool::erase(TVectorImageP vi, const TPointD &pos)
|
||||||
std::vector<DoublePair> sortedWRanges;
|
std::vector<DoublePair> sortedWRanges;
|
||||||
|
|
||||||
std::vector<TStroke *> splitStrokes;
|
std::vector<TStroke *> splitStrokes;
|
||||||
double rectEdge_2 = m_pointSize * TConsts::sqrt2_2;
|
double rectEdge_2 = m_pointSize * M_SQRT1_2;
|
||||||
|
|
||||||
//quadrato iscritto nella circonferenza
|
//quadrato iscritto nella circonferenza
|
||||||
TRectD enrolledSquare(pos.x - rectEdge_2, pos.y - rectEdge_2, pos.x + rectEdge_2, pos.y + rectEdge_2);
|
TRectD enrolledSquare(pos.x - rectEdge_2, pos.y - rectEdge_2, pos.x + rectEdge_2, pos.y + rectEdge_2);
|
||||||
|
|
|
@ -215,7 +215,7 @@ public:
|
||||||
TPointD a = p - m_center;
|
TPointD a = p - m_center;
|
||||||
TPointD b = m_oldPos - m_center;
|
TPointD b = m_oldPos - m_center;
|
||||||
if (norm2(a) > 0 && norm2(b) > 0) {
|
if (norm2(a) > 0 && norm2(b) > 0) {
|
||||||
double ang = 180 * asin(cross(b, a) / (norm(a) * norm(b))) / TConsts::pi;
|
double ang = asin(cross(b, a) / (norm(a) * norm(b))) * M_180_PI;
|
||||||
m_angle = m_angle + ang;
|
m_angle = m_angle + ang;
|
||||||
m_viewer->rotate(m_center, m_angle);
|
m_viewer->rotate(m_center, m_angle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,7 +239,7 @@ void RenderController::generateMovie(TFilePath outPath, bool emitSignal)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (TException &e) {
|
} catch (TException const&) {
|
||||||
QString msg;
|
QString msg;
|
||||||
msg = QObject::tr("There were problems loading the scene %1.\n Some files may be missing.").arg(QString::fromStdWString(fp.getWideString()));
|
msg = QObject::tr("There were problems loading the scene %1.\n Some files may be missing.").arg(QString::fromStdWString(fp.getWideString()));
|
||||||
|
|
||||||
|
|
|
@ -749,8 +749,8 @@ TPointD SceneViewer::winToWorld(const QPoint &pos) const
|
||||||
|
|
||||||
TPointD p(pp.x - m_pan3D.x, pp.y - m_pan3D.y);
|
TPointD p(pp.x - m_pan3D.x, pp.y - m_pan3D.y);
|
||||||
p = p * (1 / m_zoomScale3D);
|
p = p * (1 / m_zoomScale3D);
|
||||||
double theta = TConsts::pi * m_theta3D / 180.0;
|
double theta = m_theta3D * M_PI_180;
|
||||||
double phi = TConsts::pi * m_phi3D / 180.0;
|
double phi = m_phi3D * M_PI_180;
|
||||||
double cs_phi = cos(phi);
|
double cs_phi = cos(phi);
|
||||||
double sn_phi = sin(phi);
|
double sn_phi = sin(phi);
|
||||||
double cs_theta = cos(theta);
|
double cs_theta = cos(theta);
|
||||||
|
|
|
@ -679,7 +679,7 @@ void CellArea::drawCells(QPainter &p, const QRect toBeUpdated)
|
||||||
if (!cellSelection->isEmpty())
|
if (!cellSelection->isEmpty())
|
||||||
cellSelection->getSelectedCells(rS0, cS0, rS1, cS1);
|
cellSelection->getSelectedCells(rS0, cS0, rS1, cS1);
|
||||||
|
|
||||||
int r0, r1, c0, c1; // range di righe e colonne visibili
|
int r0, r1, c0, c1; // range of visible rows and columns
|
||||||
r0 = m_viewer->yToRow(toBeUpdated.top());
|
r0 = m_viewer->yToRow(toBeUpdated.top());
|
||||||
r1 = m_viewer->yToRow(toBeUpdated.bottom());
|
r1 = m_viewer->yToRow(toBeUpdated.bottom());
|
||||||
c0 = m_viewer->xToColumn(toBeUpdated.left());
|
c0 = m_viewer->xToColumn(toBeUpdated.left());
|
||||||
|
@ -1419,7 +1419,7 @@ void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated)
|
||||||
|
|
||||||
void CellArea::drawNotes(QPainter &p, const QRect toBeUpdated)
|
void CellArea::drawNotes(QPainter &p, const QRect toBeUpdated)
|
||||||
{
|
{
|
||||||
int r0, r1, c0, c1; // range di righe e colonne visibili
|
int r0, r1, c0, c1; // range of visible rows and columns
|
||||||
r0 = m_viewer->yToRow(toBeUpdated.top());
|
r0 = m_viewer->yToRow(toBeUpdated.top());
|
||||||
r1 = m_viewer->yToRow(toBeUpdated.bottom());
|
r1 = m_viewer->yToRow(toBeUpdated.bottom());
|
||||||
c0 = m_viewer->xToColumn(toBeUpdated.left());
|
c0 = m_viewer->xToColumn(toBeUpdated.left());
|
||||||
|
|
|
@ -119,11 +119,6 @@ TFilePath getLocalRoot()
|
||||||
lroot = TFilePath(pathName);
|
lroot = TFilePath(pathName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TFilePath name = TFilePath("TFARMLOCALROOT");
|
|
||||||
//char *s = getenv(toString(name.getWideString()).c_str());
|
|
||||||
//lroot = TFilePath(s?s:"");
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return lroot;
|
return lroot;
|
||||||
}
|
}
|
||||||
|
@ -179,15 +174,6 @@ bool loadControllerData(QString &hostName, QString &addr, int &port)
|
||||||
bool isAScript(TFarmTask *task)
|
bool isAScript(TFarmTask *task)
|
||||||
{
|
{
|
||||||
return false; //todo per gli script
|
return false; //todo per gli script
|
||||||
/*
|
|
||||||
#ifdef _WIN32
|
|
||||||
return task->m_cmdline.contains(".bat");
|
|
||||||
#else
|
|
||||||
return (task->m_cmdline.contains(".csh")||
|
|
||||||
task->m_cmdline.contains(".sh")||
|
|
||||||
task->m_cmdline.contains(".tcsh"))
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
@ -1117,10 +1103,7 @@ CtrlFarmTask *FarmController::doAddTask(
|
||||||
|
|
||||||
if (suspended)
|
if (suspended)
|
||||||
task->m_status = Suspended;
|
task->m_status = Suspended;
|
||||||
/*
|
|
||||||
else
|
|
||||||
tryToStartTask(task);
|
|
||||||
*/
|
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1723,24 +1706,6 @@ void FarmController::getTasks(const QString &parentId, vector<TaskShortInfo> &ta
|
||||||
if (task->m_parentId == parentId)
|
if (task->m_parentId == parentId)
|
||||||
tasks.push_back(TaskShortInfo(task->m_id, task->m_name, task->m_status));
|
tasks.push_back(TaskShortInfo(task->m_id, task->m_name, task->m_status));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
map<TaskId, CtrlFarmTask*>::iterator it = m_tasks.find(parentId);
|
|
||||||
if (it != m_tasks.end())
|
|
||||||
{
|
|
||||||
CtrlFarmTask *task = it->second;
|
|
||||||
vector<std::string>::iterator itSubTakId = task->m_subTasks.begin();
|
|
||||||
for ( ; itSubTakId != task->m_subTasks.end(); ++itSubTakId)
|
|
||||||
{
|
|
||||||
map<std::string, CtrlFarmTask*>::iterator itSubTask = m_tasks.find(*itSubTakId);
|
|
||||||
if (itSubTask != m_tasks.end())
|
|
||||||
{
|
|
||||||
CtrlFarmTask *subTask = itSubTask->second;
|
|
||||||
tasks.push_back(TaskShortInfo(*itSubTakId, subTask->m_name, subTask->m_status));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -1868,21 +1833,9 @@ void FarmController::taskSubmissionError(const QString &taskId, int errCode)
|
||||||
server = itServer->second;
|
server = itServer->second;
|
||||||
|
|
||||||
if (server) {
|
if (server) {
|
||||||
/*
|
|
||||||
string msg = "Task " + taskId + " completed on ";
|
|
||||||
msg += server->getHostName().c_str();
|
|
||||||
msg += "\n\n";
|
|
||||||
m_userLog->info(msg);
|
|
||||||
*/
|
|
||||||
server->removeTask(taskId);
|
server->removeTask(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if (parentTask && parentTask->m_status == Completed)
|
|
||||||
{
|
|
||||||
m_userLog->info("Task " + parentTask->m_id + " completed\n\n");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (task->m_toBeDeleted)
|
if (task->m_toBeDeleted)
|
||||||
delete task;
|
delete task;
|
||||||
if (parentTask && parentTask->m_toBeDeleted)
|
if (parentTask && parentTask->m_toBeDeleted)
|
||||||
|
@ -2007,14 +1960,6 @@ void FarmController::taskCompleted(const QString &taskId, int exitCode)
|
||||||
break;
|
break;
|
||||||
} else if (subTask->m_status == Aborted)
|
} else if (subTask->m_status == Aborted)
|
||||||
aSubTaskFailed = true;
|
aSubTaskFailed = true;
|
||||||
|
|
||||||
/*
|
|
||||||
if (subTask->m_status == Running || subTask->m_status == Waiting)
|
|
||||||
parentTaskState = Running;
|
|
||||||
else
|
|
||||||
if (subTask->m_status == Aborted)
|
|
||||||
aSubTaskFailed = true;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -2354,11 +2299,6 @@ void ControllerService::onStart(int argc, char *argv[])
|
||||||
// Initialize thread components
|
// Initialize thread components
|
||||||
TThread::init();
|
TThread::init();
|
||||||
|
|
||||||
/*
|
|
||||||
#ifdef _DEBUG
|
|
||||||
DebugBreak();
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
if (isRunningAsConsoleApp()) {
|
if (isRunningAsConsoleApp()) {
|
||||||
// i messaggi verranno ridiretti sullo standard output
|
// i messaggi verranno ridiretti sullo standard output
|
||||||
m_userLog = new TUserLog();
|
m_userLog = new TUserLog();
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <strstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
@ -128,14 +128,6 @@ TFilePath getLocalRoot()
|
||||||
return lroot;
|
return lroot;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
TFilePath getAppsCfgFilePath()
|
|
||||||
{
|
|
||||||
TFilePath appsRoot = getLocalRoot();
|
|
||||||
return appsRoot + "config" + "apppath.cfg";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
TFilePath getBinRoot()
|
TFilePath getBinRoot()
|
||||||
|
@ -147,19 +139,6 @@ TFilePath getBinRoot()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
string myGetHostName()
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
return TSystem::getHostName();
|
|
||||||
#else
|
|
||||||
char hostName[MAXHOSTNAMELEN];
|
|
||||||
gethostname((char*)&hostName, MAXHOSTNAMELEN);
|
|
||||||
return hostName;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
bool dirExists(const TFilePath &dirFp)
|
bool dirExists(const TFilePath &dirFp)
|
||||||
|
@ -515,40 +494,10 @@ FarmServer::~FarmServer()
|
||||||
delete m_executor;
|
delete m_executor;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
inline std::string toString(unsigned long value)
|
|
||||||
{
|
|
||||||
std::ostrstream ss;
|
|
||||||
ss << value << '\0';
|
|
||||||
std::string s = ss.str();
|
|
||||||
ss.freeze(false);
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
void FarmServer::setAppPaths(const vector<TFilePath> &appPaths)
|
|
||||||
{
|
|
||||||
m_appPaths = appPaths;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
QString FarmServer::execute(const vector<QString> &argv)
|
QString FarmServer::execute(const vector<QString> &argv)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
#ifdef _DEBUG
|
|
||||||
std::cout << endl << "executing " << argv[0].c_str() << endl << endl;
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (argv.size() > 0) {
|
if (argv.size() > 0) {
|
||||||
/*
|
|
||||||
#ifdef _DEBUG
|
|
||||||
for (int i=0; i<argv.size(); ++i)
|
|
||||||
std::cout << argv[i] << " ";
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
if (argv[0] == "addTask" && argv.size() == 3) {
|
if (argv[0] == "addTask" && argv.size() == 3) {
|
||||||
//assert(!"Da fare");
|
//assert(!"Da fare");
|
||||||
int ret = addTask(argv[1], argv[2]);
|
int ret = addTask(argv[1], argv[2]);
|
||||||
|
@ -801,26 +750,22 @@ bool loadServerData(const QString &hostname, QString &addr, int &port)
|
||||||
if (!is.good())
|
if (!is.good())
|
||||||
return false;
|
return false;
|
||||||
while (!is.eof()) {
|
while (!is.eof()) {
|
||||||
/*
|
|
||||||
char line[256];
|
|
||||||
is.getline(line, 256);
|
|
||||||
*/
|
|
||||||
std::string line = getLine(is);
|
std::string line = getLine(is);
|
||||||
std::istrstream iss(line.c_str());
|
std::istringstream iss(line);
|
||||||
|
|
||||||
char name[80];
|
std::string name;
|
||||||
char ipAddress[80];
|
std::string ipAddress;
|
||||||
|
|
||||||
iss >> name >> ipAddress >> port;
|
iss >> name >> ipAddress >> port;
|
||||||
if (name[0] == '#')
|
if (name[0] == '#')
|
||||||
continue;
|
continue;
|
||||||
#if QT_VERSION >= 0x050500
|
#if QT_VERSION >= 0x050500
|
||||||
if (STRICMP(hostname.toUtf8(), name) == 0)
|
if (STRICMP(hostname.toUtf8(), name.c_str()) == 0)
|
||||||
#else
|
#else
|
||||||
if (STRICMP(hostname.toAscii(), name) == 0)
|
if (STRICMP(hostname.toAscii(), name.c_str()) == 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
addr = QString(ipAddress);
|
addr = QString(ipAddress.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -947,7 +892,7 @@ void FarmServerService::onStart(int argc, char *argv[])
|
||||||
|
|
||||||
try {
|
try {
|
||||||
m_farmServer->getController()->attachServer(TSystem::getHostName(), m_addr, m_port);
|
m_farmServer->getController()->attachServer(TSystem::getHostName(), m_addr, m_port);
|
||||||
} catch (TException & /*e*/) {
|
} catch (TException const&) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -967,24 +912,6 @@ void FarmServerService::onStart(int argc, char *argv[])
|
||||||
// si assume che il path del folder del programma sia specificato
|
// si assume che il path del folder del programma sia specificato
|
||||||
// nella variabile di sistema PATH
|
// nella variabile di sistema PATH
|
||||||
|
|
||||||
/*
|
|
||||||
vector<TFilePath> appPaths;
|
|
||||||
TFilePath appsCfgFile = getAppsCfgFilePath();
|
|
||||||
|
|
||||||
Tifstream isAppCfgFile(appsCfgFile);
|
|
||||||
if (!isAppCfgFile.good())
|
|
||||||
std::cout << "Error: " << appsCfgFile << endl;
|
|
||||||
while (!isAppCfgFile.eof())
|
|
||||||
{
|
|
||||||
std::string line = getLine(isAppCfgFile);
|
|
||||||
istrstream iss(line.c_str());
|
|
||||||
TFilePath appPath = TFilePath(line);
|
|
||||||
appPaths.push_back(appPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_farmServer->setAppPaths(appPaths);
|
|
||||||
*/
|
|
||||||
|
|
||||||
QEventLoop eventLoop;
|
QEventLoop eventLoop;
|
||||||
|
|
||||||
//Connect the server's listening finished signal to main loop quit.
|
//Connect the server's listening finished signal to main loop quit.
|
||||||
|
@ -1034,7 +961,7 @@ void FarmServerService::onStart(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string msg("Exiting with code ");
|
std::string msg("Exiting with code ");
|
||||||
msg += toString(ret);
|
msg += std::to_string(ret);
|
||||||
msg += "\n";
|
msg += "\n";
|
||||||
m_userLog->info(QString::fromStdString(msg));
|
m_userLog->info(QString::fromStdString(msg));
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
|
|
||||||
double m_csp, m_snp, m_csm, m_snm, m_csa, m_sna, m_csb, m_snb;
|
double m_csp, m_snp, m_csm, m_snm, m_csa, m_sna, m_csb, m_snb;
|
||||||
|
|
||||||
Imp(const TRasterP &r, int distance = 10, double angle = (180 * TConsts::pi) / 360.0, int index = 0, int opacity = 0)
|
Imp(const TRasterP &r, int distance = 10, double angle = M_PI_2, int index = 0, int opacity = 0)
|
||||||
: m_raster(r), m_spotAngle(angle), m_closingDistance(distance), m_inkIndex(index), m_opacity(opacity)
|
: m_raster(r), m_spotAngle(angle), m_closingDistance(distance), m_inkIndex(index), m_opacity(opacity)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1505,10 +1505,10 @@ int get_image_rotation_and_center(const TRasterP &img, int strip_width,
|
||||||
switch (pegs_side) {
|
switch (pegs_side) {
|
||||||
case PEGS_LEFT:
|
case PEGS_LEFT:
|
||||||
case PEGS_RIGHT:
|
case PEGS_RIGHT:
|
||||||
angle += dy == 0.0 ? TConsts::pi_2 : atan(dx / dy);
|
angle += dy == 0.0 ? M_PI_2 : atan(dx / dy);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
angle -= dx == 0.0 ? TConsts::pi_2 : atan(dy / dx);
|
angle -= dx == 0.0 ? M_PI_2 : atan(dy / dx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -471,8 +471,8 @@ bool TCleanupper::getResampleValues(const TRasterImageP &image, TAffine &aff, do
|
||||||
|
|
||||||
// Build the image transform as deduced by the autocenter
|
// Build the image transform as deduced by the autocenter
|
||||||
if (m_parameters->m_autocenterType == AUTOCENTER_CTR && skew) {
|
if (m_parameters->m_autocenterType == AUTOCENTER_CTR && skew) {
|
||||||
pre_aff.a11 = cos(skew * TConsts::pi_180);
|
pre_aff.a11 = cos(skew * M_PI_180);
|
||||||
pre_aff.a21 = sin(skew * TConsts::pi_180);
|
pre_aff.a21 = sin(skew * M_PI_180);
|
||||||
}
|
}
|
||||||
|
|
||||||
aff = (TScale(scalex, scaley) * pre_aff) * TRotation(angle);
|
aff = (TScale(scalex, scaley) * pre_aff) * TRotation(angle);
|
||||||
|
@ -807,8 +807,8 @@ TRasterImageP TCleanupper::autocenterOnly(
|
||||||
autocentered = true;
|
autocentered = true;
|
||||||
|
|
||||||
if (m_parameters->m_autocenterType == AUTOCENTER_CTR && skew) {
|
if (m_parameters->m_autocenterType == AUTOCENTER_CTR && skew) {
|
||||||
aff.a11 = cos(skew * TConsts::pi_180);
|
aff.a11 = cos(skew * M_PI_180);
|
||||||
aff.a21 = sin(skew * TConsts::pi_180);
|
aff.a21 = sin(skew * M_PI_180);
|
||||||
}
|
}
|
||||||
|
|
||||||
aff = aff * TRotation(angle);
|
aff = aff * TRotation(angle);
|
||||||
|
@ -960,7 +960,7 @@ bool TCleanupper::doAutocenter(
|
||||||
&angle, &cx, &cy, &fdg_info.dots[0], fdg_info.dots.size())) {
|
&angle, &cx, &cy, &fdg_info.dots[0], fdg_info.dots.size())) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
angle *= TConsts::invOf_pi_180;
|
angle *= M_180_PI;
|
||||||
cxin = cx;
|
cxin = cx;
|
||||||
cyin = cy;
|
cyin = cy;
|
||||||
double dist = (double)mmToPixel(fdg_info.dist_ctr_to_ctr_hole, xdpi * scalex);
|
double dist = (double)mmToPixel(fdg_info.dist_ctr_to_ctr_hole, xdpi * scalex);
|
||||||
|
|
|
@ -261,7 +261,7 @@ class PolylineReader
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PolylineReader(TVectorImageP vi, const NewOutlineConfiguration &conf)
|
PolylineReader(TVectorImageP vi, const NewOutlineConfiguration &conf)
|
||||||
: m_vi(vi), m_conf(conf), m_adherenceTol(2.0 * (1.0 - m_conf.m_adherenceTol)), m_angleTol(cos(TConsts::pi * m_conf.m_angleTol)), m_relativeTol(conf.m_relativeTol), m_mergeTol(m_conf.m_mergeTol) {}
|
: m_vi(vi), m_conf(conf), m_adherenceTol(2.0 * (1.0 - m_conf.m_adherenceTol)), m_angleTol(cos(M_PI * m_conf.m_angleTol)), m_relativeTol(conf.m_relativeTol), m_mergeTol(m_conf.m_mergeTol) {}
|
||||||
|
|
||||||
void setEvaluator(const RasterEdgeEvaluator<RanIt> *eval) { m_eval = eval; }
|
void setEvaluator(const RasterEdgeEvaluator<RanIt> *eval) { m_eval = eval; }
|
||||||
|
|
||||||
|
|
|
@ -522,7 +522,7 @@ void SwatchViewer::updateRaster()
|
||||||
int len = tround(sqrt((double)(delta * delta)));
|
int len = tround(sqrt((double)(delta * delta)));
|
||||||
double phi = 0;
|
double phi = 0;
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
phi = 180 * atan2((double)delta.y, (double)delta.x) / TConsts::pi;
|
phi = atan2((double)delta.y, (double)delta.x) * M_180_PI;
|
||||||
|
|
||||||
if (len > 500) {
|
if (len > 500) {
|
||||||
// puo' succedere per zoom molto grandi.
|
// puo' succedere per zoom molto grandi.
|
||||||
|
|
Loading…
Reference in a new issue