[Libreoffice-commits] .: writerperfect/source
Fridrich Strba
fridrich at kemper.freedesktop.org
Fri Jul 15 06:00:48 PDT 2011
writerperfect/source/filter/OdgGenerator.cxx | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
New commits:
commit 848c3254b97b740fa60aaee3c59a949206c705d8
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Fri Jul 15 14:41:15 2011 +0200
Bounding box algorithm needs angle in radians
diff --git a/writerperfect/source/filter/OdgGenerator.cxx b/writerperfect/source/filter/OdgGenerator.cxx
index 30d3e7a..1d073a3 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);
More information about the Libreoffice-commits
mailing list