# sQuid

Member

306

149 Neutral

• Rank
Member

• Interests
Education
Programming
1. ## "Nice" tweakable S-function

You could also check out the generalized logistic function.
2. ## How to determine whether a region of a tiled hexmap is convex?

I think you could also consider just the centroid of each hexagon and then use the usual algorithms like gift wrapping.
3. ## Why multiply vector if you normalize it afterwards?

Try reading it again, you'll see that they're not multiplying the entire argument vector by 2. :-)
4. ## algorithm of fast exponentiation

You are probably more familiar with writing       (x + a)n = xn + a ( mod(n) ) which means that the two sides differ by a multiple of n. The modulus in the expression       (x + a)n = xn + a ( mod(xr -1 , n) ) means that       (x + a)n = xn + a ( mod(xr -1) ) and       (x + a)n = xn + a ( mod(n) ). Another way of thinking about it is that, if you were write out some polynomial in x, you can simplify it by substituting xr = 1 and any coefficient by its remainder mod n. The Agrawal et al. paper on "Primes in P" is pretty well written so you should be able to follow it. And for fast modular exponentiation you might like to take a look at the Russian Peasant Algorithm.
5. ## Theory of Inertia?

Quote:Original post by Max_Payne Would it be possible that gravity itself causes inertia? What are current theories on this? I don't think so, gravity and inertia are probably different aspects of some deeper underlying physics that we don't properly understand. The most sugestive evidence for this is that the two approaches we have to defining mass, that is gravitational mass and inertial mass, give identical results to the best of our measurement abilities. The equivalence of gravity and inertia is one of the first assumptions of Einstein's theory of gravity. The most puzzling question is where particles get this quantity that causes them to attract each other and determines the acceleration response to an applied force. The general "theory" about this at the moment is that particles gain mass through interactions with the Higgs field (to quote Feynman "all mass is interaction"), but as of yet no direct observation has been made of this field. One of the key goals of the large hadron collider is to determine whether or not it exists. Returning to your hypothesis, one thing you might like to think about is that, according to special relativity, physics looks the same in all reference frames that are moving at constant velocity with respect to each other. In particular, in the reference frame of an object it itself is stationary, so there can't be any retardation to its gravitational attraction to its earlier self. For an accelerating object special relativity doesn't apply and self-interactions can become important. Another related question is, is a similar effect produced by the electromagnetic force on a charged particle? This would produce the opposite effect as the self-interaction is now repulsive. I'm slightly beyond my qualifications now, but I think these sorts of questions are the motivations behind quantum field theory. Quote:You need some kind of model of reality in order to progress ... One of the problems with "reality" in physics is that the East African plains ape doesn't appear to have a very good grasp of it ;)
6. ## Using torque

So you're probably aware that the torque τ is a vector quantity defined as the cross product τ = r x F, with F the applied force and r the vector from the pivot point to the point where the force is applied. What you want to calculate is the angular acceleration α, which is found using the following angular version of Newton's second law: τ = I α. The quantity I is the "moment of inertia" which depends on both the mass and the geometry of the object. For a rod of length L and mass m it's given by I = 1/3 m L2. Examples for different shaped objects are given here. Now that you know the angular acceleration, you can work out the change in rotational velocity and the change in angle as usual with the appropriate equations of motion.
7. ## Calculating eigenvalues

Quote:Thanks for all the answers! Im not really a game developer, I am studying physics at university at I need to compute eigenvalues in very large matrices (100x100) for some applications in quantum mechanics. You might find this useful: http://www.physics.uq.edu.au/people/dawson/matrix/doc/
8. ## Cross Product woes

Quote:Original post by Cacks Yeah the camera's x-axis will change, I might change that when I get the code working and test what the functionality is like with the current code, that will be easy, I can just use the vector that the camera looks at. Do you have any ideas how I can compensate for this zero vector? When this happens, you need to choose an x-vector, as cameraLookAtVector and objectPositionVector - cameraPositionVector no longer define a plane that you can use to orient yourself. In the absence of any other choice, and writing cameraPositionVector = (a,b,c), you could just take cameraOrthogonalVector = (-b,a,0)
9. ## [Math] Classes of functions with specific product integration property

If the functions g and h are normalized, then replacing the = with <= gives you a special case of Holder's inequality with p = q = 1. Before moving onto this it might be helpful to look at the p = q = 2 case, known as the Cauchy-Schwartz inequality, which is easier to think about because it is just a continuous version of the familiar inequality involving the dot product |a.b| <= |a||b|. The Cauchy-Schwartz inequality is an equality whenever a and b are parallel, or linearly dependent, and this can be extended to a similar concept for continuous functions. For the p = q = 1 case, something similar holds except using a different norm, and unfortunately I believe it's only an equality when g and h are constant.
10. ## Cross Product woes

One potential problem here is that if your camera is looking directly at the object then the cross product you describe will always give the zero vector. Another, although this may not be such a problem, is that the cameras x-axis as you've defined it will change as the object position changes.
11. ## Calculating eigenvalues

I'm not sure how good the numerical recipes are for general non-symmetric matrices, so be careful with them. If you ever want more detail, I find this book really useful, but I think the best thing you gain from writing your own code to do general eigen decompositions is a deep appreciation for the Lapack functions DGEEV and ZGEEV :)