summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2016-08-17 07:39:43 +0000
committertavmjong-free <tavmjong@free.fr>2016-08-17 07:39:43 +0000
commit2f53e4dbb4620edcabaffc964c55cb71090912f8 (patch)
tree5c7119a28798a5d6b500ad092b92bf10720f80b1 /src
parentAdd std::nothrow so tests of memory allocation work as expected. (diff)
downloadinkscape-2f53e4dbb4620edcabaffc964c55cb71090912f8.tar.gz
inkscape-2f53e4dbb4620edcabaffc964c55cb71090912f8.zip
Use M_PI, M_PI_2. We use these constants everywhere so if they are not defined we are already in trouble.
No need to define them ourselves (except maybe in shared libraries). (bzr r15063)
Diffstat (limited to 'src')
-rw-r--r--src/display/guideline.cpp2
-rw-r--r--src/extension/dbus/document-interface.cpp2
-rw-r--r--src/extension/internal/odf.cpp5
-rw-r--r--src/sp-ellipse.cpp12
-rw-r--r--src/svg/svg-affine.cpp4
5 files changed, 6 insertions, 19 deletions
diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp
index 126fcf87c..f66b65e1a 100644
--- a/src/display/guideline.cpp
+++ b/src/display/guideline.cpp
@@ -48,7 +48,7 @@ static void sp_guideline_init(SPGuideLine *gl)
gl->locked = false;
gl->normal_to_line = Geom::Point(0,1);
- gl->angle = 3.14159265358979323846/2;
+ gl->angle = M_PI_2;
gl->point_on_line = Geom::Point(0,0);
gl->sensitive = 0;
diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp
index 5a8fb0918..667830997 100644
--- a/src/extension/dbus/document-interface.cpp
+++ b/src/extension/dbus/document-interface.cpp
@@ -405,7 +405,7 @@ document_interface_polygon (DocumentInterface *doc_interface, int cx, int cy,
int radius, int rotation, int sides,
GError **error)
{
- gdouble rot = ((rotation / 180.0) * 3.14159265) - ( 3.14159265 / 2.0);
+ gdouble rot = ((rotation / 180.0) * M_PI) - M_PI_2;
Inkscape::XML::Node *newNode = dbus_create_node(doc_interface->target.getDocument(), "svg:path");
newNode->setAttribute("inkscape:flatsided", "true");
newNode->setAttribute("sodipodi:type", "star");
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp
index 6904eb2fd..f885ef5e5 100644
--- a/src/extension/internal/odf.cpp
+++ b/src/extension/internal/odf.cpp
@@ -873,11 +873,8 @@ int SingularValueDecomposition::rank()
-#define pi 3.14159
//#define pxToCm 0.0275
#define pxToCm 0.03
-#define piToRad 0.0174532925
-#define docHeightCm 22.86
//########################################################################
@@ -1565,7 +1562,7 @@ bool OdfOutput::processGradient(SPItem *item,
output += buf;
//TODO: apply maths, to define begin of gradient, taking gradient begin and end, as well as object boundary into account
double angle = (gi.y2-gi.y1);
- angle = (angle != 0.) ? (atan((gi.x2-gi.x1)/(gi.y2-gi.y1))* 180. / pi) : 90;
+ angle = (angle != 0.) ? (atan((gi.x2-gi.x1)/(gi.y2-gi.y1))* 180. / M_PI) : 90;
angle = (angle < 0)?(180+angle):angle;
angle = angle * 10; //why do we need this: precision?????????????
output += Glib::ustring::compose(" draw:start-intensity=\"%1\" draw:end-intensity=\"%2\" draw:angle=\"%3\"/>\n",
diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp
index 995f880c2..0d60aa5d8 100644
--- a/src/sp-ellipse.cpp
+++ b/src/sp-ellipse.cpp
@@ -33,16 +33,10 @@
#include "svg/path-string.h"
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#define SP_2PI (2 * M_PI)
-
SPGenericEllipse::SPGenericEllipse()
: SPShape()
, start(0)
- , end(SP_2PI)
+ , end(M_2_PI)
, type(SP_GENERIC_ELLIPSE_UNDEFINED)
, _closed(true)
{
@@ -533,7 +527,7 @@ void SPGenericEllipse::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p,
// Snap to the 4 quadrant points of the ellipse, but only if the arc
// spans far enough to include them
if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_ELLIPSE_QUADRANT_POINT)) {
- for (double angle = 0; angle < SP_2PI; angle += M_PI_2) {
+ for (double angle = 0; angle < M_2_PI; angle += M_PI_2) {
if (Geom::AngleInterval(this->start, this->end, true).contains(angle)) {
Geom::Point pt = this->getPointAtAngle(angle) * i2dt;
p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_ELLIPSE_QUADRANT_POINT, Inkscape::SNAPTARGET_ELLIPSE_QUADRANT_POINT));
@@ -668,7 +662,7 @@ bool SPGenericEllipse::_isSlice() const
{
Geom::AngleInterval a(this->start, this->end, true);
- return !(Geom::are_near(a.extent(), 0) || Geom::are_near(a.extent(), SP_2PI));
+ return !(Geom::are_near(a.extent(), 0) || Geom::are_near(a.extent(), M_2_PI));
}
/*
diff --git a/src/svg/svg-affine.cpp b/src/svg/svg-affine.cpp
index 21635c79b..76d89579d 100644
--- a/src/svg/svg-affine.cpp
+++ b/src/svg/svg-affine.cpp
@@ -24,10 +24,6 @@
#include "svg.h"
#include "preferences.h"
-#ifndef M_PI
-# define M_PI 3.14159265358979323846
-#endif
-
bool
sp_svg_transform_read(gchar const *str, Geom::Affine *transform)
{