Sunday, April 23, 2006

Program Update


I expect anyone reading this is getting tired of me talking about my program all the time, but it's nearly finished now. And it can do 4 planets now. And colours. And Is accurate. And stuff.
I should probably mention that to do the graphics, I'm using a program called GrWin, which has a website here: http://spdg1.sci.shizuoka.ac.jp/grwinlib/english/. It's very, very useful for vector graphics, and I'd have been lost without it. Also, it's free. Kudos to the programmers who wrote it.
What I've done since I posted last night is move almost everything in function main into other functions. That separated the data from the process, and allowed me to add the other planets without having to rewrite everything. What I mean is that the procses was then generalised, and would accept any data fed into it, not just Earth[X_POS], or whatever.
That's another thing I changed. Instead of having separate variables for x and y coordinates etc, I created 1 array per planet to contain everything. That meant I only needed one parameter for my functions, not 5 or 6.
The last thing I did was the coloured trails. Previously, I had only a single colour. However, this had the disadvantage that once the planet had orbited once, you couldn't tell where it was. So I had to expand the arrays to store the last 2 positions, and then draw over them with the new colour.


0 Comments:

Post a Comment

<< Home