diff options
author | sotech117 <michael_foiani@brown.edu> | 2024-05-04 16:53:45 -0400 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2024-05-04 16:53:45 -0400 |
commit | 6120499fd6d66fa010ab0bfcf3089eeeddb3b45c (patch) | |
tree | 054da27557494d971a538b46d0892d0c760b02f6 /src | |
parent | 7bf86226e158a818e6d6ccac8657140789612bd0 (diff) |
further testing at higher params
Diffstat (limited to 'src')
-rw-r--r-- | src/arap.cpp | 4 | ||||
-rwxr-xr-x | src/glwidget.cpp | 16 | ||||
-rw-r--r-- | src/ocean/ocean_alt.cpp | 29 | ||||
-rw-r--r-- | src/ocean/ocean_alt.h | 10 |
4 files changed, 26 insertions, 33 deletions
diff --git a/src/arap.cpp b/src/arap.cpp index 1228c08..2f10849 100644 --- a/src/arap.cpp +++ b/src/arap.cpp @@ -104,8 +104,8 @@ void ARAP::update(double seconds) // the last update m_ocean.fft_prime(m_time); - m_shape.setVertices_and_Normals(m_ocean.get_vertices(), m_ocean.getNormals()); - // m_shape.setVertices(m_ocean.get_vertices()); + // m_shape.setVertices_and_Normals(m_ocean.get_vertices(), m_ocean.getNormals()); + m_shape.setVertices(m_ocean.get_vertices()); m_time += m_timestep; diff --git a/src/glwidget.cpp b/src/glwidget.cpp index 0bf15d5..7d56389 100755 --- a/src/glwidget.cpp +++ b/src/glwidget.cpp @@ -189,14 +189,14 @@ void GLWidget::paintGL() glClear(GL_DEPTH_BUFFER_BIT); - m_pointShader->bind(); - m_pointShader->setUniform("proj", m_camera.getProjection()); - m_pointShader->setUniform("view", m_camera.getView()); - m_pointShader->setUniform("vSize", m_vSize); - m_pointShader->setUniform("width", width()); - m_pointShader->setUniform("height", height()); - m_arap.draw(m_pointShader, GL_POINTS); - m_pointShader->unbind(); +// m_pointShader->bind(); +// m_pointShader->setUniform("proj", m_camera.getProjection()); +// m_pointShader->setUniform("view", m_camera.getView()); +// m_pointShader->setUniform("vSize", m_vSize); +// m_pointShader->setUniform("width", width()); +// m_pointShader->setUniform("height", height()); +// m_arap.draw(m_pointShader, GL_POINTS); +// m_pointShader->unbind(); } void GLWidget::resizeGL(int w, int h) diff --git a/src/ocean/ocean_alt.cpp b/src/ocean/ocean_alt.cpp index dafa50b..d34ad55 100644 --- a/src/ocean/ocean_alt.cpp +++ b/src/ocean/ocean_alt.cpp @@ -132,20 +132,13 @@ Eigen::Vector2d ocean_alt::h_prime_t(int i, double t){ Eigen::Vector2d neg_complex_exp = complex_exp(-w_prime*t); // vector(real, imag) // now multiply our four vector(real, imag) out - double real_comp = - h0_prime[0]*pos_complex_exp[0] - - h0_prime[1]*pos_complex_exp[1] - + h0_prime_conj[0]*neg_complex_exp[0] - + h0_prime_conj[1]*neg_complex_exp[1]; + (h0_prime[0]*pos_complex_exp[0] - h0_prime[1]*pos_complex_exp[1]) + + (h0_prime_conj[0]*neg_complex_exp[0] - h0_prime_conj[1]*neg_complex_exp[1]); double imag_comp = - h0_prime[0]*pos_complex_exp[1] - + h0_prime[1]*pos_complex_exp[0] - + h0_prime_conj[0]*neg_complex_exp[1] - - h0_prime_conj[1]*neg_complex_exp[0]; - - + (h0_prime[0]*pos_complex_exp[1] + h0_prime[1]*pos_complex_exp[0]) + + (h0_prime_conj[0]*neg_complex_exp[1] + h0_prime_conj[1]*neg_complex_exp[0]); return Eigen::Vector2d(real_comp, imag_comp); } @@ -201,8 +194,8 @@ Eigen::Vector2d ocean_alt::get_k_vector(int n_prime, int m_prime){ double N_ = (double)num_rows; double M_ = (double)num_cols; - double k_x = (2.0*M_PI*n_ - M_PI*N_)/Lx; - double k_z = (2.0*M_PI*m_ - M_PI*M_)/Lz; + double k_x = (2*M_PI*n_ - M_PI*N_)/Lx; + double k_z = (2*M_PI*m_ - M_PI*M_)/Lz; return Eigen::Vector2d(k_x, k_z); } @@ -247,8 +240,8 @@ std::pair<double,double> ocean_alt::sample_complex_gaussian(){ } // real and imaginary parts of the complex number - double real = sqrt(-2 * log(uniform_1)) * cos(2 * M_PI * uniform_2); - double imag = sqrt(-2 * log(uniform_1)) * sin(2 * M_PI * uniform_2); + double real = sqrt(-2*log(uniform_1)) * cos(2*M_PI*uniform_2); + double imag = sqrt(-2*log(uniform_1)) * sin(2*M_PI*uniform_2); return std::make_pair(real, imag); } @@ -280,8 +273,8 @@ std::vector<Eigen::Vector3f> ocean_alt::get_vertices() Eigen::Vector3f norm = Eigen::Vector3f(diff[0]/ sqrt(xs), diff[1]/ sqrt(ys), diff[2]/sqrt(zs)); // NEW -// Eigen::Vector3f norm = Eigen::Vector3f(-slope[0], 1.0, -slope[1]); -// norm.normalize(); + // Eigen::Vector3f norm = Eigen::Vector3f(-slope[0], 1.0, -slope[1]); + // norm.normalize(); // NEW @@ -452,7 +445,7 @@ std::vector<Eigen::Vector2d> ocean_alt::fast_fft for (int i = 0; i < N; i++) { // h[i] /= N; - // h[i] /= sqrt(N); + h[i] /= sqrt(N); h[i] *= sign[(i / num_rows + i % num_cols) % 2]; } diff --git a/src/ocean/ocean_alt.h b/src/ocean/ocean_alt.h index a3f1be5..4bb1d54 100644 --- a/src/ocean/ocean_alt.h +++ b/src/ocean/ocean_alt.h @@ -60,18 +60,18 @@ private: - const double Lx = 32.0; - const double Lz = 32.0; + const double Lx = 512.0; + const double Lz = 512.0; const int num_rows = 256; const int num_cols = 256; const int N = num_rows*num_cols; // total number of grid points - const double lambda = 0.4; // how much displacement matters + const double lambda = 0; // how much displacement matters const double spacing = 35.0; // spacing between grid points - const double A = .25; // numeric constant for the Phillips spectrum - const double V = 49; // wind speed + const double A = 100; // numeric constant for the Phillips spectrum + const double V = 50; // wind speed const double gravity = 9.81; const double L = V*V/gravity; const Eigen::Vector2d omega_wind = Eigen::Vector2d(1.0, 0.0); // wind direction, used in Phillips equation |