summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2011-07-15 14:41:15 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2011-07-15 14:41:15 +0200
commit848c3254b97b740fa60aaee3c59a949206c705d8 (patch)
tree64569cd1cf4e61241d6603059a41ab064efd52c4
parent44f8e4ccf69cb7e922846f145a4c7f4abce513b4 (diff)
Bounding box algorithm needs angle in radians
-rw-r--r--writerperfect/source/filter/OdgGenerator.cxx22
1 files changed, 11 insertions, 11 deletions
diff --git a/writerperfect/source/filter/OdgGenerator.cxx b/writerperfect/source/filter/OdgGenerator.cxx
index 30d3e7a2a..1d073a387 100644
--- a/writerperfect/source/filter/OdgGenerator.cxx
+++ b/writerperfect/source/filter/OdgGenerator.cxx
@@ -49,6 +49,7 @@ static void getEllipticalArcBBox(double x1, double y1,
double rx, double ry, double phi, bool largeArc, bool sweep, double x2, double y2,
double &xmin, double &ymin, double &xmax, double &ymax)
{
+ phi *= M_PI/180;
if (rx < 0.0)
rx *= -1.0;
if (ry < 0.0)
@@ -149,31 +150,30 @@ static void getEllipticalArcBBox(double x1, double y1,
txmax = M_PI - atan (ry*tan(phi)/rx);
xmin = cx + rx*cos(txmin)*cos(phi) - ry*sin(txmin)*sin(phi);
xmax = cx + rx*cos(txmax)*cos(phi) - ry*sin(txmax)*sin(phi);
- if (xmin > xmax)
- {
- std::swap(xmin,xmax);
- std::swap(txmin,txmax);
- }
double tmpY = cy + rx*cos(txmin)*sin(phi) + ry*sin(txmin)*cos(phi);
txmin = getAngle(xmin - cx, tmpY - cy);
tmpY = cy + rx*cos(txmax)*sin(phi) + ry*sin(txmax)*cos(phi);
txmax = getAngle(xmax - cx, tmpY - cy);
-
tymin = atan(ry/(tan(phi)*rx));
tymax = atan(ry/(tan(phi)*rx))+M_PI;
ymin = cy + rx*cos(tymin)*sin(phi) + ry*sin(tymin)*cos(phi);
ymax = cy + rx*cos(tymax)*sin(phi) + ry*sin(tymax)*cos(phi);
- if (ymin > ymax)
- {
- std::swap(ymin,ymax);
- std::swap(tymin,tymax);
- }
double tmpX = cx + rx*cos(tymin)*cos(phi) - ry*sin(tymin)*sin(phi);
tymin = getAngle(tmpX - cx, ymin - cy);
tmpX = cx + rx*cos(tymax)*cos(phi) - ry*sin(tymax)*sin(phi);
tymax = getAngle(tmpX - cx, ymax - cy);
}
+ if (xmin > xmax)
+ {
+ std::swap(xmin,xmax);
+ std::swap(txmin,txmax);
+ }
+ if (ymin > ymax)
+ {
+ std::swap(ymin,ymax);
+ std::swap(tymin,tymax);
+ }
double angle1 = getAngle(x1 - cx, y1 - cy);
double angle2 = getAngle(x2 - cx, y2 - cy);