FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
SeafloorDustPoint.h
1#pragma once
2
6
7#ifdef FH_VISUALIZATION
8
9# include <fhsim_environment/EnvironmentProvider.h>
10# include <fhsim_environment/SeafloorForcesInterface.h>
11# include <fhsim_environment/seabed/SeabedDust.h>
12# include <fhsim_environment/visual/SeafloorDust.h>
13
14# include <cmath>
15# include <limits>
16
17namespace seafloor_dust
18{
19
21inline constexpr double kCableNetDustRange = 3.0;
22inline constexpr double kCableNetDustFullSpeed = 1.5;
23
36inline environment::DustPoint MakeDustPoint(environment::EnvironmentProvider& environment, environment::SeafloorForcesInterface& seafloor, double diameter, const double pos[3], const double vel[3])
37{
38 const double speed = std::sqrt(vel[0] * vel[0] + vel[1] * vel[1] + vel[2] * vel[2]);
39
40 double bedDepth = 0.0;
41 if (!marenv::IsUsable(environment.GetSeaDepth(pos, bedDepth)))
42 return {{std::numeric_limits<double>::infinity(), {pos[0], pos[1], pos[2]}}, speed, 0.0};
43
44 const environment::seabed::Sphere sphere {diameter};
45 const auto clearance = environment::seabed::SphereClearance(sphere, pos, bedDepth);
46 double force = 0.0;
47 if (clearance.distance <= 0.0) {
48 const auto load = seafloor.Sphere(sphere, pos, vel);
49 force = std::sqrt(load.force[0] * load.force[0] + load.force[1] * load.force[1] + load.force[2] * load.force[2]);
50 }
51 return {clearance, speed, force};
52}
53
54} // namespace seafloor_dust
55
56#endif // FH_VISUALIZATION
constexpr bool IsUsable(Status status) noexcept
Definition marenv.h:59
Definition FlukeAnchor.h:124