TerrainGen coverage


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

layers/craters/shaping/attributes.cpp
Line Branch Exec Source
1 #include "terraingen/layers/craters/shaping/attributes.h"
2
3 #include <cmath>
4
5 namespace terraingen {
6
7 63603 CraterAttributes ComputeCraterAttributes(const Crater& crater, const CraterState& state,
8 const CraterProfile& profile) {
9 63603 const double diameter = crater.diameter;
10 63603 double rim = -INFINITY;
11
2/2
✓ Branch 0 taken 3879783 times.
✓ Branch 1 taken 63603 times.
3943386 for (int step = 70; step <= 130; ++step) {
12 3879783 const double radii = 0.01 * static_cast<double>(step);
13 3879783 rim = std::fmax(rim, profile.Height(0.5 * radii * diameter, diameter, state));
14 }
15 63603 double floor = INFINITY;
16
2/2
✓ Branch 0 taken 6423903 times.
✓ Branch 1 taken 63603 times.
6487506 for (int step = 0; step <= 100; ++step) {
17 6423903 floor = std::fmin(floor, profile.Height(0.005 * step * diameter, diameter, state));
18 }
19 63603 return {-floor, rim, state.current.depthRatio, state.Freshness(), profile.IsComplex(diameter)};
20 }
21
22 } // namespace terraingen
23