Skip to content

Commit 2bfe966

Browse files
committed
bug solved
1 parent 0fa3af5 commit 2bfe966

File tree

33 files changed

+316
-391
lines changed

33 files changed

+316
-391
lines changed

img/3.png

2.4 KB
Loading

img/4.png

-324 Bytes
Loading

img/5.png

923 Bytes
Loading

img/6.png

-565 Bytes
Loading

img/7.png

1.27 KB
Loading

img/8.png

2.99 KB
Loading

simulators/1_mass_spring/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
int main()
44
{
5-
double rho = 1000, k = 1e5, initial_stretch = 1.4, n_seg = 1, h = 0.004, side_len = 1, tol = 0.01;
5+
double rho = 1000, k = 1e5, initial_stretch = 1.4, n_seg = 10, h = 0.004, side_len = 1, tol = 0.01;
66
MassSpringSimulator<double, 2> simulator(rho, side_len, initial_stretch, k, h, tol, n_seg);
77
simulator.run();
88
}

simulators/2_dirichlet/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
int main()
44
{
5-
double rho = 1000, k = 1e3, initial_stretch = 1, n_seg = 4, h = 0.02, side_len = 1, tol = 0.01;
5+
double rho = 1000, k = 1e3, initial_stretch = 1, n_seg = 20, h = 0.02, side_len = 1, tol = 0.01;
66
// printf("Running mass-spring simulator with parameters: rho = %f, k = %f, initial_stretch = %f, n_seg = %d, h = %f, side_len = %f, tol = %f\n", rho, k, initial_stretch, n_seg, h, side_len, tol);
77
DirichletSimulator<double, 2> simulator(rho, side_len, initial_stretch, k, h, tol, n_seg);
88
simulator.run();

simulators/3_contact/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
int main()
44
{
5-
double rho = 1000, k = 2e4, initial_stretch = 1, n_seg = 1, h = 0.01, side_len = 1, tol = 0.01;
5+
double rho = 1000, k = 4e4, initial_stretch = 1, n_seg = 15, h = 0.01, side_len = 1, tol = 0.01;
66
ContactSimulator<double, 2> simulator(rho, side_len, initial_stretch, k, h, tol, n_seg);
77
simulator.run();
88
}

simulators/3_contact/src/simulator.cu

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ void ContactSimulator<T, dim>::Impl::draw()
177177
{
178178
window.clear(sf::Color::White); // Clear the previous frame
179179

180+
// Draw the ground
181+
sf::Vertex line[] = {
182+
sf::Vertex(sf::Vector2f(screen_projection_x(-5.0), screen_projection_y(-1.0)), sf::Color::Blue),
183+
sf::Vertex(sf::Vector2f(screen_projection_x(5.0), screen_projection_y(-1.0)), sf::Color::Blue)};
184+
window.draw(line, 2, sf::Lines);
180185
// Draw springs as lines
181186
for (int i = 0; i < e.size() / 2; ++i)
182187
{

0 commit comments

Comments
 (0)