You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
787 B
30 lines
787 B
4 months ago
|
// Copyright 2017 The Chromium Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a BSD-style license that can be
|
||
|
// found in the LICENSE file.
|
||
|
|
||
|
#ifndef UI_GFX_GEOMETRY_ANGLE_CONVERSIONS_H_
|
||
|
#define UI_GFX_GEOMETRY_ANGLE_CONVERSIONS_H_
|
||
|
|
||
|
#include "base/numerics/math_constants.h"
|
||
|
#include "ui/gfx/gfx_export.h"
|
||
|
|
||
|
namespace gfx {
|
||
|
|
||
|
GFX_EXPORT constexpr double DegToRad(double deg) {
|
||
|
return deg * base::kPiDouble / 180.0;
|
||
|
}
|
||
|
GFX_EXPORT constexpr float DegToRad(float deg) {
|
||
|
return deg * base::kPiFloat / 180.0f;
|
||
|
}
|
||
|
|
||
|
GFX_EXPORT constexpr double RadToDeg(double rad) {
|
||
|
return rad * 180.0 / base::kPiDouble;
|
||
|
}
|
||
|
GFX_EXPORT constexpr float RadToDeg(float rad) {
|
||
|
return rad * 180.0f / base::kPiFloat;
|
||
|
}
|
||
|
|
||
|
} // namespace gfx
|
||
|
|
||
|
#endif // UI_GFX_GEOMETRY_ANGLE_CONVERSIONS_H_
|