./
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
4 / 4
100.0%
Branches:
5 / 10
50.0%
Functions:
1 / 1
100.0%

include/terraingen/layers/craters/shaping/attributes.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2
3 /// @file
4 /// @brief `CraterAttributes`, what a crater looks like in its current state.
5 #pragma once
6
7 #include "terraingen/layers/craters/crater.h"
8 #include "terraingen/layers/craters/degradation/state.h"
9 #include "terraingen/layers/craters/profiles/profile.h"
10
11 namespace terraingen {
12
13 /// What a crater looks like in its current state, for listing, labeling or placing.
14 struct CraterAttributes {
15 double floorDepth = 0.0; ///< Depth of the floor below the surrounding surface (m).
16 double rimHeight = 0.0; ///< Height of the rim crest above the surrounding surface (m).
17 double depthRatio = 0.0; ///< Rim-to-floor depth over diameter now.
18 /// The depth ratio now over that when fresh: 1 for a fresh crater, falling as it degrades.
19 double freshness = 1.0;
20 bool complex = false; ///< Of the complex form: a flat floor and a central peak.
21
22 /// Memberwise equality.
23 171 bool operator==(const CraterAttributes& other) const {
24
1/2
✓ Branch 0 taken 171 times.
✗ Branch 1 not taken.
171 return floorDepth == other.floorDepth && rimHeight == other.rimHeight &&
25
3/6
✓ Branch 0 taken 171 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 171 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 171 times.
✗ Branch 5 not taken.
342 depthRatio == other.depthRatio && freshness == other.freshness &&
26
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 171 times.
171 complex == other.complex;
27 }
28 bool operator!=(const CraterAttributes& other) const {
29 return !(*this == other);
30 }
31 };
32
33 /// The attributes of a crater in `state` (which gives the ratios) shaped by `profile` (the form).
34 ///
35 /// The floor is the profile's lowest point inside the rim and the rim crest its highest from 0.7
36 /// to 1.3 radii, both sampled every 0.01 radii.
37 CraterAttributes ComputeCraterAttributes(const Crater& crater, const CraterState& state,
38 const CraterProfile& profile);
39
40 } // namespace terraingen
41