Intel's Ronler Acres Plant

Silicon Forest
If the type is too small, Ctrl+ is your friend

Wednesday, August 27, 2008

OpenGL Gear Train Program, Part 2

I've been doing some thinking about this program, and the more I think about it, the more ideas I have. So I am going to write them down and see if some kind of plan falls out.
  • Add teeth to belt. Suppose I could start with just adding thickness, but teeth would be cool. It will take some doing though. First of all, the distance center-to-center of the cog wheels, the diameter of the cog wheels, the length of the belt and the pitch (distance from one tooth to the next) are all going to have to agree. If they don't, the belt will slip and your airplane will fall out of the sky. Secondly, I will have to generate several versions of the belt image. The belt will be moving and it has portions in linear motion and in rotary motion. So I will need to generate enough images to provide the illusion of smooth motion at the slowest speed. I expect that I will need about a dozen. In case the operating parameters of this program change it should be written so that new images can be generated on the fly without major modifications. If I follow the model already in use, this should not be a problem. The last bit will be synchronizing the belt position with the cog wheels, i.e. matching their phases.
  • Make sure that the belt drawing procedure works in any of the three planes, and that it works when the axii are in different planes. The axii must be parallel to each other and to one of the major axii.
  • Change the start up code to the universal OpenGL framework, i.e. remove all the Windows specific coding. Verify that it still works on Windows.
  • Try it on Linux. This means I need to fix the resolution on the Linux box (it's stuck at something like 800 by 600). I had the Dapper Dan version of Ubuntu running and I had good resolution, but it did not have Firefox. I looked into installing Firefox, but the more I looked, the more it looked like upgrading to the current version was a better idea. So I installed Happy Hooper (or whatever it's called, version H in any case) and now I have Firefox, but the resolution sux.
  • Need a better error reporting mechanism. Right now the program uses a mix of asserts, printf's and Windows Message Boxes. Pretty sure Windows message boxes don't work with Linux. Asserts are good for debugging the program, but you shouldn't need them in the final release. Printf's are okay, but they don't go anywhere. I think what I need is a kind of log file that can be viewed in a window. It would show the results of reading the gear train configuration file and point out any problems/conflicts it encountered. This would be especially handy when developing a new configuration.
  • Change the way radius is used in the program. Right now it is used to reflect the outside diameter of a gear. It should reflect the pitch diameter. This will change the way numerous calculations are done. Changing this will mean changing all the configuration files as well.
  • Change the way relative position is used for spur gears and axles. Right now it refers to the center of the gear and axle. This may have made it easier to write to the original program, but I think it is going to be more difficult to use when developing a new gear train. Change it to refer to the end surface closest to the origin.
  • Relative position for bevel gears will refer to the position of the pitch circle, and the actual gear will fall where it may.
  • Fix the calculations for the bevel gear teeth to relect our ideal model.
  • Fix the normal calculations for bevel gears so the lighting looks correct.
  • Try some really big gears meshing with small gears and see if it works okay.
Then there all the major additions I want to do:
  • Fixed support frames, to add some realism, like a clock face for a clock.
  • Clock hands, because I need them.
  • Concentric axles, though I don't think anything special has to done. Axles currently ignore each other. Need this for clocks.
  • I was thinking of adding generic floating frames, but I think I will stick with a couple of specific applications: planetary gear sets and differentials.
  • Ring gears. This one should be easy.
  • Ability to lock gears. Not really necessary until you get to floating frames.
  • Adjust the viewpoint so the whole mechanism is centered in the window/viewport.
  • Add zoom and pan capability.
  • Add ability to set pitch.
Stuff I forgot in the first pass:
  • Dynamic allocation of data structures.
  • Step by step drawing so you can check on what's going on as it is drawn, rather than trying to figure it out after the fact.
Of course, once you get there, you can add fancy stuff, like on screen configuration. Point and click to add gears or other components. I'm not going to worry about that for right now. And then there is always a Java version to run on the web. And then we can duplicate the Lion's Gate logo. It is pretty cool.

No comments: