I watched The Coding Train's simulation on Springs and I had a few idea of how to use this in Java and in my text mode graphic canvas, so I built this small demo application. I also implemented some simple mouse support, which is quite difficult in text mode. Check the source code in GitHub.
Source code: https://github.com/AppliedCodingClub/...
Resource:
The Coding Train video: • Coding Challenge 160: Spring Forces
0:00 Intro
1:51 Demo!
3:21 Delta time (dt) in simulation
4:32 Spring chain
5:09 Stiffness (k) of springs
5:41 Different masses (m)
6:14 Initial spacing between springs
7:05 Frame skips
7:37 Elastic band
8:15 Mouse interaction in text mode Java (jnativehook)
10:11 Mouse drag and text selection
10:47 Coding time: mouse events
12:15 Coding time: physics models
12:52 Coding the springs
15:05 Coding the balls
17:22 Displaying everything
18:15 That's All, Folks!
#SpringSimulation #ComputationalPhysics #Java #LearnToCode #Coding
👨💻 About me
🖥 I am a software developer with more than 20 years of experience in the tech industry. I love to teach, debug problems and optimize my code for perfection.
📽 In my channel, you find videos describing how to solve coding problems, develop games, prep for job interviews and overall talk tech. I chose the name AppliedCoding, because I will teach you exactly that - applied coding - I show you how to analyze real problems, break them down into manageable chunks, come up with an algorithm, choose the right data structures, talk about the pros and cons… and only then code the solution.
*****
👉 Blog: https://blog.appliedcoding.club
👉 Instagram: / appliedcoding
👉 Facebook: / appliedcodingclub
👉 Github: https://github.com/AppliedCodingClub