# Thunder_Hawk

Member

1306

314 Neutral

• Rank
Contributor
1. ## what is the best data structure for this?

Just want to point out that 300 items isn't a heavy load of any kind, so you're unlikely to notice (at a user level) a difference between algorithms unless you use something that is ridiculously inefficient. For fun, check out heap sort...it's often leveraged for this kind of use case.
2. ## (C++) std::string::c_str() truncation issue

The truncation is due to the way that printf works (not std::string). The end of a C-style string is denoted quite literally by a null character. Part of the slowness with your new method is going to be from the at() function which performs bounds checking on the indices. The accessor method (string[index]) method will be certainly faster in this case. Why do you want to see the characters in the file when you have (I assume) binary data? You could eliminate a lot of this hassle if you're just printing out the numeric value of the characters. Another viable option would be to just the <algorithms> copy method to copy each character to the output stream.
3. ## Verlet integration for angular movement using quaternions

Okay, I just did a little research on verlet integration: one of the fundamental assumptions it makes is that the angular acceleration is constant. In other words, it's probably doing the *right* thing by stopping when you suddenly remove the acceleration. If your simulation cannot guarantee a constant angular acceleration, you'll need to switch to a different integration algorithm...such as the Euler integration I suggested previously or something of higher order
4. ## Verlet integration for angular movement using quaternions

I'm not familiar with the concept of vertlet integration, but it's pretty obvious from your code that no direction change will occur if you stop having any torque. It's been a little while since I've studied torque, but I'm pretty sure the equations are almost completely analogous to linear motion... You're going to need another variable in your state to keep track of angular velocity in any event. pseudo-code: angular_acceleration = torque // (I assume the direction_prim*D3DXQUATERNION( angular_torque.x, angular_torque.y, angular_torque.z, 0 )) angular_velocity += angular_acceleration*dt // stored variable direction += angular_velocity*dt
5. ## Putting water pressure into a Java applet game, for realistic play

The code that needs to be written is very much dependant on how the water effect was implemented in the first place. So you're not going to get very far unless you post the relevant information. Also, you appear to be asking the board to simply implement the feature for you without any mention of payment. There are very few who would consider this sort of offer, but many more people are likely to be offended by such a request. So I might suggest that you rephrase yourself such as to ask for help with a specific problem in your implementation, rather than throwing out some sort of "specs" and requesting the answer from the board.
6. ## Calculation of orthogonal vectors!

How much linear algebra/vector math do you know? The first thing you have to realize is that there are infinitely many solutions to this problem since the final 2 vectors can be any 2 perpendicular vectors on the plane that's perpendicular to the source vector. Here's what I've done in the past: 1) Pick two arbitrary perpendicular vectors (say v1 = <1,0,0> and v2 = <0,1,0>) 2) Choose one of these two vectors to work with based on how "close" they are to the input vector: so choose v1 unless abs(v1 dot vin) is approximately equal to 1 (otherwise go with v2) 3) From there it's easy: to produce the first output vector, vout1, just cross the vector you just chose with the input vector and normalize the result (vout1 = (vchoose x vin).normal()) 4) To produce the second output vector, vout2, just cross the input vector with the first output vector and normalize the result (vout2 = (vin x vout1).normal()) 5) Open a can of pop and enjoy Note: You'll probably want to play with the ordering of the cross-products to get the desired "handed-ness" of the final axes (it will be consistent once you figure out what you want).

Quote:Original post by password I sort of know why this kind of error appears but it feels unavoidable because some files just most have the same includes. Shouldn't "#ifndef X_H_ - #define X_H_ - #endif" counter this problem? That won't fix every kind of problem (especially if you have that exact same line in every header). It only prevents redeclaration errors caused by including the same file more than once.
8. ## Make vector inverse proportional

There's not really anything faster that you can do here unless you are willing to settle for a gross approximation. However, its very unlikely that the speed of this calculation will have any noticeable effect on the performance of your application, unless you are doing it many, many, many times per frame.
9. ## 2D Texture Mapping

Quote:Original post by AndyEsser Not sure if it's the same because I program in VB but don't you have to specify the TExture coords you want to map to the quad? eg glBegin bmQuads glNormal3f 1, 0, 0 glTexCoord2f 1, 0: glVertex3f 1, 0.5, -0.5 glTexCoord2f 0, 0: glVertex3f 1, 0.5, -1 glTexCoord2f 0, 1: glVertex3f 1, 0, -1 glTexCoord2f 1, 1: glVertex3f 1, 0, -0.5 glEnd Yes, you are correct...the drawing code should look something like this glBindTexture( GL_TEXTURE_2D, structure->textureid ); glBegin(GL_QUADS); glTexCoord2f (0.0f, 0.0f); glVertex2d(x,y); glTexCoord2f (1.0f, 0.0f); glVertex2d(x+structure->w,y); glTexCoord2f (1.0f, 1.0f); glVertex2d(x+structure->w,y+structure->h); glTexCoord2f (0.0f, 1.0f); glVertex2d(x,y+structure->h); glEnd(); The purpose of glTexCoord* is to tell the graphics card what part of the image maps to which vertex of (in the case) the quad. (0, 0) maps to the bottom left corner of the source image and (1, 1) maps to the top right corner of the source image...any values in between are equally valid inputs Also check to make sure that the dimensions of the picture are powers of two (ex. 64x128, 1024x1024, 512x256, etc.), as OpenGL makes that size requirement. There are ways to get around this, but you should probably get used to the concept of texture coordinates before delving into that topic.
10. ## Staying within a window

Also note that you will probably need to do a similar test for the other two sides of the window (xpos <= 0 and ypos <= 0) if such behaviour isn't already present in your program.
11. ## Intern Salary

One of the forms I'm filling out for a possible game programming internship requires that I fill out a desired salary field. The truth is that I'm more interested in the experience (I've never had such an opportunity previously) than any payment I might earn. Does anyone here have any suggestions as to what I should enter? I checked the referenced GamaSutra articles in the FAQ, and unless I missed something, they don't really apply to my situation. The web form alows for different ways to measure payment (salary, hourly/daily/weekly wage, etc.). Please mention any experience you have had in these matters when making suggestions.
12. ## My webcomic: Red Green Blue

Umm, how can I access rgb or the "fun stuff" portion of the site? Your new navigation setup seems to make this impossible.
13. ## My webcomic: Red Green Blue

LOL, the drawing might suck, but the humor is definitely up to par, and you got the dudes-on-the-couch-playing-games scene across alright. I especially like the increasing irony as the computer fights a stable connection. I'm a little confused on the one about being player 2, is that a reference to Wind Waker?
14. ## Question a grizzled and not yet bitter veteran

Quote:Original post by JeffLander ThunderHawk, I don't know of a list of companies that do internships. I know many do but it really depends. Only the very big companies will have an organized program for it, EA, Microsoft, etc. I can suggest a couple of things. Write to companies you like and ask them. Give a resume of your skills and tell them what you think you could do. Also you could post to the IDGA website (www.igda.org) and tell people you are looking for internships. In fact it looks like there are several threads in the Student/Academic Relations board offering them now Best of luck. -Jeff Thanks a lot. [cool] I've never visited the igda site before, although I've heard about it many times in the past.
15. ## Differential Equation

Sorry, I forgot to mention that I used maple to find an answer. I'm just trying to figure out how to arrive at an answer. It seems that I need to take a closer look at the specific integration that creates this problem, however, the only method I see to solve it is using integration by parts to obtain an algebraic equation that I can solve for the integral, which is what led me to the a^2 + b^2 denominator in the first place.