www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/09/28/19:09:24

Xref: news-dnh.mv.net comp.graphics.algorithms:10815 comp.os.msdos.djgpp:2267
comp.os.msdos.programmer:14191 rec.games.programmer:29488
Path: news-dnh.mv.net!mv!news.sprintlink.net!howland.reston.ans.net!swrinde!cs.utexas.edu!news.cs.utah.edu!news.cc.utah.edu!xmission!inquo!news.seinf.abb.se!nooft.abb.no!Norway.EU.net!nntp-oslo.UNINETT.no!nntp-trd.UNINETT.no!due.unit.no!usenet
From: robert AT idt DOT unit DOT no (Robert Schmidt)
Newsgroups: rec.games.programmer,comp.os.msdos.djgpp,comp.os.msdos.programmer,comp.graphics.algorithms
Subject: Re: Fixed-point Math Library
Date: 28 Sep 1995 15:08:24 GMT
Organization: Norwegian Institute of Technology
Lines: 30
References: <43rf7k$cdj AT freenet3 DOT scri DOT fsu DOT edu>
Nntp-Posting-Host: amnesix.idt.unit.no
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

In article <43rf7k$cdj AT freenet3 DOT scri DOT fsu DOT edu>, joeo AT freenet2 DOT scri DOT fsu DOT edu 
says...
>
>I'm trying to write some very simple 3d stuff for a DOS machine using 
>DJGPP, but the floating point stuff is just WAYYYY too slow on my machine 
>(a 486SX). So I tried using integral math (multiplying all results by 
>10000 or more), but that causes all results to eventually end up at zero 
>due to rounding and precision losses.

It sounds like your are doing repetitive rotations on object coordinates.  
Since the coordinates inevitably get rounded (or truncated) each time, you 
will loose precision and accumulate errors, and all coordinates tend to either 
converge to zero, or diverge to infinity.

Instead of applying the same rotation matrix over and over again, make a new 
one for each frame, with increasing rotation angle, and apply this new matrix 
to the *original* coordinates.  The precision loss will always be "first 
generation", and errors will not accumulate.

This applies as a general rule whether you use floating point, fixed point or 
integers to represent your coordinates.

--
Robert Schmidt - robert AT idt DOT unit DOT no - http://www.idt.unit.no/~robert
        Jeg lukker et oeye
        og ser halvt
        Jeg lukker begge
        og ser alt
              -- Seigmen

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019