Physics - Kinematics code

This is a program that Alfred Differ and myself are working on

If you have a java enabled browser you should see the program here.

This is not a true simulation, just a simple sequence without physics simulation yet.

here is the source code

Long Term


Design decisions

Phase 1


Design decisions

Renderer Issues

Types of renderer:

  pros cons
real time, OpenGL or DirectX
  • suitable for realtime
  • medium quality
  • Cannot be called directly from Java (requires wrapper program)
  • Quite low level
photorealistic, raytracing high quality too slow for realtime
draw in 2d window to represent a view in x,y or z direction (orthographic parallel projection) Can put directly in java applet without plugin non realistic line representation.
script VRML or game builder program would allow programming at a higher level. tied to the program or standard concerned, not sure if its flexible enough?

I think OpenGL might be the best option, but it can't be called directly from Java, therefore it would be good to have a general interface which would allow different types of renderers:

The boxes in the above diagram represent the following:

Physical Model

This holds full information about the world in a way that allows objects motion and interaction to be calculated. It has information about the whole volume occupied by each object, so it can calculate when the boundaries of objects are in contact and also the internal mass distribution which effects the way objects move.

Surface generator and smoother

If the physical model in made up of cubes then additional smoothing will be required to stop the output looking like its made from Lego bricks. We may also want mesh reduction to reduce the size of the data.

Texture or colour generator

Converts the material information into data about what the surface looks like. We may have a JPEG image of what the surface looks like or just colour information. Also information about how the material reflects, refracts, absorbs, scatters, or generates light.

Physical model to render converter

The renderer requires only surface information about the objects and this information needs to be in a form that can be used by renderers. Most renderers require surfaces to be made up of flat faces (polygons) usually triangle or quads, defined by 3 or 4 vertexes. Normals are used to smooth out the appearance of these flat faces and there is also optional texture and colour information. Some renderes also support an option of using NURBS which allow shapes to be defined by mathematical functions which are driven by control points.

This also converts from Monad to vector and matrix representation of vertexes, normals and transforms.

Java3D or other wrapper for OpenGL

Java3D is a Sun extension to their Java software. It is an additional free download (it does not come with the Java SDK or runtime) it also requires the latest java 2 version of the runtime. Therefore it wont work in most browsers until both of these have been downloaded and installed, I think most web browsers would not be willing to do 2 big downloads just to see a webpage with a Java applet. Some people would be willing to do this for our full application but it can be a messey process.

Java3D has a much higher level interface than OpenGL, it stores its information in a scenegraph which makes it very good for our application. However Sun seem to be loosing interest in developing this and so they may not be doing many enhancements to this in the future.

There seems to be a move to lighter weight wrappers for OpenGL such as the JOGL project on JavaGaming.

Sun announced an agreement with SGI to cooperate on developing Java bindings to the OpenGL API (spec here), I think this is about putting 3D on mobiles?


Such as POVRay, not sure if Java is supported or suitable for this type of application?


Implementation Issues

If we don't need to interact with the program then we can divide up into 3 separate programs.

If we need to interact with the simulation as it is happening then, we need to put this all in one program.

This looks a lot more messy as we either have to:

  1. generate the full render tree seperately for every frame in the animation, (very slow).
  2. or, keep both trees and cross link them so they are kept uptodate.

The second case is much faster as we only have to change the transform at each frame.

metadata block
see also:


Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.


cover Engineering Mechanics - Includes Statics book and dynamics book below..

cover Engineering Mechanics Vol 2: Dynamics - Gives theory for rigid dynamics, aims to allow prediction of effects of force and motion. Includes rotating frame of reference. Lots of colour diagrams, I guess its college / University level.

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to the software project, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.


This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2015 Martin John Baker - All rights reserved - privacy policy.