Commit 30d46db1 authored by bbguimaraes's avatar bbguimaraes
Browse files

sms: simulation tweaks

parent f54d413b
......@@ -5,7 +5,7 @@
#include "sms/spring.h"
/*static*/
const float SpringMassSystem::DAMPING = 0.95f;
const float SpringMassSystem::DAMPING = 0.98f;
/*static*/
void SpringMassSystem::link(Mass * mass0, Mass * mass1, Spring * spring) {
......
......@@ -15,7 +15,7 @@ void init_sm_system3(SpringMassSystem * system);
GLuint load_texture(const std::string & filename);
int main(int argc, char ** argv) {
const double UPDATE_RATE = 1.0f / 5000.0f;
const double UPDATE_RATE = 1.0f / 3000.0f;
QApplication app(argc, argv);
SpringMassSystem sms0, sms1;
init_sm_system3(&sms0);
......@@ -82,7 +82,7 @@ void init_sm_system2(SpringMassSystem * system) {
system,
Vector(-5.0f, 10.0f), Vector(5.0f, 0.0f),
W, 5,
1.0f, 10.0f);
1.0f, 30.0f);
(*system->masses())[0].set_fixed(true);
(*system->masses())[W - 1].set_fixed(true);
}
......
......@@ -177,7 +177,9 @@ void SMSCreator::create_crossed_flag(
for(unsigned int x = 0; x < x_masses - 1; ++x) {
link(x , y, x + 1, y , INCREMENT.x());
link(x , y, x , y + 1, INCREMENT.y());
spring_it->set_k(k * 0.05f);
link(x , y, x + 1, y + 1, INCREMENT_LENGTH);
spring_it->set_k(k * 0.05f);
link(x + 1, y, x , y + 1, INCREMENT_LENGTH);
}
link(x_masses - 1, y, x_masses - 1, y + 1, INCREMENT.y());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment