]> git.treefish.org Git - seamulator.git/blobdiff - src/sea.cpp
Fixed license text
[seamulator.git] / src / sea.cpp
index 85191d4fd7680fc5708dc25bd7da23ca53ee2767..b55c1f35a4b7970ab35e99dd85404ce71e447286 100644 (file)
@@ -1,3 +1,22 @@
+/**
+ * Copyright (C) 2016  Alexander Schmidt
+ *
+ * This file is part of Seamulator.
+ *
+ * Seamulator is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Seamulator is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Seamulator.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
 #include "sea.h"
 
 #include <cmath>
 
 #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 +108,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;
 }