RE: [Algorithms] floats, doubles, epsilons, joy
Brought to you by:
vexxed72
From: Steve W. <Ste...@im...> - 2000-08-31 19:45:09
|
> -----Original Message----- > From: Jason Zisk [mailto:zi...@n-...] > > I've been working on some collision stuff lately and I keep > running into problems with floating point inaccuracies. > Specifically if the player is standing on top of a triangle, > the distance should be zero, > If it was zero then the bottom of the player and the top of the triangle would occupy the same space...not what I would expect to happen. Maybe if you always keep objects a set distance away...like maybe .01 and still use an epsilon like .00001 then objects at rest won't be triggering a collision detection. > > is doing floating point math with doubles much slower or > have other unwanted side effects? > I believe they take just as long if the code is running on a 64bit data bus with a 64bit floating point unit. The only side effect is when converting types which will throw some variance in results...but your epsilon should solve that. Rockn-Roll |