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.?
 
... 13 posts hidden. Click here to view all posts....
 
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: 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
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: 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...
2006-08-22 08:04
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.
2006-08-22 08:06
Jetboy

Registered: Jul 2006
Posts: 337
with what?
2006-08-22 08:08
JackAsser

Registered: Jun 2002
Posts: 2014
For instance insane multiplexers, maximzing the number of $d020 splits... FLDs, FPPs, sprite stretching etc. etc. I really doubt the best VIC-coders back then ripped code and only applied trial and error etc. They created their own theories and models imo. Brainers usually does that, where as lamers don't.
2006-08-22 09:30
Style

Registered: Jun 2004
Posts: 498
only teh lam0rxz rip!

Im a shit coder, but at least everything Ive written is mine alone.
2006-08-22 09:32
Oswald

Registered: Apr 2002
Posts: 5094
Jack, I think they looked at the vic as a black box, if I do this then this will come out and so on. they barely could have ideas of inner counters and stuff.

fpp fld etc.. you dont need to have much idea about it. its enough to know the sequence of the numbers to write to d011 and the right cycle. Again, it can work like a black box without deeper vic knowledge.


IMHO :)
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
Honesty/Covenant/Ons..
Andy/AEG
MaD ][/Starship
Alakran_64
Korodny
TBC
Guests online: 116
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 The Demo Coder  (9.6)
6 Edge of Disgrace  (9.6)
7 What Is The Matrix 2  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Mutetus  (9.7)
3 Jeroen Tel  (9.7)
4 Linus  (9.6)
5 Stinsen  (9.6)

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