FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
SeabedScatter.h
1#pragma once
2
3#include <array>
4#include <cstdint>
5#include <functional>
6#include <vector>
7
15namespace visual::scatter
16{
17
19struct Rock
20{
21 double x = 0.0, y = 0.0, z = 0.0;
22 double size = 1.0;
23 double yaw = 0.0;
24 double tilt = 0.0;
25 int variant = 0;
26};
27
29struct Kelp
30{
31 double x = 0.0, y = 0.0, z = 0.0;
32 double height = 3.0;
33 int blades = 4;
34 double phase = 0.0;
35 double yaw = 0.0;
36};
37
40{
41 double centreX = 0.0, centreY = 0.0;
42 double halfSize = 150.0;
43 double rockDensity = 0.06;
44 double kelpDensity = 0.0;
45 double kelpDepth = 20.0;
46 double mudDepth = 40.0;
47 int variants = 6;
48 std::uint32_t seed = 1;
49};
50
52struct Scatter
53{
54 std::vector<Rock> rocks;
55 std::vector<Kelp> kelp;
56};
57
68Scatter ScatterSeabed(const ScatterSpec& spec, const std::function<double(double, double)>& depth);
69
71struct Mesh
72{
73 std::vector<std::array<float, 3>> positions;
74 std::vector<std::array<float, 3>> normals;
75 std::vector<std::uint32_t> indices;
76};
77
84Mesh MakeRock(std::uint32_t seed, int subdivisions = 2);
85
86} // namespace visual::scatter
One kelp plant (a few blades from one holdfast).
Definition SeabedScatter.h:30
double height
Length of the blades [m].
Definition SeabedScatter.h:32
int blades
Number of blades.
Definition SeabedScatter.h:33
double yaw
Turn of the blade fan [rad].
Definition SeabedScatter.h:35
double phase
Phase of its sway [rad].
Definition SeabedScatter.h:34
double z
Holdfast on the seabed [m].
Definition SeabedScatter.h:31
A triangle mesh with smooth normals.
Definition SeabedScatter.h:72
std::vector< std::uint32_t > indices
Three per triangle, counter-clockwise seen from outside.
Definition SeabedScatter.h:75
One loose rock.
Definition SeabedScatter.h:20
int variant
Which of the rock shapes.
Definition SeabedScatter.h:25
double z
Centre of the base, on the seabed [m].
Definition SeabedScatter.h:21
double tilt
Tilt [rad] about a horizontal axis at angle yaw.
Definition SeabedScatter.h:24
double yaw
Turn about the vertical [rad].
Definition SeabedScatter.h:23
double size
Diameter [m].
Definition SeabedScatter.h:22
Where to scatter, and how much.
Definition SeabedScatter.h:40
double centreY
Centre of the square [m].
Definition SeabedScatter.h:41
int variants
Number of rock shapes.
Definition SeabedScatter.h:47
double halfSize
Half the side of the square [m].
Definition SeabedScatter.h:42
double mudDepth
No rocks below about this depth (mud).
Definition SeabedScatter.h:46
double rockDensity
Rocks per m^2 on rocky ground (fewer on sand and mud).
Definition SeabedScatter.h:43
double kelpDensity
Kelp plants per m^2 inside a kelp patch.
Definition SeabedScatter.h:44
double kelpDepth
Kelp only where the seabed is shallower [m].
Definition SeabedScatter.h:45
The scattered elements.
Definition SeabedScatter.h:53