summaryrefslogtreecommitdiffstats
path: root/src/2geom/elliptical-arc.cpp
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2014-03-27 01:33:44 +0000
committerMartin Owens <doctormo@gmail.com>2014-03-27 01:33:44 +0000
commit5a4fb2325f60d292b47330f540b26a3279341c90 (patch)
treed2aa7967be25450b83e625025366c618101ae49f /src/2geom/elliptical-arc.cpp
parentThe Polar Arrange Tab of the Arrange Dialog now hides the parametric (diff)
parentRemove Snap menu item and improve grid menu item text (diff)
downloadinkscape-5a4fb2325f60d292b47330f540b26a3279341c90.tar.gz
inkscape-5a4fb2325f60d292b47330f540b26a3279341c90.zip
Commit a merge to trunk, with probabal errors
(bzr r11073.1.36)
Diffstat (limited to 'src/2geom/elliptical-arc.cpp')
-rw-r--r--src/2geom/elliptical-arc.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/2geom/elliptical-arc.cpp b/src/2geom/elliptical-arc.cpp
index 75b6777a2..c96d5f1a6 100644
--- a/src/2geom/elliptical-arc.cpp
+++ b/src/2geom/elliptical-arc.cpp
@@ -115,9 +115,11 @@ Rect EllipticalArc::boundsExact() const
if ( arc_extremes[2] < arc_extremes[3] )
std::swap(arc_extremes[2], arc_extremes[3]);
- for (unsigned i = 0; i < 4; ++i) {
- if (containsAngle(extremes[i])) {
- arc_extremes[i] = valueAtAngle(extremes[i], (i >> 1) ? Y : X);
+ if ( !are_near(initialPoint(), finalPoint()) ) {
+ for (unsigned i = 0; i < 4; ++i) {
+ if (containsAngle(extremes[i])) {
+ arc_extremes[i] = valueAtAngle(extremes[i], (i >> 1) ? Y : X);
+ }
}
}
@@ -202,7 +204,7 @@ std::vector<Coord> EllipticalArc::roots(Coord v, Dim2 d) const
{
return sol;
}
- double ray_prj;
+ double ray_prj = 0.0;
switch(d)
{
case X:
@@ -264,7 +266,7 @@ std::vector<Coord> EllipticalArc::roots(Coord v, Dim2 d) const
}
double rotx, roty;
- sincos(_rot_angle, roty, rotx);
+ sincos(_rot_angle, roty, rotx); /// \todo sin and cos are calculated in many places in this function, optimize this a bit!
if (d == X) roty = -roty;
double rxrotx = ray(X) * rotx;
@@ -360,7 +362,7 @@ EllipticalArc::pointAndDerivatives(Coord t, unsigned int n) const
for ( unsigned int i = 0; i < m; ++i )
{
result.push_back( ea->pointAtAngle(angle) );
- angle += M_PI/2;
+ angle += (_sweep ? M_PI/2 : -M_PI/2);
if ( !(angle < 2*M_PI) ) angle -= 2*M_PI;
}
m = nn / 4;
@@ -569,7 +571,7 @@ std::vector<double> EllipticalArc::allNearestPoints( Point const& p, double from
double mindistsq1 = std::numeric_limits<double>::max();
double mindistsq2 = std::numeric_limits<double>::max();
double dsq;
- unsigned int mi1, mi2;
+ unsigned int mi1 = 0, mi2 = 0;
for ( unsigned int i = 0; i < real_sol.size(); ++i )
{
dsq = distanceSq(p, pointAtAngle(real_sol[i]));