mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 19:04:27 +02:00
fix: position_vector
is a specialized displacement
This commit is contained in:
@@ -150,8 +150,8 @@ flowchart TD
|
||||
path_length --- distance["<b>distance</b>"]
|
||||
distance --- radial_distance["<b>radial_distance</b>"]
|
||||
length --- wavelength["<b>wavelength</b>"]
|
||||
length --- position_vector["<b>position_vector</b><br>{vector}"]
|
||||
length --- displacement["<b>displacement</b><br>{vector}"]
|
||||
displacement --- position_vector["<b>position_vector</b>"]
|
||||
radius --- radius_of_curvature["<b>radius_of_curvature</b>"]
|
||||
```
|
||||
|
||||
|
@@ -49,8 +49,8 @@ flowchart TD
|
||||
path_length --- distance["<b>distance</b>"]
|
||||
distance --- radial_distance["<b>radial_distance</b>"]
|
||||
length --- wavelength["<b>wavelength</b>"]
|
||||
length --- position_vector["<b>position_vector</b><br>{vector}"]
|
||||
length --- displacement["<b>displacement</b><br>{vector}"]
|
||||
displacement --- position_vector["<b>position_vector</b>"]
|
||||
radius --- radius_of_curvature["<b>radius_of_curvature</b>"]
|
||||
```
|
||||
|
||||
@@ -74,8 +74,8 @@ inline constexpr auto arc_length = path_length;
|
||||
inline constexpr struct distance final : quantity_spec<path_length> {} distance;
|
||||
inline constexpr struct radial_distance final : quantity_spec<distance> {} radial_distance;
|
||||
inline constexpr struct wavelength final : quantity_spec<length> {} wavelength;
|
||||
inline constexpr struct position_vector final : quantity_spec<length, quantity_character::vector> {} position_vector;
|
||||
inline constexpr struct displacement final : quantity_spec<length, quantity_character::vector> {} displacement;
|
||||
inline constexpr struct position_vector final : quantity_spec<displacement> {} position_vector;
|
||||
```
|
||||
|
||||
Thanks to the expressivity and power of C++ templates, we can specify all quantity properties
|
||||
|
@@ -97,22 +97,22 @@ enumeration can be appended to the `quantity_spec` describing such a quantity ty
|
||||
=== "C++23"
|
||||
|
||||
```cpp
|
||||
inline constexpr struct position_vector final : quantity_spec<length, quantity_character::vector> {} position_vector;
|
||||
inline constexpr struct displacement final : quantity_spec<length, quantity_character::vector> {} displacement;
|
||||
inline constexpr struct position_vector final : quantity_spec<displacement> {} position_vector;
|
||||
```
|
||||
|
||||
=== "C++20"
|
||||
|
||||
```cpp
|
||||
inline constexpr struct position_vector final : quantity_spec<position_vector, length, quantity_character::vector> {} position_vector;
|
||||
inline constexpr struct displacement final : quantity_spec<displacement, length, quantity_character::vector> {} displacement;
|
||||
inline constexpr struct position_vector final : quantity_spec<position_vector, displacement> {} position_vector;
|
||||
```
|
||||
|
||||
=== "Portable"
|
||||
|
||||
```cpp
|
||||
QUANTITY_SPEC(position_vector, length, quantity_character::vector);
|
||||
QUANTITY_SPEC(displacement, length, quantity_character::vector);
|
||||
QUANTITY_SPEC(position_vector, displacement);
|
||||
```
|
||||
|
||||
With the above, all the quantities derived from `position_vector` or `displacement` will have a correct
|
||||
|
@@ -109,8 +109,8 @@ flowchart TD
|
||||
path_length --- distance["<b>distance</b>"]
|
||||
distance --- radial_distance["<b>radial_distance</b>"]
|
||||
length --- wavelength["<b>wavelength</b>"]
|
||||
length --- position_vector["<b>position_vector</b><br>{vector}"]
|
||||
length --- displacement["<b>displacement</b><br>{vector}"]
|
||||
displacement --- position_vector["<b>position_vector</b>"]
|
||||
radius --- radius_of_curvature["<b>radius_of_curvature</b>"]
|
||||
```
|
||||
|
||||
@@ -164,8 +164,8 @@ For example, here is how the above quantity kind tree can be modeled in the libr
|
||||
inline constexpr struct distance final : quantity_spec<path_length> {} distance;
|
||||
inline constexpr struct radial_distance final : quantity_spec<distance> {} radial_distance;
|
||||
inline constexpr struct wavelength final : quantity_spec<length> {} wavelength;
|
||||
inline constexpr struct position_vector final : quantity_spec<length, quantity_character::vector> {} position_vector;
|
||||
inline constexpr struct displacement final : quantity_spec<length, quantity_character::vector> {} displacement;
|
||||
inline constexpr struct position_vector final : quantity_spec<displacement> {} position_vector;
|
||||
```
|
||||
|
||||
=== "C++20"
|
||||
@@ -186,8 +186,8 @@ For example, here is how the above quantity kind tree can be modeled in the libr
|
||||
inline constexpr struct distance final : quantity_spec<distance, path_length> {} distance;
|
||||
inline constexpr struct radial_distance final : quantity_spec<radial_distance, distance> {} radial_distance;
|
||||
inline constexpr struct wavelength final : quantity_spec<wavelength, length> {} wavelength;
|
||||
inline constexpr struct position_vector final : quantity_spec<position_vector, length, quantity_character::vector> {} position_vector;
|
||||
inline constexpr struct displacement final : quantity_spec<displacement, length, quantity_character::vector> {} displacement;
|
||||
inline constexpr struct position_vector final : quantity_spec<position_vector, displacement> {} position_vector;
|
||||
```
|
||||
|
||||
=== "Portable"
|
||||
@@ -208,8 +208,8 @@ For example, here is how the above quantity kind tree can be modeled in the libr
|
||||
QUANTITY_SPEC(distance, path_length);
|
||||
QUANTITY_SPEC(radial_distance, distance);
|
||||
QUANTITY_SPEC(wavelength, length);
|
||||
QUANTITY_SPEC(position_vector, length, quantity_character::vector);
|
||||
QUANTITY_SPEC(displacement, length, quantity_character::vector);
|
||||
QUANTITY_SPEC(position_vector, displacement);
|
||||
```
|
||||
|
||||
!!! note
|
||||
|
@@ -42,8 +42,8 @@ QUANTITY_SPEC(thickness, width);
|
||||
QUANTITY_SPEC(diameter, width);
|
||||
QUANTITY_SPEC(distance, path_length);
|
||||
QUANTITY_SPEC(radial_distance, distance);
|
||||
QUANTITY_SPEC(position_vector, length, quantity_character::vector);
|
||||
QUANTITY_SPEC(displacement, length, quantity_character::vector);
|
||||
QUANTITY_SPEC(position_vector, displacement);
|
||||
QUANTITY_SPEC(radius_of_curvature, radius);
|
||||
QUANTITY_SPEC(curvature, inverse(radius_of_curvature));
|
||||
QUANTITY_SPEC(volume, pow<3>(length));
|
||||
|
Reference in New Issue
Block a user