Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Creating angle/radius tables
2006-08-21 07:34
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.?
2006-08-21 07:42
Krill

Registered: Apr 2002
Posts: 2852
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.
2006-08-21 07:49
Style

Registered: Jun 2004
Posts: 498
dont be lame, calc them on the fly!

:D
2006-08-21 08:41
Oswald

Registered: Apr 2002
Posts: 5023
use basic :D
2006-08-21 21:17
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.
2006-08-22 06:09
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!
2006-08-22 06:40
Oswald

Registered: Apr 2002
Posts: 5023
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
2006-08-22 06:45
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 :)
2006-08-22 08:02
Jetboy

Registered: Jul 2006
Posts: 221
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...
2006-08-22 08:04
JackAsser

Registered: Jun 2002
Posts: 1989
The early 80's was experimenting, the late 80's knew what they where doing with the HW imo.
2006-08-22 08:06
Jetboy

Registered: Jul 2006
Posts: 221
with what?
 
... 13 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Dr.Science/Atlantis
Viti/Hokuto Force
MightyAxle
Mibri/ATL^MSL^PRX
Airwolf/F4CG
kbs/Pht/Lxt
Guests online: 95
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.067 sec.