1 // Copyright 2017 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef UI_GFX_GEOMETRY_ANGLE_CONVERSIONS_H_ 6 #define UI_GFX_GEOMETRY_ANGLE_CONVERSIONS_H_ 7 8 #include "base/numerics/math_constants.h" 9 #include "ui/gfx/gfx_export.h" 10 11 namespace gfx { 12 DegToRad(double deg)13GFX_EXPORT constexpr double DegToRad(double deg) { 14 return deg * base::kPiDouble / 180.0; 15 } DegToRad(float deg)16GFX_EXPORT constexpr float DegToRad(float deg) { 17 return deg * base::kPiFloat / 180.0f; 18 } 19 RadToDeg(double rad)20GFX_EXPORT constexpr double RadToDeg(double rad) { 21 return rad * 180.0 / base::kPiDouble; 22 } RadToDeg(float rad)23GFX_EXPORT constexpr float RadToDeg(float rad) { 24 return rad * 180.0f / base::kPiFloat; 25 } 26 27 } // namespace gfx 28 29 #endif // UI_GFX_GEOMETRY_ANGLE_CONVERSIONS_H_ 30