class Sea
{
public:
- Sea(WaterSurfacePtr surface);
+ Sea(WaterSurfacePtr surface, double windSpeed, double magicConstant);
~Sea();
Sea(const Sea&) = delete;
Sea& operator=(const Sea&) = delete;
void update();
private:
- static const double PHILLIPS_CONSTANT;
static const double GRAVITATIONAL_CONSTANT;
WaterSurfacePtr m_surface;
double m_windDirection[2];
double m_windSpeed;
+ double m_magicConstant;
std::random_device m_randomDevice;
std::mt19937 m_randomGenerator;
std::normal_distribution<> m_normalDistribution;
#include "watersurface.h"
-const double Sea::PHILLIPS_CONSTANT{0.0000001};
const double Sea::GRAVITATIONAL_CONSTANT{9.8};
-Sea::Sea(WaterSurfacePtr surface) :
+Sea::Sea(WaterSurfacePtr surface, double windSpeed, double magicConstant) :
m_surface{surface},
m_windDirection{1, 0},
- m_windSpeed{10},
+ m_windSpeed{windSpeed},
+ m_magicConstant{magicConstant},
m_randomGenerator{m_randomDevice()},
m_normalDistribution{0.0, 1.0}
{
const double cosineFactor = pow((k_x / k) * m_windDirection[0] +
(k_y / k) * m_windDirection[1], 2);
- return PHILLIPS_CONSTANT * exp(-1 / pow(k * L, 2)) / pow(k, 4) *
+ return m_magicConstant * exp(-1 / pow(k * L, 2)) / pow(k, 4) *
cosineFactor;
}
std::srand(std::time(0));
surface = std::make_shared<WaterSurface>(LATTICE_SIZE, LATTICE_EXTEND);
- sea = std::make_shared<Sea>(surface);
+ sea = std::make_shared<Sea>(surface, 10, 0.0000001);
seaView = std::make_unique<SeaView>(INIT_VIEW_DISTANCE, INIT_VIEW_AZIMUTH,
INIT_VIEW_ALTITUDE);