http://chiselapp.com/user/badsector/...y/rtworld/home
look in the maths.pas there might be something useful