dilevin / computer-graphics-mass-spring-systems

Computer Graphics Assignment – Mass Spring Systems
1 stars 2 forks source link

Horizontal springs acting strange... #17

Closed NPTP closed 4 years ago

NPTP commented 4 years ago

[With dense matrices]

My single spring works great, looks just like the gif, etc.

My hanging chain starts looking great. Looking at console output, all the matrices in the precomputation step appear to be computed correctly. On running/animating, all un-pinned vertices except the rightmost one just fall straight down as if there's no resistance on their springs whatsoever. The rightmost vertex looks to be "attached" correctly. Here's the final state of things after animating, with just one un-pinned vertex still in the screen space:

image

Same thing happens with the net, all but one un-pinned vertex just straight drop, it just draws extremely slowly so hard to get a good shot. Any ideas or debug tips?

Also, as a side note: I haven't worked on this since earlier in the week, lots of stuff due in between. My Visual Studio 2019 on Windows was working fine compiling this project. I haven't touched it since I last built the project (which is how I got that screengrab). However, today, suddenly it doesn't recognize any C++ imports in the Eigen/Core file (such as #include <complex> or #<malloc.h> etc, with a ). No idea how this happened without me touching it, any ideas there? Edit: As if by magic, coming back to it again later, all the imports work again. Huh...

Thank you!

abhimadan commented 4 years ago

It could be that only one of your d vectors has the correct length and the rest do not. This would explain why the single spring example worked and this one doesn't. (I suspect this could be the issue because, physically, the springs are acting as if they are generating no elastic force, which means that they have an incorrect rest position.)

NPTP commented 4 years ago

Thanks for the tip, it led me to the right place. I discovered I just had a matrix initialization in the wrong loop so it was cancelling out work that I was doing and basically obliterating the d vectors all except one. Cheers!