adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] New physics engine for 0.4, test 2


From: Kenneth Gangstoe
Subject: Re: [Adonthell-devel] New physics engine for 0.4, test 2
Date: Tue, 1 Oct 2002 09:40:14 +0200
User-agent: Mutt/1.3.28i

Quoting Alexandre Courbot (address@hidden):
> > Here's another one:
> > 
> > Traceback (most recent call last):
> >   File "test_intersec2.py", line 467, in ?
> >     realv = obj1.intersect(obj2, v)
> >   File "test_intersec2.py", line 336, in intersect
> >     r = l1.segments_intersect(l2)
> >   File "test_intersec2.py", line 176, in segments_intersect
> >     r = (Ty * (D.x - C.x) - Tx * (D.y - C.y)) * denom
> > OverflowError: integer multiplication
> 
> Doh! This is bad. I'm using large shifts to gain precision during the
> line intersection algorithm, but it look like I'm shifting too much and
> it sometimes overflow. Well, I'll reduce the shift and hope the
> precision will still be good. Floats have this advantage that precision
> is always very good, but I'd like to avoid using them as much as
> possible.
> 
> Anyway, this is nothing more than a pre-version! ^_^'

Is there a special reason you don't want to use floats? In modern CPUs
floats just take a cycle to calculate, actually in some cases floats can
be faster than ints. (Or so I have heard :)

- Kenneth




reply via email to

[Prev in Thread] Current Thread [Next in Thread]