# Cocalus

Member

511

554 Good

• Rank
1. ## Best algorith for finding shortest path between say 2 cities

He's looking for a all pair shortest path algorithm. Floyd-Warshall should work.
2. ## Make arbitrary geo face the camera

Check This thread Opps that might not be exactly what your looking for. I didn't read through it completely when I found it[/edit]
3. ## rotate a face normal?

*cut* This link might help a bit. I forgot something important in my original post[/edit]
4. ## help with my homework

Given this is homework I'm going to give you (hopefully helpful) vague answers. Removing and storing the sequence should be fairly straight forward if your know how to work with arrays. As for finding the sequence, try writing out an example sequence and solving it by hand. Then try to convert the method you used into code. If methods not convertible think about how you would solve a very long example (remember you can write stuff down in the process of solving the problem).
5. ## Are Pro Coders Uber Demi Gods?

Quote:Original post by luke2 I understand pointers perfectly! (ProCoder, point out my ignorance/arrogance please) Since you asked Note: Of those the smart pointers are the really useful ones (the others are specfic to c/c++, and don't come up that often). If you're already aware of those examples I'm sure I can dig up some more. Although the article you were reading was most likely just talking about basic pointers. Pointers (and recursion among other things) can be hard for beginers (CS101 will be the first programming class for many people). Because pointers don't fit into that persons mental model of how the computer works. So to learn pointers they have to reshape their model so that it includes pointers. More expereinced programmers will have a lot of programming models they can switch between (You don't need pointers or even loops for an effective programming model). The best way IMHO to pick up new models is to learn different programming langagues. And I mean really different (Java and C# aren't that different from C++ in this case) langauges like lisp/scheme, haskell, python, ruby, smalltalk, assembly, etc... Remember there will always be more to learn.
6. ## Minimal containing sphere for a set of spheres?

You've probably already found is but I found this on google it says that the second algorithm can be adapted to spheres. Hope that helps.
7. ## a random c pointer question

The post increment operator increases the varible by one and returns the previous value. Basically the same as int post_increment(int &x){ int temp = x; x = x+1; return temp; } This is why some people say to use ++i instead of i++ since the former doesn't need to make a temporary. Any decent compiler can see that optimization (at least with primtives). Although it can make a difference on complicated classes (some smart pointers for instance).
8. ## using the video card

Given any semi recent, not complete trash video card, transformation and Lighting will be done on the video card (I think the nVidia drivers may do some work on the CPU if they think there is a performance advantage). I'm fairly sure that the model matrix multiplication is included in Transformation and Lighting. Or in other words it's done on the card. Now as for way your program is slow is because glVertex3f is a slow way to send geometry to the video card (As Endar said). Since each vertex requires a function call. There are two ways (that I can think of) to efficiently send geometry in large chunks, display lists and vertex arrays. Display lists are typically used for static geometry (they have some other uses). They can be setup with the glVertex3f syntax. Vertex Arrays allow you send arrays of vertexes and other per vertex values. So 1 function call for 10,000 vertexes, instead of 10,000 glVertex3f calls. VBOs allow you store the vertex arrays on the video card's memory. I think display lists are also stored on board the card. All of the above have been standard for a quite a while and are no longer extensions. Although to use some of them may require going through the extension system (thanks Microsoft...). Glee or Glew will make using the extension system much easier.
9. ## Anyone having issues with Dual Core CPUs and timers?

Quote:Original post by DaBookshah Quote:Original post by hplus0603 .....RDTSC is discouraged.... Why? If I remember right because multicore cpus have different timers that may not be in sync (basically the main cause of the problems mentioned in this thread). Also if the cpu throttles speed(I think they are all capable of it now days), then you times no longer match reality. For instance SW:KtoR, would play at a different speed on my laptop if I unplugged the power (which throttle the cpu to 600 from 100 MHz) while playing. I think the only good use of rdtsc is to measure the number of cycles a piece of code uses. Assuming you set the affinity and took the minimum cycles of numerous test to help remove problems from windows changing the threads. Also x64 installs (A least I think mine did) with /usepmtimer in the boot.ini so it's not supposed to use rdtsc for QPC. That option may have been enabled by a patch too (I didn't see it until my system was fully patched up).
10. ## Dodgy use of IT in the workplace (partial rant)

Have you tried raising the refresh rate of your crt monitor (60Hz is too low and the default). From my experience raising the refresh rate to 85Hz helps greatly with eye strain. If your unaware of the process, on XP (It's been many years since I last used an NT system, it's probaby close enough) right click on the desktop goto properties->settings->Advanced->Monitor->Screen Refresh Rate and raise it up to the max hit apply, and if it doesn't work it'll reset itself in about 10 seconds, then try the next lowest setting. Keep doing that until it works. You may need to lower the resolution to use higher refresh rates. 85Hz is much nicer, 72Hz should make a notible difference on eye strain.
11. ## Comparing pointer addresses to check object identity.

I think you want to change if ( &alreadydamagedlist == &objectbeingchecked) to if ( alreadydamagedlist == &objectbeingchecked) assuming I'm reading your description right alreadydamagedlist is a pointer to an object so &alreadydamagedlist is a pointer to where that pointer is stored (so it returns a pointer to a pointer to an object)
12. ## [C++] Fast Power of 2 Test

I didn't realize that the problems with ++a + ++a, applied with a single ++ operator. Makes sense now that I think about it though.
13. ## [C++] Fast Power of 2 Test

Quote:Original post by Null and Void Quote:Original post by Anonymous Poster int a; !(a & (--a)) && a; Do not do it like this, it enters into undefined evaluation order territory. Nicksterdomus's method is fine though. While it should be !(a & (a-1)) && a (since the AP's doesn't work) I don't see the undefined evaulation order. I looks like it's properly defined as a1=a-1 a2=a1&a1 //Why the AP's version doesn't work a3=!a2 answer = a3 && a1