./
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
3 / 3
100.0%
Branches:
37 / 62
59.7%
Functions:
-
-%

include/terraingen/layers/craters/crater_placer.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2
3 /// @file
4 /// @brief `CraterPlacer`, a layer that lists the craters it applies.
5 #pragma once
6
7 #include "terraingen/layers/craters/crater.h"
8 #include "terraingen/layers/craters/shaping/apply.h"
9 #include "terraingen/layers/craters/shaping/attributes.h"
10 #include "terraingen/layers/layer.h"
11 #include "terraingen/raster/grid.h"
12 #include "terraingen/util/span.h"
13
14 #include <memory>
15 #include <vector>
16
17 namespace terraingen {
18
19 /// Craters and their attributes, in step.
20
35/60
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 116 times.
✓ Branch 2 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 time.
✓ Branch 5 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 time.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 time.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 time.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 time.
✗ Branch 22 not taken.
✓ Branch 23 taken 1 time.
✗ Branch 24 not taken.
✓ Branch 25 taken 1 time.
✗ Branch 32 not taken.
✓ Branch 33 taken 1 time.
✗ Branch 35 not taken.
✓ Branch 36 taken 1 time.
✗ Branch 36 not taken.
✓ Branch 37 taken 1 time.
✗ Branch 42 not taken.
✓ Branch 43 taken 1 time.
✓ Branch 44 taken 1 time.
✗ Branch 51 not taken.
✓ Branch 52 taken 1 time.
✗ Branch 54 not taken.
✓ Branch 55 taken 1 time.
✓ Branch 59 taken 1 time.
✗ Branch 63 not taken.
✓ Branch 64 taken 1 time.
✓ Branch 74 taken 1 time.
✓ Branch 79 taken 1 time.
✗ Branch 86 not taken.
✓ Branch 87 taken 1 time.
✗ Branch 90 not taken.
✓ Branch 91 taken 1 time.
✓ Branch 95 taken 1 time.
✓ Branch 100 taken 1 time.
✗ Branch 104 not taken.
✓ Branch 105 taken 1 time.
✗ Branch 118 not taken.
✓ Branch 119 taken 1 time.
✗ Branch 122 not taken.
✓ Branch 123 taken 1 time.
✗ Branch 126 not taken.
✓ Branch 127 taken 1 time.
✗ Branch 130 not taken.
✓ Branch 131 taken 1 time.
✗ Branch 142 not taken.
✓ Branch 143 taken 1 time.
✗ Branch 150 not taken.
✓ Branch 151 taken 1 time.
427 struct CraterFeatures {
21 CraterList craters; ///< The craters, in the order applied.
22 std::vector<CraterAttributes> attributes; ///< Each crater's attributes, in step.
23
24 /// Appends `other`'s craters and attributes.
25 void Append(const CraterFeatures& other);
26 };
27
28 /// `craters` with their attributes under `models` (`CraterShapeModels::Attributes`).
29 /// @throws std::domain_error as `DegradationModel::State`.
30 CraterFeatures DescribeCraters(CraterList craters, const CraterShapeModels& models);
31
32 /// A layer that places craters. Craters are a pure function of position, so the layer lists them
33 /// on request rather than recording them while it is applied.
34
2/2
<unknown function 20>:
✓ Branch 1 taken 42 times.
<unknown function 34>:
✓ Branch 1 taken 55 times.
1083 class CraterPlacer {
35 public:
36 virtual ~CraterPlacer() = default;
37
38 /// The craters the layer applies over `grid`, as its `Apply` there sees them.
39 /// @param spacing The sample spacing in meters the craters are listed at, as a heightmap of
40 /// that spacing applies them, finer than the grid's or not (`ListedSpacing`); 0 for the grid's.
41 virtual CraterFeatures CratersOver(const RasterGrid& grid, double spacing) const = 0;
42 };
43
44 } // namespace terraingen
45