# Newton's law...

Started by ogracian, Oct 04 2001 06:43 PM

25 replies to this topic

###
#1
Members - Reputation: **180**

Posted 04 October 2001 - 06:43 PM

Hello
I am trying to write an application wich simulate a box sliding down a slope, using real physics, but I am having troubles with it, in how can I compute the surface''s normal force of reaction, so I dont know how to get my total forces acting over my system.
Here is a Diagram :
\0 (Sliding box)
\
\
\
\
\
------ \
SLOPE
So the data wich I count is as follows:
I know my cube mass, so I got W = mg
the slope angle is 45*
the cube is sliding down from rest.
I really appreciate if someone could help me with this, maybe some formulas will be great!.
PS: I am trying to do this in 3D using vector math.
Thanks in advance!
Oscar

Sponsor:

###
#2
Members - Reputation: **122**

Posted 05 October 2001 - 12:32 AM

you have consider the fact that gravity = 9.82, angle 45 and weigth. have you consided that ever force has an opposite force in this case you need three line that should look like

---\

---o===

---|

---|

downwards you have gravity time weight of the object. left you have the direction created by the slope and the 3rd line in the opposing force to the other to items which include friction and air resistance. most people don't include air resistance. hope this help . my diagram isn't appearing as it should .

Edited by - R3sistance on October 5, 2001 7:41:32 AM

---\

---o===

---|

---|

downwards you have gravity time weight of the object. left you have the direction created by the slope and the 3rd line in the opposing force to the other to items which include friction and air resistance. most people don't include air resistance. hope this help . my diagram isn't appearing as it should .

Edited by - R3sistance on October 5, 2001 7:41:32 AM

###
#3
Members - Reputation: **102**

Posted 05 October 2001 - 06:14 AM

What happens is that gravity pulls the block downwards into the slope. The slope then pushes in the direction of its normal. The upward component of the slope''s force will equal gravity and then you can work out the sideways force which pushes the block sideways.

###
#4
Members - Reputation: **122**

Posted 05 October 2001 - 06:35 AM

Hullo.

You know that the box will either remain stationary or accelerate down the slope. This is because the normal reaction will always equal whatever force the box applies perpendicular to the slope.

So it will not acceleration to, or from the slope, as there is no net force. It may accelerate down the slope however, if there is a net force down the slope.

Let''s define some things we will need:

m = mass of box (kg)

g = gravitational field strength (9.81 N/kg)

a = angle of the slope

u = coefficient of friction

F = the frictional force (acts in the opposite direction to motion)

N = the normal reaction (equal and oppsite to the force applied by the box perpendicular to the slope)

Ok, you know that ''net force = mass * acceleration.'' (for a constant mass).

We know the force, we know the mass, we want the acceleration.

Let''s first compute the net force. We will resolve down the slope so we will get an acceleration to apply down the slope (signs will therefore not become a problem).

Ok, you should know that the frictional force is given by the coefficient of friction multiplied by the normal reaction, in the direction opposing motion.

F = uN, where 0 <= u <= 1.

The force down the slope due to the weight of the box is m*g*sin(a). The normal reaction is given by m*g*cos(a). However, it has no effect when resolving perpendicular to it, which we are. What it does affect is the frictional force, which is uN. Hence the frictional force is u*(m*g*cos(a)).

So, net force down the slope = m*g*sin(a)-u*m*g*cos(a).

i.e. net force down the sope = m*g(sin(a) - u*cos(a)).

We know to produce acceleration we divide by mass, m.

So acceleration *down* the *slope* = g(sin(a) - u*cos(a)).

This may or may not be immediately applicable to your box and slope world. This is the magnitude of an acceleration vector, the direction of which will be equivalent to the slope. I''ll assume you know how to split up the magnitude into its i and j components given its direction. You can then move the box in its 2d plane. But I''ve no idea how your simulation works.

There''s the physics though. If you need more help, ask again.

r.

"The mere thought hadn''t even begun to speculate about the slightest possibility of traversing the eternal wasteland that is my mind..."

You know that the box will either remain stationary or accelerate down the slope. This is because the normal reaction will always equal whatever force the box applies perpendicular to the slope.

So it will not acceleration to, or from the slope, as there is no net force. It may accelerate down the slope however, if there is a net force down the slope.

Let''s define some things we will need:

m = mass of box (kg)

g = gravitational field strength (9.81 N/kg)

a = angle of the slope

u = coefficient of friction

F = the frictional force (acts in the opposite direction to motion)

N = the normal reaction (equal and oppsite to the force applied by the box perpendicular to the slope)

Ok, you know that ''net force = mass * acceleration.'' (for a constant mass).

We know the force, we know the mass, we want the acceleration.

Let''s first compute the net force. We will resolve down the slope so we will get an acceleration to apply down the slope (signs will therefore not become a problem).

Ok, you should know that the frictional force is given by the coefficient of friction multiplied by the normal reaction, in the direction opposing motion.

F = uN, where 0 <= u <= 1.

The force down the slope due to the weight of the box is m*g*sin(a). The normal reaction is given by m*g*cos(a). However, it has no effect when resolving perpendicular to it, which we are. What it does affect is the frictional force, which is uN. Hence the frictional force is u*(m*g*cos(a)).

So, net force down the slope = m*g*sin(a)-u*m*g*cos(a).

i.e. net force down the sope = m*g(sin(a) - u*cos(a)).

We know to produce acceleration we divide by mass, m.

So acceleration *down* the *slope* = g(sin(a) - u*cos(a)).

This may or may not be immediately applicable to your box and slope world. This is the magnitude of an acceleration vector, the direction of which will be equivalent to the slope. I''ll assume you know how to split up the magnitude into its i and j components given its direction. You can then move the box in its 2d plane. But I''ve no idea how your simulation works.

There''s the physics though. If you need more help, ask again.

r.

"The mere thought hadn''t even begun to speculate about the slightest possibility of traversing the eternal wasteland that is my mind..."

###
#7
Members - Reputation: **180**

Posted 05 October 2001 - 10:31 AM

Thank you all for all your help, but unfortunatly I still having troubles simulating it, so I post my code here hopping if some one could help me:

PS: I am doing this without friction;

#define PI 3.141516

int controlador;

int modo;

float i = 0.0f;

int angle = 90 - 45;

float mass = 2000.0f;

float gravity = 9.8f;

float velx = 0.0f;

float vely = 0.0f;

float accelx = 0.0f;

float accely = 0.0f;

float xpos = 10.0f;

float ypos = 110.0f;

float Fx = 0.0f;

float Fy = 0.0f;

float weight = 0.0f;

void main()

{

controlador = DETECT;

modo = DETECT;

initgraph(&controlador, &modo, "");

setfillstyle(1,BLACK);

bar(0,0,640,480);

// Draw terrain

setcolor(2);

line(10, 110, 310, 410);

//

// Draw ball

setcolor(1);

circle((int)(xpos), (int)(ypos), 10);

//

// wait a key to begin sim

getch();

//

// Compute Forces

weight = mass * gravity;

Fx = weight * sin((float)(angle)*PI/180.0f);

Fy = weight * cos((float)(angle)*PI/180.0f);

for (; i < 30; i+=0.1f)

{

//

// Compute ball accel

accelx = Fx / mass;

accely = Fy / mass;

//

// Compute velocity

velx = velx + accelx * i;

vely = vely + accely * i;

//

// Update ball''s pos

xpos = xpos + velx * i;

ypos = ypos + vely * i;

//

// Draw objects

setcolor(2);

line(10, 110, 310, 410);

setcolor(1);

circle((int)(xpos), (int)(ypos), 10);

delay(50);

if (kbhit())

break;

}

getch();

closegraph();

}

PS: I am using Turbo C++.

Thanks!

PS: I am doing this without friction;

#define PI 3.141516

int controlador;

int modo;

float i = 0.0f;

int angle = 90 - 45;

float mass = 2000.0f;

float gravity = 9.8f;

float velx = 0.0f;

float vely = 0.0f;

float accelx = 0.0f;

float accely = 0.0f;

float xpos = 10.0f;

float ypos = 110.0f;

float Fx = 0.0f;

float Fy = 0.0f;

float weight = 0.0f;

void main()

{

controlador = DETECT;

modo = DETECT;

initgraph(&controlador, &modo, "");

setfillstyle(1,BLACK);

bar(0,0,640,480);

// Draw terrain

setcolor(2);

line(10, 110, 310, 410);

//

// Draw ball

setcolor(1);

circle((int)(xpos), (int)(ypos), 10);

//

// wait a key to begin sim

getch();

//

// Compute Forces

weight = mass * gravity;

Fx = weight * sin((float)(angle)*PI/180.0f);

Fy = weight * cos((float)(angle)*PI/180.0f);

for (; i < 30; i+=0.1f)

{

//

// Compute ball accel

accelx = Fx / mass;

accely = Fy / mass;

//

// Compute velocity

velx = velx + accelx * i;

vely = vely + accely * i;

//

// Update ball''s pos

xpos = xpos + velx * i;

ypos = ypos + vely * i;

//

// Draw objects

setcolor(2);

line(10, 110, 310, 410);

setcolor(1);

circle((int)(xpos), (int)(ypos), 10);

delay(50);

if (kbhit())

break;

}

getch();

closegraph();

}

PS: I am using Turbo C++.

Thanks!

###
#8
Members - Reputation: **122**

Posted 07 October 2001 - 09:07 AM

Let me explain this to you by using a so-called `model´. You cannot copy-paste this in your code I´m afraid (I just don´t feel like reading all this code ;-) ), but here´s how you could do the physics part in c++.

#include

float t, Fg, F, a, v, s, x, y, m; // time, gravity force, force, acceleration, speed, position, coordinates and mass

float dt, dv, ds, dx, dy; // the d should be a greek delta here, but these variables represent delta-time, delta-velocity, delta-space, delta-x and and delta-y

const float angle = 50.0 * M_PI / 180.0; // horizontal = 0°, convert degrees to radians

const float m = 20.0; // mass in kgs

t = 0.0;

a = 0.0;

v = 0.0;

s = 0.0;

x = 0.0;

y = 10.0; // start at 10 meters

dt = 0.1; // you could change dt in 1 / 30 at a 30 fps framerate for example. Smaller numbers make it more accurate

while(1)

{

// increment the time.

t = t + dt;

// calculate the forces on the box. I am using a somewhat different approach then Fresh (this one''s easier), but I think it''s a valid way to solve this problem... correct me if it is not or if I''m forgetting anything

Fz = 9.81 * m;

// calculate the force down the slope, by splitting up Fz in components of which one heads in the same direction as the slope does

F = cos(angle) * Fz;

// here you could subtract are resistance, but in most cases this is not really important. It becomes important at speeds above approximately 40 m/s.

F = F - 0.0;

// calculate the acceleration, F = m . a

a = F / m;

// now the acceleration has been calculated calculate speed and position

dv = dt * a;

v = v + dv;

ds = dt * v;

s = s + ds;

// split up the delta-distance vector (direction angle), and calculate the real (onscreen) position

dx = cos(angle) * ds;

dy = sin(angle) * ds;

x = x + dx;

y = y + dy;

// use the variables, draw something, etc.

}

Here you go. As you can see, it´s an infinite slope, but changing that shouldn´t be difficult. Probably there are some syntax errors, but I think this code is useable. Good luck!

Nick

#include

float t, Fg, F, a, v, s, x, y, m; // time, gravity force, force, acceleration, speed, position, coordinates and mass

float dt, dv, ds, dx, dy; // the d should be a greek delta here, but these variables represent delta-time, delta-velocity, delta-space, delta-x and and delta-y

const float angle = 50.0 * M_PI / 180.0; // horizontal = 0°, convert degrees to radians

const float m = 20.0; // mass in kgs

t = 0.0;

a = 0.0;

v = 0.0;

s = 0.0;

x = 0.0;

y = 10.0; // start at 10 meters

dt = 0.1; // you could change dt in 1 / 30 at a 30 fps framerate for example. Smaller numbers make it more accurate

while(1)

{

// increment the time.

t = t + dt;

// calculate the forces on the box. I am using a somewhat different approach then Fresh (this one''s easier), but I think it''s a valid way to solve this problem... correct me if it is not or if I''m forgetting anything

Fz = 9.81 * m;

// calculate the force down the slope, by splitting up Fz in components of which one heads in the same direction as the slope does

F = cos(angle) * Fz;

// here you could subtract are resistance, but in most cases this is not really important. It becomes important at speeds above approximately 40 m/s.

F = F - 0.0;

// calculate the acceleration, F = m . a

a = F / m;

// now the acceleration has been calculated calculate speed and position

dv = dt * a;

v = v + dv;

ds = dt * v;

s = s + ds;

// split up the delta-distance vector (direction angle), and calculate the real (onscreen) position

dx = cos(angle) * ds;

dy = sin(angle) * ds;

x = x + dx;

y = y + dy;

// use the variables, draw something, etc.

}

Here you go. As you can see, it´s an infinite slope, but changing that shouldn´t be difficult. Probably there are some syntax errors, but I think this code is useable. Good luck!

Nick

###
#13
Members - Reputation: **122**

Posted 08 October 2001 - 09:45 PM

I just can't let this slip by unnoticed

The gravity constant(on earth) is not 9.81 m/s^2

It should be g = 9.82 m/s^2

=)

EDIT: Though one Newton is allway one newton, not depending on planet/gravity. It is a measure of force. Thus the force i.g. may vary depending on the gravity of the location.

Edited by - E-we on October 9, 2001 4:47:58 AM

The gravity constant(on earth) is not 9.81 m/s^2

It should be g = 9.82 m/s^2

=)

EDIT: Though one Newton is allway one newton, not depending on planet/gravity. It is a measure of force. Thus the force i.g. may vary depending on the gravity of the location.

Edited by - E-we on October 9, 2001 4:47:58 AM

###
#14
Moderators - Reputation: **1373**

Posted 09 October 2001 - 03:17 AM

quote:Original post by E-we

I just can''t let this slip by unnoticed

The gravity constant(on earth) is not 9.81 m/s^2

It should be g = 9.82 m/s^2

=)

If you want to get

**picky**about things, , then you should consider that gravitational acceleration is

**NOT**9.81 or 9.82 m/s

^{2}! It depends on where you are and both of those values are valid somewhere. At the equator, it is roughly 9.78 m/s

^{2}, while at the poles it is roughly 9.83 m/s

^{2}. Check out this reference page on the web site for NASA''s Goddard Space Flight Center:

http://helios.gsfc.nasa.gov/qa_earth.html#earth

But I admire your mind for perfection, which reminds me of myself, .

Graham Rhodes

Senior Scientist

Applied Research Associates, Inc.

###
#15
Members - Reputation: **122**

Posted 09 October 2001 - 07:47 AM

quote:Original post by grhodes_at_work

If you want to getpickyabout things, , then you should consider that gravitational acceleration isNOT9.81 or 9.82 m/s^{2}! It depends on where you are and both of those values are valid somewhere. At the equator, it is roughly 9.78 m/s^{2}, while at the poles it is roughly 9.83 m/s^{2}. Check out this reference page on the web site for NASA''s Goddard Space Flight Center:

http://helios.gsfc.nasa.gov/qa_earth.html#earth

But I admire your mind for perfection, which reminds me of myself, .

Yeah if you want your box to be sliding realistically you should use Fz = G * (m*M)/r

^{2}where G = 6.6726*10

^{-11}Nm

^{2}kg

^{-2}, m is your box''s mass in kg, M is the mass of the Earth (5.976*10

^{24}kg), and r is the distance from your cube to the Earth''s center of mass in m.

Also, you should model box-air and box-slope frictional forces for total accuracy. And of course all the forces that I forgot to mention.

LOL

###
#16
Anonymous Poster_Anonymous Poster_*
Guests - Reputation:

Posted 09 October 2001 - 07:51 AM

quote:Original post by Scarab0

[quote]Original post by grhodes_at_work

If you want to getpickyabout things, , then you should consider that gravitational acceleration isNOT9.81 or 9.82 m/s^{2}! It depends on where you are and both of those values are valid somewhere. At the equator, it is roughly 9.78 m/s^{2}, while at the poles it is roughly 9.83 m/s^{2}. Check out this reference page on the web site for NASA''s Goddard Space Flight Center:

http://helios.gsfc.nasa.gov/qa_earth.html#earth

But I admire your mind for perfection, which reminds me of myself, .

Yeah if you want your box to be sliding realistically you should use Fz = G * (m*M)/r

^{2}where G = 6.6726*10

^{-11}Nm

^{2}kg

^{-2}, m is your box''s mass in kg, M is the mass of the Earth (5.976*10

^{24}kg), and r is the distance from your cube to the Earth''s center of mass in m.

Also, you should model box-air and box-slope frictional forces for total accuracy. And of course all the forces that I forgot to mention.

LOL

And you''d have to include some trig there, since the center of mass of the earth is not necessarily aligned with your Z axis.

###
#17
Anonymous Poster_Anonymous Poster_*
Guests - Reputation:

Posted 09 October 2001 - 07:51 AM

quote:Original post by Scarab0

[quote]Original post by grhodes_at_work

If you want to getpickyabout things, , then you should consider that gravitational acceleration isNOT9.81 or 9.82 m/s^{2}! It depends on where you are and both of those values are valid somewhere. At the equator, it is roughly 9.78 m/s^{2}, while at the poles it is roughly 9.83 m/s^{2}. Check out this reference page on the web site for NASA''s Goddard Space Flight Center:

http://helios.gsfc.nasa.gov/qa_earth.html#earth

But I admire your mind for perfection, which reminds me of myself, .

Yeah if you want your box to be sliding realistically you should use Fz = G * (m*M)/r

^{2}where G = 6.6726*10

^{-11}Nm

^{2}kg

^{-2}, m is your box''s mass in kg, M is the mass of the Earth (5.976*10

^{24}kg), and r is the distance from your cube to the Earth''s center of mass in m.

Also, you should model box-air and box-slope frictional forces for total accuracy. And of course all the forces that I forgot to mention.

LOL

And you''d have to include some trig there, since the vector to the center of mass of the earth is not necessarily aligned with your Z axis.

###
#19
Moderators - Reputation: **1550**

Posted 09 October 2001 - 07:20 PM

quote:

quote:

--------------------------------------------------------------------------------

Original post by Anonymous Poster

And you''d have to include some trig there, since the vector to the center of mass of the earth is not necessarily aligned with your Z axis.

--------------------------------------------------------------------------------

It''s not???

Though close, the Earth is not a perfect sphere - particularily if you''re hanging side-ways off a mountain.

9.81-9.83, I never knew g varied that much across the globle...

Magmai Kai Holmlor

- Not For Rent