X-Git-Url: http://git.treefish.org/~alex/seamulator.git/blobdiff_plain/1f181535dc46342c079b13e35547673e570a099b..6280f60567d99bd059818523fcdb0a710173b3d9:/src/sea.cpp?ds=sidebyside diff --git a/src/sea.cpp b/src/sea.cpp index 85191d4..597e0a1 100644 --- a/src/sea.cpp +++ b/src/sea.cpp @@ -6,13 +6,13 @@ #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} { @@ -89,7 +89,7 @@ double Sea::phillipsSpectrum(double k_x, double k_y) const 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; }