main-trainframework

CS559 Train Project - Framework Code

written October 2008, by Mike Gleicher
updated October 2010, by Mike Gleicher

This provides a framework for the CS559 Train Project (described here). It is a simple systemthat provides all of the basic features so that students can add theirown train and other features. The user interface for this project is described at TrainUI.

This code also serves as the basis for the example solution. When themacro “EXAMPLE_SOLUTION” is defined, a few extra files areincluded. These files are not provided to the students.

The source code for the framework is available inpub:train/TrainProject2010_Oct07.zip. Note that the version date is in the file name. If newer versions are released they will be announced.

The executable for the framework is Train.exe. This is what you should get if you build the code.The example solution is available as TrainExample2010.

We strongly recommend that you start by playing with the examplesolution to get an idea of what the assignment is about.

Getting things to compile

The visual studio project is set up to use the FLTKHOME environment variable. Before running visual studio, make sure that this variable points to the root of your FLTK installation.

Files

Most of the files are in the “TrainFiles” directory. A few utilityfiles are in the “Utilities” directory that muse be placed in the samedirectory as the TrainFiles directory. (the zip file should get thisright)

There is a “TrackFiles” directory inside of the TrainFiles directorythat contains sample track layouts.

Getting Started and Learning your way Around

First, run the example solution and try it out. Look at theReadMe-UI.txt file for help in using it.

Then open up the solution and have a look. If you search for “TODO:“you will see places in the code that we expect you to want to add yourown things.

You don’t need to understand everything - you can do the entireassignment just by adding things where we day “TODO”. In fact, you cansee all of the places where the Example Solution (which is relativelycomplete) had to add things to the code.

Some Hints:

  • If you want to add widgets to the control panel, add them inTrainWindow.H first, then add them in TrainWindow’s constructor.(there are TODO).
  • You probably want to give your widget a callback. If it just changesthe state, the damageCB is a good option (it forces a redraw).
  • The control points keep an extra 3 variables for an orientation. Youmight only want the position of the control points. But notice whatthe example solution does with them. The code tries to keep theorientations normalized.
  • The world is set with Y going up (so the groundplane is XZ) and theground has size 100x100 (to give you some scale).
  • Change as little of the framework as possible. You can see exactlywhere the ExampleSolution connects to the framework.
  • The ExampleSolution tries to keep the files separate from theframework (so we can keep it from the students). So most things arefunction calls (or in the case of the extra widgets in TrainWindow,a class). But you can put things right into the framework.

Known issues (this list will probably grow…)

  • There is no checking for points that co-incident. If you put 4 points on top of one another, a spline segment will collapse to a point. This probably should be prohibited by the UI, but right now it will probably cause my arc-length code (in the example solution) to do bad things.
  • Up vectors are intrpolated in a simple way. (I guess this is actually the example solution) - but some checking in the UI could be done to avoid having the up-vectors (the orientations of the control point) do bad things.
Page last modified on October 07, 2010, at 05:15 PM