i have decided to make this page a place where i can dump some tips and insights i have found during my work.
some of them are quick book grabs :)
btw,
if you "doubt" the problems, just take a look at this screenshot.
it's supposed to continue to get brighter (duh), but it clamps.
precision clamping problems in action! this can't be fixed though ;/
if you don't have to
use float, then dont!!!
use int, and often you
don't even need that much storage, 32 bits isnt' a lot these days, but
still.
for the network layer
it is..
use short if you can.
and geting episilon might
take a few tries,... so do your self a favor and check out other people's
source code.
moller has a good source
code example of collision up at his site, david eberly, and ditto with
goutshalk's.
they all have good numerical
stuff at there sites. goutshalk wrote an awsome thesis on collision detecion
and his seperate axis
theorem.
pretty common sense,
but i bet you didn't think of that /implement ;)
btw, i spelled goutshalks'
name wrong, just do a search on google for obb and unc and it will pop
his site up...
Most texts, when discussing
floating point comparisons, stop immediately after discussing the problem
with
floating point equality,
assuming that other forms of comparison are perfectly okay with floating
point numbers.
This isn't true!
If we are assuming that
x=y if x is within y±error, then a simple bitwise comparison
of x and y will claim
that x<y if y is greater than x but less than y+error. However, in such
a case x should really
be treated as equal to y, not less than y. Therefore, we must always compare
two floating point numbers
using ranges, regardless of the actual comparison we want to perform.
Trying to compare two
floating point numbers directly can lead to an error. To compare two floating
point numbers,
x and y, against one
another, you should use one of the following forms:
= if abs(x-y)
<= error then ...
<> (!=) if
abs(x-y) > error then ...
< if (x-y)
< error then ...
<= if (x-y)
<= error then ...
> if (x-y) > error
then ...
>= if (x-y) >=
error then ...
You must exercise care
when choosing the value for error. This should be a value slightly greater
than
the largest amount of
error which will creep into your computations. The exact value will depend
upon
the particular floating
point format you use, but more on that a little later.
blah.
index