MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
angle.hpp
Go to the documentation of this file.
1
/*
2
3
Copyright 2025 Matthew Tolman
4
5
Licensed under the Apache License, Version 2.0 (the "License");
6
you may not use this file except in compliance with the License.
7
You may obtain a copy of the License at
8
9
http://www.apache.org/licenses/LICENSE-2.0
10
11
Unless required by applicable law or agreed to in writing, software
12
distributed under the License is distributed on an "AS IS" BASIS,
13
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
See the License for the specific language governing permissions and
15
limitations under the License.
16
17
*/
18
19
#ifndef MTCORE_UNIT_ANGLE_HPP
20
#define MTCORE_UNIT_ANGLE_HPP
21
22
#include "
mtcore/units/base.hpp
"
23
24
namespace
mtcore::units
{
25
namespace
angle
{
26
constexpr
auto
radians
=
Units<Unit<dimensions::ANGLE>
>{};
27
constexpr
auto
degree
=
Units<Unit<dimensions::ANGLE, std::ratio<1, 180>
, 1>>{};
28
}
// namespace angle
29
30
static_assert
((std::numbers::pi_v<double> *
angle::radians
).to(
angle::degree
).val == 180);
31
static_assert
((180. *
angle::degree
).to(
angle::radians
).val == std::numbers::pi_v<double>);
32
33
MTCORE_DEF_UNIT_NAME
(angle, radians, rad)
34
MTCORE_DEF_UNIT_NAME_SYM
(angle, degree, deg,
"°"
)
35
}
// namespace mtcore::units
36
37
#endif
// MTCORE_UNIT_ANGLE_HPP
mtcore::units::angle
Definition
angle.hpp:25
mtcore::units::angle::degree
constexpr auto degree
Definition
angle.hpp:27
mtcore::units::angle::radians
constexpr auto radians
Definition
angle.hpp:26
mtcore::units
Base namespace for units.
Definition
angle.hpp:24
mtcore::units::Units
List of units.
Definition
units/base.hpp:80
base.hpp
MTCORE_DEF_UNIT_NAME_SYM
#define MTCORE_DEF_UNIT_NAME_SYM(NS, UNIT, ABBREV, SYM)
Definition
units/base.hpp:893
MTCORE_DEF_UNIT_NAME
#define MTCORE_DEF_UNIT_NAME(NS, UNIT, ABBREV)
Definition
units/base.hpp:915
include
core
mtcore
units
angle.hpp
Generated on Wed Jun 11 2025 16:20:21 for MT Core (C++) by
1.13.2