URL:
<http://gna.org/bugs/?8376>
Summary: CPU time of Ground::Tangeante
Project: Wormux
Submitted by: jasper
Submitted on: Saturday 01/27/2007 at 06:38
Hidden: None
Category: Physics
Severity: 3 - Normal
Priority: 5 - Normal
Status: None
Assigned to: None
Originator Email:
Open/Closed: Open
Release: -
Discussion Lock: Any
_______________________________________________________
Details:
While starting to try to understand the code with robo210 i noticed that the
function Ground::Tangeante does could be done in less cpu time table by using
a lookup table for the limited amount of possibilities:
double tangeante = atan((double)(p4.y-p3.y)/(double)(p4.x-p3.x));
Has _relative_ values, meaning that x,y as arguments of Ground::Tangeante
dont actually seem to matter much in this specific function. Combine this
with the fact that Ground::PointContigu returns for p_x,p_y only in the set
{x-1,x,x+1} and {y-1,y,y+1} and you can see that the posible results for
tangeante is very limited indeed.
So the suggestion is to find the possibilities and use lookup tables. We
could also just look at the 8 tiles around the one the particle is at, and
base the normal on that, via a lookup array of normals of size 2^8=256.
Also, is it a good idea to not give the normal with a angle, but with a
vector? (can table that too) Noting it as a angle means you have to convert
it back. The bouncing and (slide)friction can be done with vectors aswel.
I am also thinking of a wholy different method of making colision maps, just
noting a colision normal for each tile. If i have success ill come back to
that. (but am seeing some obstacles for this method, though.)
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?8376>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Wormux-gna mailing list
[email protected]
https://mail.gna.org/listinfo/wormux-gna