- #1
Stargazer43
- 7
- 0
- TL;DR Summary
- Trying to describe position on a circle as a function of time within 0-360 degrees, without creating a discontinuity when the angle goes from 360-degrees back to 0.
I'm trying to write a program to solve a series of dynamic equations, and ran into one stumbling block that seems like it should be easy to resolve. Basically, I'm trying to solve for the angular position of an object rotating around a circle, and to specify certain conditions on the circle when the object passes over it. These conditions would not be active on the rest of the circle. This is far enough outside the realm of what I usually get involved with that I could use some advice! I have a series of discretized equations for each position on the circle. The issues I was running into were the following:
1.) I can easily solve for the angular position as a function of time by using RPM = Angle/Time, but the issue is that my circle is only 0-360 degrees. After one revolution the reported angle will be >360, and arbitrarily resetting it back to 0 creates a major discontinuity that throws off the equation solvers I'm using. Is there a way to normalize the angle so that there will be a smooth transition between 360 degrees and 0 degrees, and to keep the final angular value within the range of 0-360?
2.) For each position on the circle, I want to set the value of a variable x=1 if the position matches the angle calculated above as a function of time, and have x decay to 0 if the angle is more than 10-degrees apart from that calculated above. Is there a good way to do this? I started off by using a ratio of the values of sin(Angle), but since two different angles can have the same sin value, it wasn't working quite as intended.
1.) I can easily solve for the angular position as a function of time by using RPM = Angle/Time, but the issue is that my circle is only 0-360 degrees. After one revolution the reported angle will be >360, and arbitrarily resetting it back to 0 creates a major discontinuity that throws off the equation solvers I'm using. Is there a way to normalize the angle so that there will be a smooth transition between 360 degrees and 0 degrees, and to keep the final angular value within the range of 0-360?
2.) For each position on the circle, I want to set the value of a variable x=1 if the position matches the angle calculated above as a function of time, and have x decay to 0 if the angle is more than 10-degrees apart from that calculated above. Is there a good way to do this? I started off by using a ratio of the values of sin(Angle), but since two different angles can have the same sin value, it wasn't working quite as intended.