Jump to content
  • Advertisement
Sign in to follow this  
c0der_

The Normal Force (3D Inclined Plane)

This topic is 2721 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

I am simulating a particle travelling down a 3D inclined plane. In OpenGL you rotate about the z axis, to rotate about the y axis in spherical coordinates. The code below works as it is, but isn't it supposed to be that the YAngle, being the angle of phi (starting from the positive y axis to the negative y axis) in spherical coords is supposed to be PI/2-rYAngle, to get it to be the actual angle of the plane?

|y
|
|______x
/
/z

Here is the code for computing the normal force in 3D:

Vector4 ParticleForceUpdater::computeNormalForce(Particle *pParticle, real rXZAngle, real rYAngle)
{
real rGravity = GRAVITY_CONSTANT * pParticle->getMass();
real rNormal = rGravity * real_cos(rYAngle);

Vector4 vNormalForce;
vNormalForce.x = -rNormal * real_cos(rXZAngle) * real_sin(rYAngle);
vNormalForce.y = rNormal * real_cos(rYAngle);
vNormalForce.z = rNormal * real_sin(rXZAngle) * real_sin(rYAngle);

[color="#0000ff"][color="#0000ff"] return vNormalForce;
}



Share this post


Link to post
Share on other sites
Advertisement
In OpenGL you rotate about the z axis, to rotate about the y axis in spherical coordinates.[/quote]
Although I'm not entirely sure what you mean by this, I can tell you with almost complete certainty that it's wrong. OpenGL doesn't care what axis you rotate around, and it certainly doesn't impose any restrictions or have any implications regarding spherical coordinate conversions.

In short, you can perform a spherical coordinate conversion using whatever conventions you prefer; the fact that you're using OpenGL makes no difference. (Also, it's more common to solve this sort of problem using vector math than using angles and trigonometry. Is there any particular reason you feel angles need to be involved?)

Share this post


Link to post
Share on other sites
Because since gravity points straight down, the normal force is dependant upon the angle of inclination of the surface, so I am resolving each component of the normal force and in the end, I use vector addition to get the total net force to apply to the particle. How would you work out the normal force using vector math alone?

Share this post


Link to post
Share on other sites

Because since gravity points straight down, the normal force is dependant upon the angle of inclination of the surface, so I am resolving each component of the normal force and in the end, I use vector addition to get the total net force to apply to the particle. How would you work out the normal force using vector math alone?

Ok, I'm looking at the Wikipedia article, here. The article gives the magnitude of the normal force as:

N = mgcos(?)

Let's say for the sake of example that +y is up. Since for two unit-length vectors dot(a, b) = cos(angle(a, b)), we know that:

cos(?) = dot(surface_normal, y_axis) = surface_normal.y

Therefore, if I'm not mistaken, you can simply plug that in for cos(?) in the original equation, and thereby solve for N using vector math rather than trig.

Also, if you check out the article, there's a section entitled 'Using vectors' that discusses how to solve the problem using vector math. (The article goes a little more in-depth though and computes the normal force in terms of the surface normal and the 'stress tensor'.)

Share this post


Link to post
Share on other sites
The net force is just the linear projection of the gravitational force onto the constraint plane.

If n is a plane's (unit-length) normal, then, for any vector v, the vector <v, n>n is the projection of v onto the orthogonal complement to the plane, and the vector v - <v, n>n is its projection onto the plane. Notice that these two vectors add up to v itself. Here, I use angle brackets to denote inner ("dot") products; i.e., for any vectors a and b, I use <a, b> to denote the inner product of a with b.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!