![]() |
|
#1
|
|||
|
|||
Crazy mathCPP / C++ / C Code:
Has anyone ever see anything like this. How would you talk about these things? ![]() Last edited by admin : 12-Nov-2007 at 05:26.
Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
|
|
#2
|
|||
|
|||
Re: Crazy mathQuote:
There's a bug here: When the modulus is equal to 100 (before the next space resets it to one) the display shows n = 10, since there isn't enough room to hold the string that would print "n = 100" Easily fixed by changing '7' to '8' in the two statements. Other than that, what would you like to say about it? (And, by the way, there is a brand new OpenGL Programming section on gidforums; you might post there next time, not on the C++ forum.) Regards, Dave Last edited by davekw7x : 11-Nov-2007 at 22:07.
|
|
#3
|
|||
|
|||
Re: Crazy mathThanks for the bug fix
I was hoping a mathematician would come across it. I don't know what you can say about it. I noticed that certain 'classes' of patterns happen in sequences, like every 4 then 8 then 4 etc in hammings, a 'crosshair' appears and things like that. I was just wondering, if I was going to write about it, even it just being an article in a blog or something, how to approach the discussion. Cheers |
|
#4
|
|||
|
|||
Re: Crazy mathQuote:
Regards, Dave |
|
#5
|
||||
|
||||
Re: Crazy mathMoved thread to OpenGL forum.
__________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
|
#6
|
|||
|
|||
Re: Crazy mathQuote:
First of all, are you assuming that any old mathematician will look at your OpenGL code and know at a glance what it is doing? Well, it could happen, but I think it's not such a good idea to assume that. In other words, describe what you are try to accomplish with the program. Before inviting someone to make comments on patterns displayed by the program, perhaps you could give a brief overview of what is being displayed (what is being projected and with what properties)? What is the difference between the "hammings" display and the "non-hammings" display? Stuff like that. Now, from the programming point of view: 1. Why the hokey and wasteful "subtracting-and-adding-back-on" stuff in the "modulo" function? Since, presumably, modulus is always a positive integer, couldn't you just do something like the following? (And: if not, why not?) CPP / C++ / C Code:
2. If you are going to show your program to people who may not want to get out their OpenGL reference manual, maybe you could explain exactly the purpose and functionality (the effect) of the LightXxxx and color stuff thingies in InitGL(). 3. To emphasize the program's implementation of the functionality that you have already described, maybe explain exactly what happens in the program as the "modulus" gets incremented from 1 to 100? (And what difference the value of flag makes.) 4. You have a printed comment that Code:
In case you haven't explained it in your overview, maybe you can comment on what the heck primes have to do with it. What the heck does MMOD(whatever,(0..whatever-1) mean. Stuff like that. Regards, Dave |
|
#7
|
|||
|
|||
Re: Crazy mathLOL, yes I did write a very bad modulo. I didn't think much about the code. I was just knocking it off so I could see what I'd been trying to see in my head all day.
The initiation function just creates a light, enable smooth shading and reflective materials. I forget what normalize does, I haven't coded glut in donkies. Sorry, I didn't realise I was being so esoteric. MMOD is where you mod the answers to times tables. Primes I'm sure know, and hammings are (2,4,6...) union (3,6,9...) union (5,10,15...). So, you can imagine my excitement to see such a complicated pattern emerge from such simple concepts. As you increment n, the size of the domain increases, as does the modulus and the camera zooms out. It resets at 100. The reasoning behind it was that I was attempting to find arithmetic functions that naturally produce given patterns; sudoku I was hoping for. I cames across MMOD while reading about irrigation in acient rome. They used the pattern from MMOD(5,0..4) to do crop roations. It just so happened that this pattern fitted soduko. So I was trying to see if MMOD(9,0.. Hope that clears everything up. |
|
#8
|
|||
|
|||
Re: Crazy mathQuote:
I didn't mean for you to describe everything to me; those were suggestions for thinking about what you might put in the blog or whatever... Just off of the top of my head... Regards, Dave |
|
#9
|
|||
|
|||
Re: Crazy mathThanks buddy for the information you have posted ..... It had really helped me a lot.......... and specially that codes for c++
|
Recent GIDBlog
Last Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C++ math problem | Vordican | C++ Forum | 5 | 02-Oct-2007 12:25 |
| Math problem: Total Noob | Targsmom | C Programming Language | 3 | 20-Oct-2006 05:05 |
| C++ Help with math | alex18 | C++ Forum | 12 | 25-Sep-2006 11:24 |
| Beginning C++ math prog | Dariklar | C++ Forum | 6 | 10-Sep-2003 11:51 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The