| |
Testa Account closed
Registered: Oct 2004 Posts: 197 |
Crunch and Pack algorithms + curve algorithms
hi,
I am looking for good tutorials or books with different Crunch and Pack algorithms....
Iam also looking for a tutorial/ book witch explains how to generate a sinus or cosin table with a ML routine..
oh my god.. i am moving forward.... 6 months i already bought the book: Computer Graphics C version from Donald Hearn and Pauline baker... this is a very good documented book. lots of alogorithms. like circels. eclipse, 2d, 3d vector rotations. Bresenham, linedrawing and lots more..
but no Crunch and Pack algorithmes or methodes and also no sinus or cosin algorithms..
every body a happy summer!
bye Testa
|
|
... 2 posts hidden. Click here to view all posts.... |
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
sin, cos and others: Taylor series |
| |
Testa Account closed
Registered: Oct 2004 Posts: 197 |
okay guys, thanx a lot... you will not believe this, since i take adhd medication i finaly can concentrate a lot better this means i can read and understand all those tutorials a lot better than before.... sometimes when i read my topics from the past i feel a little bit foolish..
but hey i am an open book... my motivation to make a nice quality c64 production increased a lot!..
|
| |
Perplex
Registered: Feb 2009 Posts: 255 |
For sine generation, if you want to do it in 6510 assembler for fun then great. In practice, it's easier to generate a sine table using a high level language with builtin math libraries. If you want to save on space, you can limit the table to the [0,PI/2] interval and expand it to a full [0,2*PI] table using simple mirroring code. To save even more space, let the table contain deltas instead, which usually fit inside a few bits each, depending on the accuracy you need. |
| |
Testa Account closed
Registered: Oct 2004 Posts: 197 |
Perplex:
i see what you mean.. i can generate sine table's with Kickassembler witch uses buildin math fuctions, i can also generate a sine table with Kernal and Basic routines... but it is kind of slow.. now i have a c64 platform sine creator and i am bussy with ripping and analyzing the code.. i want to know what is optimized in this code comparing to the standard kernal/basic routines..
I'am not sure what you mean with 'Deltas'.. but thanx for all the other advice..
|
| |
Cybernator
Registered: Jun 2002 Posts: 154 |
Delta means difference. Instead of storing the actual sine values in the table, you store the difference (delta) from the previous value. Since there are no abrupt jumps in the sine table, these deltas will be small values, thus needing less bits to store. |
| |
Testa Account closed
Registered: Oct 2004 Posts: 197 |
oh yes. i see... thanks a lot..... |
| |
4mat
Registered: May 2010 Posts: 66 |
Dunno if this is any use to you but this is the sine generator I used in my 1k intros. It's not very accurate and I'm sure a proper coder could make it much smaller. :)
lda #$05
sta $63
lda #$1f
sta $61
ldy #$3f
ldx #$00
addsine
inc $61
startsine
lda $63
sta $62
keepsine
lda $61
sta $0400,x
sta $04c0,y
eor #$ff
sta $0480,x
sta $0440,y
inx
dey
bmi nomoresine
dec $62
bpl keepsine
inc $61
dec $63
clc
lda $64
adc $63
asl
sta $64
bcs startsine
bne addsine
nomoresine
|
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
There is some sine/cos wave approximation code at Codebase, submitted by Whiteflame:
http://codebase64.org/doku.php?id=base:generating_approximate_s..
There is also some info on splines in one of the C=Hacking issues:
http://codebase64.org/doku.php?id=magazines:chacking20#quick_qu.. |
| |
doynax Account closed
Registered: Oct 2004 Posts: 212 |
You can also generate a series of sines from the first couple of entries with a little bit of arithmetic.
One of those trigonometric laws they made you use in school said something like:sin u sin v = 1/2 ( cos(u - v) - cos(u + v) )Which means that:F(x + 1) = F(x) * k - F(x - 1) Where:F(x) = sin(x * t)
k = 2 cos t Granted you need a multiplication function with decent precision for this to give reasonable results so I suppose you're probably better off mirroring a table on the C64. |
| |
Testa Account closed
Registered: Oct 2004 Posts: 197 |
okay. this is what i am looking for... thanks for the examples and links......... |
Previous - 1 | 2 - Next |