mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
Move PI constant to base/pi.h file
This commit is contained in:
parent
a11f8e2918
commit
3c60136631
@ -5,13 +5,10 @@
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
|
||||
#include "base/pi.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
namespace app {
|
||||
namespace tools {
|
||||
|
||||
@ -104,7 +101,7 @@ public:
|
||||
// Lines
|
||||
if (loop->getIntertwine()->snapByAngle()) {
|
||||
double angle = 180.0 * std::atan(static_cast<double>(-dy) /
|
||||
static_cast<double>(dx)) / M_PI;
|
||||
static_cast<double>(dx)) / PI;
|
||||
angle = ABS(angle);
|
||||
|
||||
// Snap horizontally
|
||||
@ -186,7 +183,7 @@ public:
|
||||
ABS(points[1].x-points[0].x)+1,
|
||||
ABS(points[1].y-points[0].y)+1,
|
||||
180.0 * std::atan2(static_cast<double>(points[0].y-points[1].y),
|
||||
static_cast<double>(points[1].x-points[0].x)) / M_PI);
|
||||
static_cast<double>(points[1].x-points[0].x)) / PI);
|
||||
text = buf;
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "app/ui_context.h"
|
||||
#include "app/util/clipboard.h"
|
||||
#include "base/bind.h"
|
||||
#include "base/pi.h"
|
||||
#include "base/unique_ptr.h"
|
||||
#include "doc/algorithm/flip_image.h"
|
||||
#include "doc/mask.h"
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "app/ui_context.h"
|
||||
#include "app/util/expand_cel_canvas.h"
|
||||
#include "base/bind.h"
|
||||
#include "base/pi.h"
|
||||
#include "base/vector2d.h"
|
||||
#include "doc/algorithm/flip_image.h"
|
||||
#include "doc/algorithm/rotate.h"
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "app/util/new_image_from_mask.h"
|
||||
#include "base/pi.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/mask.h"
|
||||
#include "doc/sprite.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/skin/skin_theme.h"
|
||||
#include "base/pi.h"
|
||||
#include "she/surface.h"
|
||||
|
||||
namespace app {
|
||||
|
@ -40,8 +40,6 @@
|
||||
#define ABS(x) (((x) >= 0) ? (x) : (-(x)))
|
||||
#define SGN(x) (((x) >= 0) ? 1 : -1)
|
||||
|
||||
#undef PI
|
||||
#define PI 3.14159265358979323846
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
15
src/base/pi.h
Normal file
15
src/base/pi.h
Normal file
@ -0,0 +1,15 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
|
||||
#ifndef BASE_PI_H_INCLUDED
|
||||
#define BASE_PI_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#ifndef PI
|
||||
#define PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#endif
|
@ -11,6 +11,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "base/pi.h"
|
||||
#include "fixmath/fixmath.h"
|
||||
#include "doc/blend_funcs.h"
|
||||
#include "doc/image_impl.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "doc/brush.h"
|
||||
|
||||
#include "base/pi.h"
|
||||
#include "doc/algo.h"
|
||||
#include "doc/algorithm/polygon.h"
|
||||
#include "doc/image.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user