![]() |
Forum Index : Microcontroller and PC projects : The Great Colour Maximite 2 Octahedron Prize Challenge
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1129 |
That explains the difference! The rules state: Thus, I would argue that only your first iteration is following the rule. All your other iterations are rotating by something different. ![]() The judge may have to wade in here. Visit Vegipete's *Mite Library for cool programs. |
||||
PeteCotton![]() Guru ![]() Joined: 13/08/2020 Location: CanadaPosts: 543 |
Ha ha ![]() ![]() But in all honesty, I do jest, as I am fascinated to see what all of our code ends up looking like. There will be lots to learn! |
||||
LeoNicolas![]() Guru ![]() Joined: 07/10/2020 Location: CanadaPosts: 503 |
vegipete, this makes sense For each interaction, I'm rotating over the previous rotated coordinates. I only have the initial coordinates before starting the rotation process. I guess you are doing the same in your code, this is why we are ending with the polygon in the same position ![]() We need the matherp opinion, he is the judge ![]() Edited 2020-11-12 06:36 by LeoNicolas |
||||
PeteCotton![]() Guru ![]() Joined: 13/08/2020 Location: CanadaPosts: 543 |
Ha. I just realised we're all Canadians. Must be something to do with winter weather keeping us indoors ![]() |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1129 |
Do you guys want my latest number? These last few comments gave me a new hint, which took off almost 300ms! My latest time: 1271 ms. Two notes: 400 MHz Waveshare, Firmware RC14! I see that printing the coordinates at iteration 650 adds about 9 ms. Visit Vegipete's *Mite Library for cool programs. |
||||
PeteCotton![]() Guru ![]() Joined: 13/08/2020 Location: CanadaPosts: 543 |
My latest time: 1271 ms. I see that printing the coordinates at iteration 650 adds about 9 ms. Absolutely brilliant. I store my 650 values in an array and don't print them until the end, if that helps? |
||||
LeoNicolas![]() Guru ![]() Joined: 07/10/2020 Location: CanadaPosts: 503 |
My latest time: 1271 ms. I see that printing the coordinates at iteration 650 adds about 9 ms. Absolutely brilliant. I store my 650 values in an array and don't print them until the end, if that helps? Good idea Pete, let's do it. Amazing vegipete and Pete ![]() I'm enjoying a lot this challenge, it's being very fun. |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1129 |
That would be slower. Printing time is the same. You've added the copying time. All of 0.nothing ms. :-) Visit Vegipete's *Mite Library for cool programs. |
||||
PeteCotton![]() Guru ![]() Joined: 13/08/2020 Location: CanadaPosts: 543 |
That would be slower. Printing time is the same. You've added the copying time. All of 0.nothing ms. :-) Aha. Now it's my turn to play with semantics. I stop the timer after the 720th iteration and then print the 650th numbers. This fulfills the requirements. Print the values after the 650th iteration. Check. Stop the timer after the 720th iteration. Check. |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1129 |
![]() ![]() But in all honesty, I do jest, as I am fascinated to see what all of our code ends up looking like. There will be lots to learn! As I see it, it is NOT an issue of rounding error. These are actually 2 different geometrical transformations. Repeatedly rotating (x,y,z) (x,y,z) ... n times is different than a single rotation of (nx,ny,nz). I must say, I understand transformation matrices and projection much better now than I did few days ago. Thank you for the programming camaraderie! Visit Vegipete's *Mite Library for cool programs. |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1129 |
Print the values after the 650th iteration. Check. Stop the timer after the 720th iteration. Check. Fair point. I agree with your reading. Now I know where to gain almost 9 seconds if I need it. ![]() My code: mode 1,8 cls timer = 0 do bunch of wild and crazy math, draw some triangles print timer end Total, 149 lines, including comments. Visit Vegipete's *Mite Library for cool programs. |
||||
LeoNicolas![]() Guru ![]() Joined: 07/10/2020 Location: CanadaPosts: 503 |
I agree, I'm learning a lot with you guys and with this challenge, thank you. I guess we need to start counting the time from the first line. All my variables declaration, options and the CLS are included in my time. |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3350 |
![]() I've been enjoying this all-Canadian show for days now. Usually forum traffic is pretty light in the Canadian evening. Lance (married to a Canadian, permanent resident in the Atlantic bubble--south shore Nova Scotia). (Honoring Remembrance Day) PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
LeoNicolas![]() Guru ![]() Joined: 07/10/2020 Location: CanadaPosts: 503 |
Thank you lizby ![]() This is my best time until now: 1179.94 ms Adjusted time (x 1.18): 1392.32 ms Firmware RC17 480MHz CMM2 ![]() |
||||
LeoNicolas![]() Guru ![]() Joined: 07/10/2020 Location: CanadaPosts: 503 |
Ok, I believe this will be my final version, I cannot see any new optimization, the code is very small, 64 lines only. Total time: 1086.82 ms Adjusted time (x 1.18): 1282.44 ms Firmware RC17 480MHz CMM2 ![]() |
||||
PeteCotton![]() Guru ![]() Joined: 13/08/2020 Location: CanadaPosts: 543 |
I must say, I understand transformation matrices and projection much better now than I did few days ago. Thank you for the programming camaraderie! Yes. Thank you guys as well. This sort of thing really has me re-living the "fun" aspect of programming from my youth. I've been enjoying this all-Canadian show for days now. Usually forum traffic is pretty light in the Canadian evening. We had our first big dump of snow last week (Calgary area). It certainly makes it conducive to staying indoors and playing with the CMM2. Total time: 1086.82 ms Adjusted time (x 1.18): 1282.44 ms Fantastic. I cannot get mine below 1287ms (1518ms adjusted). I can't see any further optimisation I can do. (480mhz). Mines is 147 lines of code, but I could probably get it down to 100 by removing comments and stacking lines. My actual loop only has 20 lines of code in it. That's 99% of my time, and I'm not sure what else I can do to refine it. Edited 2020-11-13 03:05 by PeteCotton |
||||
PeteCotton![]() Guru ![]() Joined: 13/08/2020 Location: CanadaPosts: 543 |
What is interesting is that the latest update null-and-voided a huge performance boost I had made (which is a good thing - it's a testament as to how much of a speed boost we got from the last update). I pre-calculate which sides are opposite each other. This is a generic pre-calculation which will work on any 3D primitive with 6 or more sides. It's pretty common technique in games for objects like walls and boxes. But doesn't increase or decrease the speed of more complex objects. Anyway, on each run this would save me calculating the cross product for sides where I had already rendered the opposite side (as it is impossible for both sides to be visible at the same time). This check kicked in 1280 times each run (saving me a tonne of calculations). However, now the calcs are so fast, that it's hardly making any difference at all (it only helps with the surface removal calcs, not the rotation calcs). I'm going to leave it in the code though as it may be of interest to others. |
||||
LeoNicolas![]() Guru ![]() Joined: 07/10/2020 Location: CanadaPosts: 503 |
Pete Probably you can improve your time using matrix math operations instead of using basic to perform calculations. With exception of the projection, I'm performing all operations using matrix math. For rotation, I changed the loop to rotate each vertice to pure matrix multiplication. I'm performing 3 multiplications, one per axis. I'll try to figure out a way to rotate the 3 axis with only one matrix multiplication. If I'm able to do it, I can reduce my time. |
||||
PeteCotton![]() Guru ![]() Joined: 13/08/2020 Location: CanadaPosts: 543 |
Probably you can improve your time using matrix math operations instead of using basic to perform calculations. With exception of the projection, I'm performing all operations using matrix math. For rotation, I changed the loop to rotate each vertice to pure matrix multiplication. I'm performing 3 multiplications, one per axis. I'll try to figure out a way to rotate the 3 axis with only one matrix multiplication. If I'm able to do it, I can reduce my time. Thanks. I have been calculating the matrix long hand. I didn't realise there was a built in matrix operation until you just mentioned it. Well, that's not 100% true. I read through the manual before and saw it, but in my old age I'm forgetting lots of things! I'll try it out this evening when I finish work. Edited 2020-11-13 05:48 by PeteCotton |
||||
mkopack73 Senior Member ![]() Joined: 03/07/2020 Location: United StatesPosts: 261 |
Obviously I'm not the judge, but if you consider the rationale behind this challenge, the desire to provide an API for doing generic 3D graphics, then it really should be doing the rotation based on the initial state, not off the previous iteration. That's how 3D systems typically work. |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |