It works for me.
My theory is you are compiling it and double clicking the binary produced. Have you ever tried opening the program via a terminal?
I'll just assume you are using windows and you should open the command prompt, navigate to the directory where you compiled it, and open it in...
Aha! I have fixed it.
I had to change the theta2 calculation to the following:
theta2 = M_PI - asin(L1/Ld*sin(theta)) - (M_PI-phi-asin(L3*sin(phi)/Ld));
When I drew it out on paper, I had one sign wrong...thus is the life of an engineer.
Also I changed the way I calculated it slightly (less...
I know there are programs out there that can do this already, but I want to keep sharp on my programming skills.
All I want to do is animate a grashof 4 bar mechanism. The program I wrote does this correctly for the most part. The problem is that when the crank gets around to around -45...