TerrainGen coverage


terraingen/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
6 / 6
100.0%
Branches:
-
-%
Functions:
3 / 3
100.0%

layers/craters/profiles/fassett_thomson.h
Line Branch Exec Source
1 /// @file
2 /// @brief The fresh simple-crater profile of Fassett and Thomson (2014) and its rim variants.
3 #pragma once
4
5 #include "terraingen/layers/craters/profiles/profile.h"
6
7 namespace terraingen {
8
9 /// How a `FassettThomsonProfile` joins its interior and exterior fits at the rim.
10 enum class FassettThomsonRim {
11 Original, ///< The published fits, which meet within 1e-5 D at 0.98 radii.
12 AtOneRadius, ///< Interior extended to 1.0 radii (synthterrain `FT_Crater`); 0.0076 D step.
13 /// Fassett et al. (2022) Table 3 (synthterrain `FTmod_Crater`): flat at the fresh rim height
14 /// from 0.98 to 1.02 radii.
15 Plateau,
16 };
17
18 /// Fresh simple-crater profile of Fassett and Thomson (2014, eq. 4): cubic interior and
19 /// exterior fits in x = r / R, reaching 1.5 radii.
20 ///
21 /// The interior is flattened at a floor `state.current.depthRatio` below
22 /// `state.fresh.rimHeightRatio`; the rim height is fixed by the fit, so degraded rims are not
23 /// represented.
24 class FassettThomsonProfile final : public CraterProfile {
25 public:
26 /// @param rim How the interior and exterior fits are joined at the rim.
27 653 explicit FassettThomsonProfile(FassettThomsonRim rim = FassettThomsonRim::Original)
28 653 : rim_(rim) {}
29
30 /// Reads the fresh rim height and current depth of `state`.
31 double Height(double distance, double diameter, const CraterState& state) const override;
32
33 1229489 double ReachRadii() const override {
34 1229489 return 1.5;
35 }
36
37 /// How the fits are joined at the rim.
38 294013 FassettThomsonRim Rim() const {
39 294013 return rim_;
40 }
41
42 private:
43 FassettThomsonRim rim_;
44 };
45
46 } // namespace terraingen
47