mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-21 01:05:59 +00:00
MATH: Remove duplicated deg/rad-conversions, replacing them by common/math.h-functionality
This commit is contained in:
parent
5c4100d353
commit
adc0067bf7
@ -20,6 +20,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/math.h"
|
||||
|
||||
#include "engines/myst3/scene.h"
|
||||
#include "engines/myst3/node.h"
|
||||
#include "engines/myst3/myst3.h"
|
||||
@ -111,8 +113,8 @@ void Scene::drawSunspotFlare(const SunSpot &s) {
|
||||
static Math::Vector3d directionToVector(float pitch, float heading) {
|
||||
Math::Vector3d v;
|
||||
|
||||
float radHeading = Math::degreeToRadian(heading);
|
||||
float radPitch = Math::degreeToRadian(pitch);
|
||||
float radHeading = Common::deg2rad(heading);
|
||||
float radPitch = Common::deg2rad(pitch);
|
||||
|
||||
v.setValue(0, cos(radPitch) * cos(radHeading));
|
||||
v.setValue(1, sin(radPitch));
|
||||
|
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
#include "common/streamdebug.h"
|
||||
#include "common/math.h"
|
||||
|
||||
#include "math/angle.h"
|
||||
#include "math/utils.h"
|
||||
|
||||
namespace Math {
|
||||
|
||||
@ -57,7 +57,7 @@ void Angle::setDegrees(float degrees) {
|
||||
}
|
||||
|
||||
void Angle::setRadians(float radians) {
|
||||
_degrees = radianToDegree(radians);
|
||||
_degrees = Common::rad2deg(radians);
|
||||
}
|
||||
|
||||
float Angle::getDegrees() const {
|
||||
@ -65,7 +65,7 @@ float Angle::getDegrees() const {
|
||||
}
|
||||
|
||||
float Angle::getRadians() const {
|
||||
return degreeToRadian(getDegrees());
|
||||
return Common::deg2rad(getDegrees());
|
||||
}
|
||||
|
||||
float Angle::getDegrees(float low) const {
|
||||
@ -82,7 +82,7 @@ float Angle::getDegrees(float low) const {
|
||||
|
||||
float Angle::getRadians(float low) const {
|
||||
float d = getDegrees(low);
|
||||
return degreeToRadian(d);
|
||||
return Common::deg2rad(d);
|
||||
}
|
||||
|
||||
float Angle::getCosine() const {
|
||||
@ -134,7 +134,7 @@ Angle &Angle::operator-=(float degrees) {
|
||||
}
|
||||
|
||||
Angle Angle::fromRadians(float radians) {
|
||||
return Angle(radianToDegree(radians));
|
||||
return Angle(Common::rad2deg(radians));
|
||||
}
|
||||
|
||||
Angle Angle::arcCosine(float x) {
|
||||
|
@ -27,14 +27,6 @@
|
||||
|
||||
namespace Math {
|
||||
|
||||
inline float radianToDegree(float rad) {
|
||||
return rad * 180.f / LOCAL_PI;
|
||||
}
|
||||
|
||||
inline float degreeToRadian(float degree) {
|
||||
return degree * LOCAL_PI / 180.f;
|
||||
}
|
||||
|
||||
inline float square(float x) {
|
||||
return x * x;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user