./
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
58 / 58
100.0%
Branches:
75 / 144
52.1%
Functions:
7 / 7, 5 excl
100.0%

include/terraingen/layers/craters/shaping/apply_options.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2
3 /// @file
4 /// @brief How craters are applied to the terrain: their order, datum, blend, outlines and rims.
5 #pragma once
6
7 #include "terraingen/geometry/surface.h"
8 #include "terraingen/layers/craters/crater.h"
9 #include "terraingen/layers/craters/shaping/irregularity.h"
10 #include "terraingen/layers/craters/shaping/slope.h"
11 #include "terraingen/layers/fade.h"
12
13 #include <cmath>
14 #include <cstddef>
15 #include <cstdint>
16 #include <optional>
17 #include <vector>
18
19 namespace terraingen {
20
21 /// The order in which overlapping craters are applied; later craters overprint earlier ones.
22 enum class CraterOrder {
23 OldestFirst, ///< Decreasing age, then decreasing diameter: the physical order.
24 LargestFirst, ///< Decreasing diameter, then decreasing age.
25 };
26
27 /// The reference surface a crater's interior is cut relative to.
28 enum class CraterDatum {
29 None, ///< No datum: the profile is added onto the terrain everywhere.
30 Plane, ///< Least-squares plane over the fit footprint; keeps regional slopes.
31 MeanHeight, ///< Flat datum at the mean height over the fit footprint.
32 CenterHeight, ///< Flat datum at the terrain height under the crater center.
33 };
34
35 /// Where a crater's replaced interior blends into the surrounding terrain, in crater radii.
36 2 struct CraterBlend {
37 double startRadii = 0.8; ///< Interior weight is 1 up to here.
38 double endRadii = 1.2; ///< And 0 from here; above `startRadii`.
39 BlendShape shape = BlendShape::Smootherstep; ///< The curve in between.
40
41 /// Memberwise equality.
42 4 bool operator==(const CraterBlend& other) const {
43
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 return startRadii == other.startRadii && endRadii == other.endRadii && shape == other.shape;
44 }
45 bool operator!=(const CraterBlend& other) const {
46 return !(*this == other);
47 }
48 };
49
50 /// How craters with `Crater::replace` replace the terrain beneath them: in full out to
51 /// `startRadii`, blending to none at `endRadii`, cut into a plane fitted to the ground on a ring
52 /// from `endRadii` out to `endRadii` + `fitWidthRadii`, so neither the crater replaced nor its
53 /// rim pulls the datum, whatever datum the other craters have.
54 3 struct CraterReplacement {
55 double startRadii = 1.0; ///< Replaced in full up to here, in crater radii.
56 /// Nothing replaced from here, in crater radii, above `startRadii`; at most the profile's
57 /// reach, and unset for that reach, so the replaced crater's rim and flanks go too.
58 std::optional<double> endRadii{};
59 double fitWidthRadii = 1.0; ///< Width of the ring the datum is fitted on, in crater radii.
60
61 /// `endRadii`, or a profile reach of `reachRadii` where unset or further.
62 240087 double EndRadii(double reachRadii) const {
63
4/4
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 240053 times.
✓ Branch 2 taken 1 time.
✓ Branch 3 taken 32 times.
240090 return endRadii ? std::fmin(*endRadii, reachRadii) : reachRadii;
64 }
65
66 /// Memberwise equality.
67 4 bool operator==(const CraterReplacement& other) const {
68
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 return startRadii == other.startRadii && endRadii == other.endRadii &&
69
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 fitWidthRadii == other.fitWidthRadii;
70 }
71 bool operator!=(const CraterReplacement& other) const {
72 return !(*this == other);
73 }
74 };
75
76 /// Checks crater replacement settings.
77 /// @throws std::invalid_argument for a field outside its range (`CheckRanges`) or an `endRadii`
78 /// not above `startRadii`.
79 void ValidateCraterReplacement(const CraterReplacement& replacement);
80
81 /// How crater rims are rounded: near the rim, the profile is blended toward itself smoothed across
82 /// distance by a Gaussian, with full weight at the rim fading to none at the band's edges.
83 1 struct RimSmoothing {
84 /// Gaussian standard deviation in crater radii; 0 leaves rims sharp.
85 double sigmaRadii = 0.0;
86 double innerRadii = 0.8; ///< Inner edge of the smoothed band, in crater radii; in [0, 1).
87 double outerRadii = 1.2; ///< Outer edge of the smoothed band, in crater radii; above 1.
88 BlendShape shape = BlendShape::Smootherstep; ///< How the weight falls toward the edges.
89 double strength = 1.0; ///< Share of the smoothed height used at the rim, in [0, 1].
90
91 /// Memberwise equality.
92 5 bool operator==(const RimSmoothing& other) const {
93
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 return sigmaRadii == other.sigmaRadii && innerRadii == other.innerRadii &&
94
4/8
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5 times.
10 outerRadii == other.outerRadii && shape == other.shape && strength == other.strength;
95 }
96 bool operator!=(const RimSmoothing& other) const {
97 return !(*this == other);
98 }
99 };
100
101 /// Checks rim smoothing settings.
102 /// @throws std::invalid_argument for a field outside its range (`CheckRanges`).
103 void ValidateRimSmoothing(const RimSmoothing& smoothing);
104
105 /// Fractal noise added to each crater, keyed to its ID so tiles and point queries agree: over the
106 /// whole footprint, fading out to nothing at the profile's reach, and in a band around the rim.
107 /// Amplitudes are shares of the crater's diameter, so the noise scales with the crater.
108 5 struct CraterNoise {
109 double amplitude = 0.0; ///< Footprint noise amplitude over the diameter; 0 adds none.
110 double wavelengthRadii = 0.5; ///< Wavelength of its first octave, in crater radii.
111 int octaves = 4; ///< Octaves of both noises, 1 to 12.
112 double gain = 0.5; ///< Weight ratio between successive octaves; positive.
113 double rimAmplitude = 0.0; ///< Rim noise amplitude over the diameter; 0 adds none.
114 double rimWavelengthRadii = 0.1; ///< Wavelength of its first octave, in crater radii.
115 double rimInnerRadii = 0.8; ///< Inner edge of the rim band, in crater radii; in [0, 1).
116 double rimOuterRadii = 1.2; ///< Outer edge of the rim band, in crater radii; above 1.
117 /// Varies the noise of every crater; unset follows the crater layer's `seed`, and is 0
118 /// outside a layer.
119 std::optional<std::uint32_t> seed{};
120
121 /// Memberwise equality.
122 4 bool operator==(const CraterNoise& other) const {
123
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 return amplitude == other.amplitude && wavelengthRadii == other.wavelengthRadii &&
124
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 octaves == other.octaves && gain == other.gain &&
125
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 rimAmplitude == other.rimAmplitude &&
126
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 rimWavelengthRadii == other.rimWavelengthRadii &&
127
3/6
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
8 rimInnerRadii == other.rimInnerRadii && rimOuterRadii == other.rimOuterRadii &&
128
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 seed == other.seed;
129 }
130 bool operator!=(const CraterNoise& other) const {
131 return !(*this == other);
132 }
133 };
134
135 /// Checks crater noise settings.
136 /// @throws std::invalid_argument for a field outside its range (`CheckRanges`).
137 void ValidateCraterNoise(const CraterNoise& noise);
138
139 /// The texture of a crater's walls and ejecta, keyed to its ID: radial gullies down the inner
140 /// wall, hummocky ejecta lineated away from the rim, and older relief buried under the ejecta.
141 /// Ejecta follow McGetchin et al.'s (1973) thickness 0.14 R^0.74 (r / R)^-3 m, tapered to nothing
142 /// at `ejectaReachRadii`. Gullies and ejecta texture fade as the crater wears; burial stays.
143 3 struct CraterTexture {
144 double wallStreaks = 0.0; ///< Gully amplitude over the diameter; 0 adds none.
145 double wallStreakWidthRadii = 0.15; ///< Width of the gullies across the wall, in radii.
146 double ejecta = 0.0; ///< Ejecta texture amplitude over the ejecta thickness; 0 adds none.
147 double ejectaLineationRadii = 0.15; ///< Width of the lineations across, in radii at the rim.
148 /// Share of older relief the ejecta replace by the crater's datum at the rim, falling with
149 /// their thickness; 0 buries nothing, and without a datum nothing is buried.
150 double mantling = 0.0;
151 double ejectaReachRadii = 3.0; ///< How far ejecta texture and burial reach, in radii.
152 /// Freshness (`CraterState::Freshness`) at or below which gullies and ejecta texture are gone,
153 /// in [0, 1); they fade in along a smoothstep above it.
154 double minFreshness = 0.5;
155 /// Varies the texture of every crater; unset follows the crater layer's `seed`, and is 0
156 /// outside a layer.
157 std::optional<std::uint32_t> seed{};
158
159 /// Whether anything is drawn beyond the profile: ejecta texture or burial.
160 318439 bool ReachesBeyondRim() const {
161
3/4
✓ Branch 0 taken 293855 times.
✓ Branch 1 taken 24584 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 293992 times.
318439 return ejecta > 0.0 || mantling > 0.0;
162 }
163
164 /// Memberwise equality.
165 4 bool operator==(const CraterTexture& other) const {
166 8 return wallStreaks == other.wallStreaks &&
167
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 wallStreakWidthRadii == other.wallStreakWidthRadii && ejecta == other.ejecta &&
168
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 ejectaLineationRadii == other.ejectaLineationRadii && mantling == other.mantling &&
169
3/6
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
8 ejectaReachRadii == other.ejectaReachRadii && minFreshness == other.minFreshness &&
170
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 seed == other.seed;
171 }
172 bool operator!=(const CraterTexture& other) const {
173 return !(*this == other);
174 }
175 };
176
177 /// Checks crater texture settings.
178 /// @throws std::invalid_argument for a field outside its range (`CheckRanges`).
179 void ValidateCraterTexture(const CraterTexture& texture);
180
181 /// Slump terraces on the walls of large craters, benches and scarps drawn per crater ID that
182 /// soften as it wears; the floor edge is the profile's, else Pike's (1980, USGS PP 1046-C,
183 /// eq. 15) 0.187 D^1.249 km.
184 7 struct CraterTerraces {
185 bool enabled = false; ///< Whether large craters get terraces.
186 /// Smallest terraced crater (m); by default 20 km, where half of fresh lunar mare craters are
187 /// terraced (Smith and Hartnell 1978); about 8 km on Mars (Pike 1980, LPSC 11, Table 3).
188 double onsetDiameter = 20000.0;
189 /// Diameter (m) from which every crater has its most benches, over most of its wall; by
190 /// default 65 km, from which every fresh lunar crater is terraced (Smith and Hartnell 1978).
191 double fullDiameter = 65000.0;
192 int minBenches = 1; ///< Benches at the onset diameter.
193 int maxBenches = 4; ///< Benches from the full diameter.
194 /// Slope of a bench (degrees); terraces are mapped as surfaces under 5 degrees (Du et al.
195 /// 2024, LPSC 55, abstract 1382).
196 double benchSlopeDegrees = 3.0;
197 /// Least share of each step the scarps take, in (0, 1); steeper steps give them more.
198 double scarpShare = 0.25;
199 /// Slope the scarps rise at (degrees), above the bench slope and under 60: each step gives its
200 /// scarps the share of its width that keeps them near it, as fresh crater walls stand near
201 /// the angle of repose.
202 double scarpSlopeDegrees = 35.0;
203 /// Share of the wall's circumference each bench covers at the onset diameter, in (0, 1],
204 /// rising to 0.9 at the full diameter; 1 sets benches all the way round.
205 double arcShare = 0.6;
206 double rimVariation = 0.08; ///< How far the bench radii wander around the rim, in radii.
207 /// How far each slump block's headscarp steps in or out from its neighbors', as a share of
208 /// the room between scarps, in [0, 1]; 0 keeps every scarp one unbroken scalloped line.
209 double blockOffset = 0.6;
210 /// Share of slump blocks missing from each bench, in [0, 1), so benches break into segments
211 /// with the wall unstepped between them; 0 keeps every block.
212 double blockGaps = 0.25;
213 /// Freshness (current over fresh depth) below which the terraces are gone; they soften from
214 /// 1 down to it.
215 double minFreshness = 0.3;
216 std::optional<std::uint32_t> seed{}; ///< Unset follows the crater layer's seed.
217
218 /// Memberwise equality.
219 4 bool operator==(const CraterTerraces& other) const {
220
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 return enabled == other.enabled && onsetDiameter == other.onsetDiameter &&
221
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 fullDiameter == other.fullDiameter && minBenches == other.minBenches &&
222
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 maxBenches == other.maxBenches && benchSlopeDegrees == other.benchSlopeDegrees &&
223
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 scarpShare == other.scarpShare && scarpSlopeDegrees == other.scarpSlopeDegrees &&
224
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 arcShare == other.arcShare && rimVariation == other.rimVariation &&
225
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 blockOffset == other.blockOffset && blockGaps == other.blockGaps &&
226
3/6
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
8 minFreshness == other.minFreshness && seed == other.seed;
227 }
228 bool operator!=(const CraterTerraces& other) const {
229 return !(*this == other);
230 }
231 };
232
233 /// Checks crater terraces.
234 /// @throws std::invalid_argument for a field outside its range (`CheckRanges`), a full diameter
235 /// not above the onset diameter, more `minBenches` than `maxBenches`, or a scarp slope not above
236 /// the bench slope.
237 void ValidateCraterTerraces(const CraterTerraces& terraces);
238
239 /// Central peaks of complex craters built from massifs drawn per crater ID in place of the round
240 /// dome, at the profile's peak height and base; only closed-form `ComplexCraterProfile`s use them.
241 7 struct CraterPeaks {
242 bool enabled = false; ///< Whether complex craters get massif peaks.
243 int minMassifs = 1; ///< Fewest massifs of a peak.
244 int maxMassifs = 4; ///< Most massifs of a peak, at most 8.
245 /// How far the lesser massifs' centers scatter from the crater's center, in peak base radii,
246 /// at most 2.
247 double spreadRadii = 0.8;
248 double elongation = 2.0; ///< Most aspect ratio of a massif's footprint, at least 1.
249 /// Spread (degrees) of the lesser massifs' bearings about a chain through the center, in
250 /// [0, 360]: about 70 strings them across the floor as the peaks of Copernicus are, and wide
251 /// spreads scatter them around it into stars and crosses such as Theophilus's.
252 double chainSpreadDegrees = 70.0;
253 /// How sharp the massifs' crests are, in [0, 1]: 0 domes them, 1 makes spires.
254 double sharpness = 0.6;
255 /// How far each massif's summit sits off its center toward one flank, in [0, 1].
256 double lopsidedness = 0.5;
257 /// How much lower than the main massif the others may be, as a share of its height, in [0, 1].
258 double heightVariation = 0.5;
259 /// Ridged noise over the massifs, as a share of their height, in [0, 1]; worn peaks lose it.
260 double roughness = 0.35;
261 double roughnessWavelength = 0.35; ///< The noise's wavelength, in peak base radii.
262 /// How far the noise warps the massifs' outlines, in peak base radii, at most 0.3.
263 double warp = 0.12;
264 /// The massifs' height over the profile's peak height, in (0, 4]: real peaks of a size
265 /// scatter widely about the fitted laws.
266 double heightScale = 1.0;
267 /// The massifs' spread and size over the profile's peak base, in (0, 3].
268 double widthScale = 1.0;
269 std::optional<std::uint32_t> seed{}; ///< Unset follows the crater layer's seed.
270
271 /// Memberwise equality.
272 4 bool operator==(const CraterPeaks& other) const {
273 8 return enabled == other.enabled && minMassifs == other.minMassifs &&
274
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 maxMassifs == other.maxMassifs && spreadRadii == other.spreadRadii &&
275
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 elongation == other.elongation && chainSpreadDegrees == other.chainSpreadDegrees &&
276
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 sharpness == other.sharpness && lopsidedness == other.lopsidedness &&
277
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 heightVariation == other.heightVariation && roughness == other.roughness &&
278
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 roughnessWavelength == other.roughnessWavelength && warp == other.warp &&
279
3/6
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
8 heightScale == other.heightScale && widthScale == other.widthScale &&
280
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 seed == other.seed;
281 }
282 bool operator!=(const CraterPeaks& other) const {
283 return !(*this == other);
284 }
285 };
286
287 /// Checks crater central peaks.
288 /// @throws std::invalid_argument for a field outside its range (`CheckRanges`) or more
289 /// `minMassifs` than `maxMassifs`.
290 void ValidateCraterPeaks(const CraterPeaks& peaks);
291
292 /// How `ApplyCraters` shapes craters into the terrain.
293 struct CraterApplyOptions {
294 CraterOrder order = CraterOrder::OldestFirst; ///< Which craters overprint which.
295 /// How craters too small to resolve at the sample spacing fade out.
296 ResolutionFade fade{};
297 /// Reference surface for the interior (`FitCraterDatum`); with `None` craters are purely
298 /// additive and the datum settings below are unused.
299 CraterDatum datum = CraterDatum::None;
300 /// Footprint the datum is fitted over, in crater radii.
301 double datumFitRadii = 1.0;
302 /// Share of the interior replaced by datum plus profile, in [0, 1]: 1 erases older relief, 0
303 /// keeps it. By default 0, so craters cut into a datum keep the older relief on their floor
304 /// and walls; 1 gives a clean cut.
305 double interiorReplacement = 0.0;
306 CraterBlend blend{}; ///< Where the replaced interior blends out.
307 /// How craters with `Crater::replace` replace the terrain beneath them, with or without a
308 /// datum for the others.
309 CraterReplacement replacement{};
310 /// Irregular, non-circular outlines; off by default.
311 CraterIrregularity irregularity{};
312 RimSmoothing rimSmoothing{}; ///< Rounded rims; off by default.
313 CraterNoise noise{}; ///< Fractal noise over each crater; off by default.
314 CraterTexture texture{}; ///< Wall gullies, ejecta texture and burial; off by default.
315 /// Floors offset downslope, rims lowered upslope and faster wear on the slope of the ground
316 /// beneath the layer; needs the `Plane` datum.
317 CraterSlopeResponse slope{};
318 CraterTerraces terraces{}; ///< Slump terraces on the walls of large craters; off by default.
319 CraterPeaks peaks{}; ///< Central peaks built from massifs; off by default.
320 /// What craters are shaped on; on a sphere, centers and rasters are longitude and latitude and
321 /// each crater is shaped in its local frame, spacings in meters.
322 Surface surface{};
323
324 /// Memberwise equality.
325 4 bool operator==(const CraterApplyOptions& other) const {
326
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
8 return order == other.order && fade == other.fade && datum == other.datum &&
327
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 datumFitRadii == other.datumFitRadii &&
328
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 interiorReplacement == other.interiorReplacement && blend == other.blend &&
329
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
4 replacement == other.replacement && irregularity == other.irregularity &&
330
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 rimSmoothing == other.rimSmoothing && noise == other.noise &&
331
3/6
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
4 texture == other.texture && slope == other.slope && terraces == other.terraces &&
332
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
8 peaks == other.peaks && surface == other.surface;
333 }
334 bool operator!=(const CraterApplyOptions& other) const {
335 return !(*this == other);
336 }
337 };
338
339 /// How a crater layer shapes its craters by default: irregular outlines and wall terraces on
340 /// (Bottke et al. 2000, https://doi.org/10.1006/icar.1999.6323).
341 CraterApplyOptions DefaultCraterApply();
342
343 /// `apply` with each unset seed (irregularity, noise, texture, slope and terraces) drawn from the
344 /// layer's `seed`, each on its own substream, so changing the layer's seed changes them too.
345 CraterApplyOptions SeededCraterApply(CraterApplyOptions apply, std::uint32_t seed);
346
347 /// Checks crater apply options.
348 /// @throws std::invalid_argument for a field outside its range (`CheckRanges`), an invalid `fade`,
349 /// `irregularity`, `slope`, `terraces`, `peaks` or `replacement`, a slope response without the
350 /// `Plane` datum, or a blend whose `endRadii` is not above its `startRadii`.
351 void ValidateCraterApplyOptions(const CraterApplyOptions& options);
352
353 /// Indices into `craters` in the order they are applied; ties fall to age, then diameter, then
354 /// the smaller ID.
355 std::vector<std::size_t> CraterApplyOrder(const CraterList& craters, CraterOrder order);
356
357 } // namespace terraingen
358