| |
Shadow Account closed
Registered: Apr 2002 Posts: 355 |
Creating angle/radius tables
Is there a size-optimized way of getting a angle and radius table? It's easy enough to just precalc like this (pseudocode):
for(int x=0;x<w;x++)
{
for(int y=0;y<h;y++)
{
radius[tab]=sqrt((x-w/2)*(x-w/2)+(y-h/2)*(y-h/2));
angle[tab]=atan2(y-h/2,x-w/2)/PI);
tab++;
}
}
But what if you don't want to have the whole table precalced due to size concerns? Can you save space with some smart mirrortricks, etc.? |
|
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Have a look at the source code of this:
Artefacts
(i.e., mainly math.s in the source directory),
for some ideas on how to have radius and angle tables the size-optimized way. |
| |
Style
Registered: Jun 2004 Posts: 498 |
dont be lame, calc them on the fly!
:D
|
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
use basic :D |
| |
Shadow Account closed
Registered: Apr 2002 Posts: 355 |
Thanks Krill, didn't remember that you had released the source to that amazing 4k, I will have to study that sometime!
Anyway, I sat down and thought it through some more, and the simple thing to do is to just do a mirror/flip with the four quadrants, thus only needing 1/4 of the table precalced, which saves enough space for now.
Perhaps it would be possible to get by with only one octant precalced, but I'm not going to pursue that right now.
|
| |
Style
Registered: Jun 2004 Posts: 498 |
Quote: Thanks Krill, didn't remember that you had released the source to that amazing 4k, I will have to study that sometime!
Anyway, I sat down and thought it through some more, and the simple thing to do is to just do a mirror/flip with the four quadrants, thus only needing 1/4 of the table precalced, which saves enough space for now.
Perhaps it would be possible to get by with only one octant precalced, but I'm not going to pursue that right now.
Never study other people's source - it spoils the fun!
|
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
lol, style, u wrong.
DO STUDY other ppl code, then you know if you can do it better, and u dont have to reinvent the wheel:)
edit: I really wonder how much time would it took for one single man to reinvent everything since 82 :D |
| |
Style
Registered: Jun 2004 Posts: 498 |
Ive never looked at other people's code, except for example routines in assembler books and a couple of routines Quetzal sent me once to explain how he did something (VSP from memory).
I like talking theory about how stuff works, but to actually look at code seems like cheating to me :)
|
| |
Jetboy
Registered: Jul 2006 Posts: 337 |
Quote: Ive never looked at other people's code, except for example routines in assembler books and a couple of routines Quetzal sent me once to explain how he did something (VSP from memory).
I like talking theory about how stuff works, but to actually look at code seems like cheating to me :)
O_O
Theory?
Do you think there were ANY theories avaliable back in the 80's?
The only theory you could get then was from examining other people's code.
Bah! Spoiled childs of the internet... |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
The early 80's was experimenting, the late 80's knew what they where doing with the HW imo. |
| |
Jetboy
Registered: Jul 2006 Posts: 337 |
with what? |
... 13 posts hidden. Click here to view all posts.... |
Previous - 1 | 2 | 3 - Next |