docs: subtraction of two points to get an absolute quantity case added

This commit is contained in:
Mateusz Pusz
2023-08-03 19:05:03 +02:00
parent bc2a3572ea
commit 290161ab07

View File

@@ -158,13 +158,19 @@ As we can see above, the `relative()` member function returns a relative distanc
point origin. In case we would like to know the absolute altitude that we reached on this climb, point origin. In case we would like to know the absolute altitude that we reached on this climb,
we can either: we can either:
- add the two relative heights from both points - add the two relative heights from both _points_
```cpp ```cpp
static_assert(first_climb_alt.relative() + everest_base_camp_alt.relative() == 5406 * m); static_assert(first_climb_alt.relative() + everest_base_camp_alt.relative() == 5406 * m);
``` ```
- call `absolute()` member function - subtract the "zero altitude" _point_ from the current _point_
```cpp
static_assert(first_climb_alt - quantity_point{0 * m, mean_sea_level} == 5406 * m);
```
- call `absolute()` member function on the current _point_
```cpp ```cpp
static_assert(first_climb_alt.absolute() == 5406 * m); static_assert(first_climb_alt.absolute() == 5406 * m);