Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user eightbitswide ! (Registered 2024-12-24) 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.?
 
... 20 posts hidden. Click here to view all posts....
 
2006-08-22 18:31
tlr

Registered: Sep 2003
Posts: 1790
Reusing knowledge/looking at other peoples solutions before not doing it the same way yourself is the mother of all invention IMO.

Who wants to start understanding how to make paper so they have something to write down their self thought up version of calculus for instance?

I find avoiding looking at other people's code, but still using other people's math a bit inconsistent.

Progress is iterative...
2006-08-22 19:26
Shadow
Account closed

Registered: Apr 2002
Posts: 355
Slammer : Thanks, there is that octant mirroring I was going on about. The only drawback is that get a somewhat more complex mirroring since you are not dealing with square blocks anymore.

To chime in on the looking-at-other-peoples-source-debate:
When I started in the eighties, it was just about the only way to find out how stuff was done (atleast for me a fourteen year old kid not smart enough to come up with the VIC-timing stuff by myself :)). It was considered a bit "lame" though as I recall it, but I think almost all coders did it.
2006-08-23 05:12
Style

Registered: Jun 2004
Posts: 498
Ur 411 t3h l4m3!!

1 2u1+ t3h 5c3N3!!!!!!

:)
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
wil/VCC^CTG
Jammer
SLC
Lead/House Designs
CreaMD/React
Krill/Plush
Quetzal/Chrome
Yogibear/Protovision
Guests online: 97
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 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 X-Mas Demo 2024  (9.5)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (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.05 sec.