docs: cross-page links fixed
This commit is contained in:
1 parent
290161ab07
commit
4c49e9c57f
14 files changed
+146
-146
No files matched your search
@@ -1,27 +1,27 @@
|
||||
# Systems of Units
|
||||
|
||||
Modeling a [system of units](../../../appendix/glossary/#system-of-units) is probably
|
||||
Modeling a [system of units](../../appendix/glossary.md#system-of-units) is probably
|
||||
the most important feature and a selling point of every physical units library.
|
||||
Thanks to that, the library can protect users from performing invalid operations on
|
||||
quantities and provide automated conversion factors between various compatible units.
|
||||
|
||||
Probably all the libraries in the wild model the [SI](../../../appendix/glossary/#si)
|
||||
Probably all the libraries in the wild model the [SI](../../appendix/glossary.md#si)
|
||||
and many of them provide support for additional units belonging to various other systems
|
||||
(i.e. imperial).
|
||||
|
||||
|
||||
## Systems of Units are based on Systems of Quantities
|
||||
|
||||
[Systems of quantities](../../../appendix/glossary/#system-of-quantities) specify a set
|
||||
[Systems of quantities](../../appendix/glossary.md#system-of-quantities) specify a set
|
||||
of quantities and equations relating to those quantities. Those equations do not take any
|
||||
unit or a numerical representation into account at all. In order to create a quantity,
|
||||
we need to add those missing pieces of information. This is where
|
||||
a [system of units](../../../appendix/glossary/#system-of-units) kicks in.
|
||||
a [system of units](../../appendix/glossary.md#system-of-units) kicks in.
|
||||
|
||||
The [SI](../../../appendix/glossary/#si) is explicitly stated to be based on
|
||||
the [ISQ](../../../appendix/glossary/#isq). Among others, it defines
|
||||
`7` [base units](../../../appendix/glossary/#base-unit), one for each
|
||||
[base quantity](../../../appendix/glossary/#base-quantity). In the **mp-units**
|
||||
The [SI](../../appendix/glossary.md#si) is explicitly stated to be based on
|
||||
the [ISQ](../../appendix/glossary.md#isq). Among others, it defines
|
||||
`7` [base units](../../appendix/glossary.md#base-unit), one for each
|
||||
[base quantity](../../appendix/glossary.md#base-quantity). In the **mp-units**
|
||||
this is expressed by associating a quantity kind (that we discussed in detail in the
|
||||
previous chapter) with a unit that is used to express it:
|
||||
|
||||
@@ -38,32 +38,32 @@ inline constexpr struct metre : named_unit<"m", kind_of<isq::length>> {} metre;
|
||||
|
||||
## Units compose
|
||||
|
||||
One of the strongest points of the [SI](../../../appendix/glossary/#si) system
|
||||
One of the strongest points of the [SI](../../appendix/glossary.md#si) system
|
||||
is that its units compose. This allows providing thousands of different units for
|
||||
hundreds of various quantities with a really small set of predefined units
|
||||
and prefixes.
|
||||
|
||||
The same is modeled in the **mp-units** library, which also allows composing
|
||||
predefined units to create a nearly infinite number of different
|
||||
[derived units](../../../appendix/glossary/#derived-unit). For example, one can write:
|
||||
[derived units](../../appendix/glossary.md#derived-unit). For example, one can write:
|
||||
|
||||
```cpp
|
||||
quantity<si::metre / si::second> q;
|
||||
```
|
||||
|
||||
to express a quantity of speed. The resulting quantity type is implicitly inferred
|
||||
from the [unit equation](../../../appendix/glossary/#unit-equation) by repeating
|
||||
from the [unit equation](../../appendix/glossary.md#unit-equation) by repeating
|
||||
exactly the same operations on the associated quantity kinds.
|
||||
|
||||
|
||||
## Many shades of the same unit
|
||||
|
||||
The [SI](../../../appendix/glossary/#si) provides the names for 22 common
|
||||
[coherent units](../../../appendix/glossary/#coherent-derived-unit) of 22
|
||||
[derived quantities](../../../appendix/glossary/#derived-quantity).
|
||||
The [SI](../../appendix/glossary.md#si) provides the names for 22 common
|
||||
[coherent units](../../appendix/glossary.md#coherent-derived-unit) of 22
|
||||
[derived quantities](../../appendix/glossary.md#derived-quantity).
|
||||
|
||||
Each such named [derived unit](../../../appendix/glossary/#derived-unit) is a result
|
||||
of a specific predefined [unit equation](../../../appendix/glossary/#unit-equation).
|
||||
Each such named [derived unit](../../appendix/glossary.md#derived-unit) is a result
|
||||
of a specific predefined [unit equation](../../appendix/glossary.md#unit-equation).
|
||||
For example, a unit of power quantity is defined in the library as:
|
||||
|
||||
```cpp
|
||||
@@ -123,7 +123,7 @@ This is exactly what we wanted to achieve to improve the type-safety of the libr
|
||||
|
||||
## Prefixed units
|
||||
|
||||
Besides named units, the [SI](../../../appendix/glossary/#si) specifies also 24 prefixes
|
||||
Besides named units, the [SI](../../appendix/glossary.md#si) specifies also 24 prefixes
|
||||
(all being a power of `10`) that can be prepended to all named units to obtain various scaled
|
||||
versions of them.
|
||||
|
||||
@@ -138,7 +138,7 @@ template<PrefixableUnit auto U> struct quecto_ : prefixed_unit<"q", mag_power<10
|
||||
template<PrefixableUnit auto U> inline constexpr quecto_<U> quecto;
|
||||
```
|
||||
|
||||
and then a [PrefixableUnit](../basic_concepts/#prefixableunit) can be prefixed in the following
|
||||
and then a [PrefixableUnit](basic_concepts.md#prefixableunit) can be prefixed in the following
|
||||
way:
|
||||
|
||||
```cpp
|
||||
@@ -156,10 +156,10 @@ template<PrefixableUnit auto U> inline constexpr yobi_<U> yobi;
|
||||
|
||||
## Scaled units
|
||||
|
||||
In the [SI](../../../appendix/glossary/#si), all units are either base or derived units or prefixed
|
||||
In the [SI](../../appendix/glossary.md#si), all units are either base or derived units or prefixed
|
||||
versions of those. However, those are not the only options possible.
|
||||
|
||||
For example, there is a list of [off-system units](../../../appendix/glossary/#off-system-unit)
|
||||
For example, there is a list of [off-system units](../../appendix/glossary.md#off-system-unit)
|
||||
accepted for use with SI. All of those are scaled versions of the SI units with ratios that can't
|
||||
be explicitly expressed with predefined SI prefixes. Those include units like minute, hour, or
|
||||
electronvolt:
|
||||
@@ -170,7 +170,7 @@ inline constexpr struct hour : named_unit<"h", mag<60> * minute> {} hour;
|
||||
inline constexpr struct electronvolt : named_unit<"eV", mag<ratio{1'602'176'634, 1'000'000'000}> * mag_power<10, -19> * si::joule> {} electronvolt;
|
||||
```
|
||||
|
||||
Also, units of other [systems of units](../../../appendix/glossary/#system-of-units) are often defined
|
||||
Also, units of other [systems of units](../../appendix/glossary.md#system-of-units) are often defined
|
||||
in terms of scaled versions of the SI units. For example, the international yard is defined as:
|
||||
|
||||
```cpp
|
||||
@@ -187,4 +187,3 @@ inline constexpr struct mag_pi : magnitude<std::numbers::pi_v<long double>> {} m
|
||||
```cpp
|
||||
inline constexpr struct degree : named_unit<basic_symbol_text{"°", "deg"}, mag_pi / mag<180> * si::radian> {} degree;
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user