From 90bb2311a8e87439c8ae845fcf22755e40030d1d Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Sat, 2 Nov 2013 09:04:00 -0400 Subject: more conversions from radians to degrees for arcs (Bug 1239462) Fixed bugs: - https://launchpad.net/bugs/1239462 (bzr r12763) --- src/livarot/PathConversion.cpp | 9 +++++---- src/livarot/PathCutting.cpp | 2 +- src/livarot/PathOutline.cpp | 4 ++-- src/livarot/ShapeMisc.cpp | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/livarot/PathConversion.cpp b/src/livarot/PathConversion.cpp index 6fa0c166f..42df898e6 100644 --- a/src/livarot/PathConversion.cpp +++ b/src/livarot/PathConversion.cpp @@ -1076,13 +1076,14 @@ void Path::DoArc(Geom::Point const &iS, Geom::Point const &iE, double sang; double eang; Geom::Point dr_temp; - ArcAnglesAndCenter(iS, iE, rx, ry, angle, large, wise, sang, eang, dr_temp); + ArcAnglesAndCenter(iS, iE, rx, ry, angle*M_PI/180.0, large, wise, sang, eang, dr_temp); Geom::Point dr = dr_temp; /* TODO: This isn't as good numerically as treating iS and iE as primary. E.g. consider the case of low curvature (i.e. very large radius). */ Geom::Scale const ar(rx, ry); - Geom::Rotate cb(angle + sang); + Geom::Rotate cb(sang); + Geom::Rotate cbangle(angle*M_PI/180.0); if (wise) { double const incr = -0.1; @@ -1092,7 +1093,7 @@ void Path::DoArc(Geom::Point const &iS, Geom::Point const &iE, Geom::Rotate const omega(incr); for (double b = sang + incr; b > eang ;b += incr) { cb = omega * cb; - AddPoint(cb.vector() * ar + dr, piece, (sang - b) / (sang - eang)); + AddPoint(cb.vector() * ar * cbangle + dr, piece, (sang - b) / (sang - eang)); } } else { @@ -1103,7 +1104,7 @@ void Path::DoArc(Geom::Point const &iS, Geom::Point const &iE, Geom::Rotate const omega(incr); for (double b = sang + incr ; b < eang ; b += incr) { cb = omega * cb; - AddPoint(cb.vector() * ar + dr, piece, (b - sang) / (eang - sang)); + AddPoint(cb.vector() * ar * cbangle + dr, piece, (b - sang) / (eang - sang)); } } } diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp index 1ebac7644..201f64b54 100644 --- a/src/livarot/PathCutting.cpp +++ b/src/livarot/PathCutting.cpp @@ -1217,7 +1217,7 @@ void Path::ConvertPositionsToForced(int nbPos, cut_position *poss) } { double sang,eang; - ArcAngles(startP,endP,rx,ry,angle,large,clockw,sang,eang); + ArcAngles(startP,endP,rx,ry,angle*M_PI/180.0,large,clockw,sang,eang); if (clockw) { if ( sang < eang ) sang += 2*M_PI; diff --git a/src/livarot/PathOutline.cpp b/src/livarot/PathOutline.cpp index 2cd359328..fbfaa98aa 100644 --- a/src/livarot/PathOutline.cpp +++ b/src/livarot/PathOutline.cpp @@ -930,7 +930,7 @@ void Path::TangentOnArcAt(double at, const Geom::Point &iS, PathDescrArcTo const Geom::Point const iE = fin.p; double const rx = fin.rx; double const ry = fin.ry; - double const angle = fin.angle; + double const angle = fin.angle*M_PI/180.0; bool const large = fin.large; bool const wise = fin.clockwise; @@ -1442,7 +1442,7 @@ Path::RecStdArcTo (outline_callback_data * data, double tol, double width, { Geom::Point tms(data->x1,data->y1),tme(data->x2,data->y2); ArcAngles (tms,tme, data->d.a.rx, - data->d.a.ry, data->d.a.angle, data->d.a.large, !data->d.a.clock, + data->d.a.ry, data->d.a.angle*M_PI/180.0, data->d.a.large, !data->d.a.clock, sang, eang); } double scal = eang - sang; diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index e40915cba..e5a98f0cf 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -1056,7 +1056,7 @@ Shape::ReFormeArcTo (int bord, int /*curBord*/, Path * dest, Path * from) PathDescrArcTo* nData = dynamic_cast(from->descr_cmd[nPiece]); bool nLarge = nData->large; bool nClockwise = nData->clockwise; - Path::ArcAngles (from->PrevPoint (nPiece - 1), nData->p,nData->rx,nData->ry,nData->angle, nLarge, nClockwise, sang, eang); + Path::ArcAngles (from->PrevPoint (nPiece - 1), nData->p,nData->rx,nData->ry,nData->angle*M_PI/180.0, nLarge, nClockwise, sang, eang); if (nClockwise) { if (sang < eang) -- cgit v1.2.3