layers/craters/degradation/state.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /// @file | ||
| 2 | /// @brief A crater's shape measures and degradation state. | ||
| 3 | #pragma once | ||
| 4 | |||
| 5 | #include <functional> | ||
| 6 | |||
| 7 | namespace terraingen { | ||
| 8 | |||
| 9 | /// A crater's shape measures relative to its diameter. | ||
| 10 | struct CraterMorphometry { | ||
| 11 | 11 | double depthRatio = 0.0; ///< Rim-to-floor depth / diameter. | |
| 12 | 11 | double rimHeightRatio = 0.0; ///< Rim height above the pre-impact surface / diameter. | |
| 13 | |||
| 14 | 11 | bool operator==(const CraterMorphometry&) const = default; | |
| 15 | }; | ||
| 16 | |||
| 17 | /// A crater's degradation state: its morphometry when fresh and now. | ||
| 18 | struct CraterState { | ||
| 19 | 2 | CraterMorphometry fresh; ///< When fresh; some profiles place a degraded rim from it. | |
| 20 | 2 | CraterMorphometry current; ///< Now; profiles shape the crater to it. | |
| 21 | /// Diffusion age over diameter squared, kappa t / D^2, for profiles that diffuse the fresh | ||
| 22 | /// shape (`DiffusedProfile`); 0 for none. | ||
| 23 | 2 | double diffusion = 0.0; | |
| 24 | |||
| 25 | /// How fresh the crater looks: its depth now over its depth when fresh; 1 for a fresh crater | ||
| 26 | /// (or one with no fresh depth), falling as it degrades. | ||
| 27 | 309448 | double Freshness() const { | |
| 28 | 309448 | return fresh.depthRatio > 0.0 ? current.depthRatio / fresh.depthRatio : 1.0; | |
| 29 | } | ||
| 30 | |||
| 31 | 2 | bool operator==(const CraterState&) const = default; | |
| 32 | }; | ||
| 33 | |||
| 34 | /// The morphometry of a fresh crater of a diameter (m) on some body, such as | ||
| 35 | /// `LunarFreshCraterMorphometry`; must be thread-safe. | ||
| 36 | using FreshMorphometry = std::function<CraterMorphometry(double diameter)>; | ||
| 37 | |||
| 38 | } // namespace terraingen | ||
| 39 |