Tutorial: Development tips and tricks

[Note: Go here for Assignment 2.] In this post I want to collect some miscellaneous tips and tricks related to the nitty-gritty of our programming environment for this course.  Please feel free to post other related helpful hints as comments to this post! I’ll be adding entries throughout the semester so it might be good to bookmark this page. I’ll add new entries at the top.

  1. Animating a scene graph.  For best results, re-use SceneGraphComponents and geometry factories.  For example, if only the geometry is animated, you can simply call the factory.set…() methods you need, then call update().  The geometry will be changed and the scene graph re-rendered without further work.
  2. html on-line documentation: Please try to reduce the size of your html folders in the SVN repository.  Large files make the update process with SVN slow and unreliable.  Please try to keep the total under 1MByte per team.
  3. Using the computers in MA 316: Our first Thursday in this lab, it was difficult to login successfully to these machines.  I’ve found out the problem. To use these computers, you have to select a session type on the pull-down menu below the login field. KD3 or Gnome are common choices, if you don’t already have a favorite (apparently KD4 is not available, which is the source of the problem); if you’re just going to be running eclipse, it shouldn’t matter much which you choose as long as you can get a shell/terminal.  FYI, here are the directions again  for getting the correct eclipse version on these machines.  Execute in a shell:
    1. ln -s /net/MathVis/eclipse64-subversive/eclipse eclipse
    2. ./eclipse
  4. If your Java process runs out of heap space:   You can direct the Java Virtual Machine to allocate more space when it starts up. To allocate 2 GByte initially and as final limit use the arguments -Xms2048m -Xmx2048m.
    1. You can set this just for this application in Eclipse using the menu item Run configurations…->Arguments->VM arguments.
    2. Set it globally for all Java VM’s in eclipse using Eclipse->Preferences…->Java->Installed JRE’s->Edit->Default VM Arguments.
  5. Update SVN frequently: Make a habit of updating from the SVN repository after you start up eclipse.  Some files your application depends on may have changed; I try to avoid such changes but sometimes it can’t be helped, and it’s better to adjust to the changes sooner rather than later.
  6. Use the utility class de.jreality.geom.Rn: If you are doing calculations involving points in $E^3$ or vectors in $R^3$, consider using the static methods Rn. It’s not possible to give an exhaustive listing here of these methods, but these include adding, subtracting, cross product, multiplying by a scale, normalizing, finding the norm, distance and angles,  etc.  Many methods also act on arrays of points or vectors (type double[][]). Take a look for yourself. When using homogeneous coordinates or doing projective geometry, consult Pn, in the same package.
  7. When in doubt, consult the tutorial examples: Just because you’re writing your own programs now doesn’t mean you can’t benefit from looking back at the tutorial examples.  In fact, now that you know more what’s going in, it’s probable that you will be more appreciative of some features which previously, in the initial confusion, you didn’t fully understand.  Once more, the principle at work here is: avoid writing your own code wherever possible.  It gives you more time and energy to … write your own code.

Leave a Reply