summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlvin Penner <penner@vaxxine.com>2013-10-31 19:55:53 +0000
committerapenner <penner@vaxxine.com>2013-10-31 19:55:53 +0000
commitc3ced8096db500874adff64150520c4bb69bd5eb (patch)
tree5fbb988e05dde596b1e51a9cb2beb270f07d239c
parentRemove warning on bbox and allow empty bound selection to clear existing sele... (diff)
downloadinkscape-c3ced8096db500874adff64150520c4bb69bd5eb.tar.gz
inkscape-c3ced8096db500874adff64150520c4bb69bd5eb.zip
conversions from radians to degrees for arcs (Bug 324117)
Fixed bugs: - https://launchpad.net/bugs/324117 (bzr r12756)
-rw-r--r--src/livarot/PathConversion.cpp18
-rw-r--r--src/livarot/PathCutting.cpp4
2 files changed, 12 insertions, 10 deletions
diff --git a/src/livarot/PathConversion.cpp b/src/livarot/PathConversion.cpp
index 8d36dca4c..6fa0c166f 100644
--- a/src/livarot/PathConversion.cpp
+++ b/src/livarot/PathConversion.cpp
@@ -813,13 +813,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;
@@ -829,7 +830,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 );
+ AddPoint( cb.vector() * ar * cbangle + dr );
}
} else {
@@ -841,7 +842,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);
+ AddPoint( cb.vector() * ar * cbangle + dr);
}
}
}
@@ -956,13 +957,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;
@@ -972,7 +974,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 {
@@ -984,7 +986,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 3ce907bf3..1ebac7644 100644
--- a/src/livarot/PathCutting.cpp
+++ b/src/livarot/PathCutting.cpp
@@ -303,7 +303,7 @@ Path::MakePathVector()
{
/* TODO: add testcase for this descr_arcto case */
PathDescrArcTo *nData = dynamic_cast<PathDescrArcTo *>(descr_cmd[i]);
- currentpath->appendNew<Geom::SVGEllipticalArc>( nData->rx, nData->ry, nData->angle, nData->large, !nData->clockwise, nData->p );
+ currentpath->appendNew<Geom::SVGEllipticalArc>( nData->rx, nData->ry, nData->angle*M_PI/180.0, nData->large, !nData->clockwise, nData->p );
lastP = nData->p;
}
break;
@@ -398,7 +398,7 @@ void Path::AddCurve(Geom::Curve const &c)
else if(Geom::SVGEllipticalArc const *svg_elliptical_arc = dynamic_cast<Geom::SVGEllipticalArc const *>(&c)) {
ArcTo( svg_elliptical_arc->finalPoint(),
svg_elliptical_arc->ray(Geom::X), svg_elliptical_arc->ray(Geom::Y),
- svg_elliptical_arc->rotationAngle(), /// \todo check that this parameter is in radians (rotation_angle returns the angle in radians!)
+ svg_elliptical_arc->rotationAngle()*180.0/M_PI, // convert from radians to degrees
svg_elliptical_arc->largeArc(), !svg_elliptical_arc->sweep() );
} else {
//this case handles sbasis as well as all other curve types