Is the projectile movement moving in two dimensions

One and two-dimensional collisions with computer simulation

Transcript

1 One- and two-dimensional collisions with computer simulation The physics presented in this thesis deals with collision processes in one- and two-dimensional systems. The observation is only made in a simplified and model-like manner, but gives a good insight into the processes in real impact processes, such as those that occur when playing billiards, for example. The fact that a simplified view of complicated processes can be useful in physics can be seen very well from the kinetic gas theory. In this theory, the collisions of individual gas particles are abstracted into one-dimensional collision processes. But the complex impact processes of the game of billiards can also be calculated quite precisely in advance with the model of the two-dimensional impact.

2 Table of contents Chapter: 1. Physical consideration of one- and two-dimensional collisions 1.1. Impulse and definition of the impulse magnitude Relationship between impulse and force Definition and derivation of the impulse of force The important conserved quantities in physics Concept of the closed system Conservation of energy Law of conservation of momentum Classification and treatment of the different types of collision 6 page: Characteristics of the central shock Characteristics of the eccentric shock Treatment of the fully elastic shock Treatment of the Inelastic collision Treatment of the real collision Special cases of collision processes Central elastic collision between two bodies of equal mass Vertical elastic collision of a body on a wall Slate elastic collision of a body on a wall Two-dimensional collision between two spheres Starting conditions Vector representation of forces and decomposition Mathematical treatment of forces Explanation of certain source code excerpts 2.1 . Class VECTOR2 as encapsulation of the vector mathematics Administration of the balls in a list object Calculation of the simulation physics Collision of a ball with a wall Collision detection between two balls Collision calculations Administration of the collisions in a time table Appendix 3.1. Source code for the simulation program Contents of the enclosed CD-ROM Separate instructions for the simulation program Printout of the Internet sources Sources Closing declaration 21

3 Consideration of one- and two-dimensional joints 1.1. Impulse and definition of the impulse size The impulse is a physical, vector quantity that can be assigned to the movement of a mass point. Every moving body with mass therefore carries an impulse. In the event of impacts and other interactions, it can partially or completely transfer this to other bodies 1. The momentum is defined as the product of the mass (m) and speed (v) of a body: p = mv The unit of momentum in the SI is kgm = kgm s = Ns. The unit Newton second (Ns) s s² can also occur under the name Huygens and the unit symbol Hy Relationship between momentum and force A force F acting on a body changes the momentum p of this body. The change in momentum per time is equal to the force acting on the body. This is Newton's second axiom 3. d d F = p mv dt dt With constant mass, d F = m v. dt The derivative of the speed v with respect to time is the acceleration a. F = ma 1 Wikipedia impulse (physics) source 8 2 Wikipedia impulse (definition and meaning) source 8 3 Wikipedia impulse (impulse and force) source 8

4 Definition and derivation of the impulse Fig. 1: Impact of a billiard ball with the cue as an example of an impulse 4 An impulse occurs when the impulse is changed in a closed system by an external force 5. F = ma with a constant acceleration In the period t the following applies: v F = mp = mvt where v is the change in speed that the body experiences as a result of the force, i.e. the difference between the speed before and after the impulse 6. I = p = F t Wikipedia impulse source 7 6 Wikipedia Impulse of force (derivation) Source 7

5 The important conservation quantities in physics Term of the closed system A closed system is a spatially limited arrangement of bodies that interact with one another without the bodies being influenced from outside the system by momentum exchange or the like The sum of the mechanical energies is constant as long as the processes in the system run smoothly. E = E + E = const. kin pot Figure two shows the energy curve of the kinetic energy (blue) and the potential energy (yellow) during free fall. The potential energy is continuously converted into kinetic energy without loss, so that the total energy remains constant at all times. Fig. 2: Energy curve during free fall Law of conservation of momentum In a closed system the (vectorial) sum of the momentum is constant over time 9. m1v1 + m2 v2 + m3 v mn vn = const. p + p + p p = const n 7 METZLER page 43 Source 1 8 METZLER page 79 Source 1 9 Physical formulas page 15 Source 4

6 Classification and treatment of the different types of collision A collision occurs when two bodies touch each other during a very short period of time t and their speeds change in the process. During the contact time t, both bodies experience the impulse F t 10. The tangential plane runs through the point of contact of the two bodies at the beginning of the impact. The impact normal is the line of action of the two normal forces that act on both bodies during the impact process. It runs perpendicular to the tangential plane. (see Figure 3) Features of the centric impact If the impact normal passes through the centers of gravity of both collision partners, one speaks of a centric impact. If the two velocity vectors v 1 and v 2 are parallel to the normal to the impact at the beginning of the impact, then it is also a straight impact. Fig. 3: Sketch of a centric joint with drawn in joint normal engineering mechanics page 224 source 2 11 engineering mechanics page 224 source 2

7 Characteristics of the eccentric collision If the collision normal does not go through the centers of gravity of both collision partners, then there is an eccentric collision. If, in addition, the two velocity vectors v 1 and v 2 are not parallel to the normal of the impact at the beginning of the impact, then there is an oblique eccentric impact before the fully elastic impact is treated Fig. 4: Energy balance for fully elastic impact 12 In the case of an elastic impact, the bodies behave resiliently. This means that after the impact, all deformations have completely subsided. External and internal friction are completely neglected in the case of elastic collisions 13. The elastic collision thus takes place in a closed system and both momentum conservation and energy conservation apply. The process can be followed more easily if it is divided into two parts. First impact section (compression): The first impact section begins with the contact of the two impact bodies and ends when the distance between the two bodies has reached 1 min. At this moment there is the greatest deformation of the two bodies. This deformation derives its energy from the 12 Technical Mechanics page 225 Source 2 13 Technical Mechanics page 225 Source 2

8 - 8 - Get faster body speed. So now both bodies have the same speed c. From the law of conservation of momentum it now follows: Before the collision: after the first collision section: m1v1 + m2v2 = m1c + m2c This gives the speed c of both bodies after the first collision section: c = mvm + mv + m (1) Second collision section (relaxation) : The second joint section begins at the minimum distance l min and ends when the two bodies are completely separated. The tension energy stored in the deformation of the body is now released without loss. The impulse when deforming (first impact section) is therefore equal to the force impact when releasing the tension energy (second impact section) 14. It follows from this that the change in speed from v 1 / v 2 to the common speed c is equal to the change from c to the final speeds c 1 / c is 2. v1 / 2 c = c c1 / 2 (2) From (1) and (2) one obtains the equations for the fully elastic, centric impact of two bodies 15: cc 1 2 (mm) v 2m v = m + m (mm) v + 2m v = m + m It should be noted that v1 and v 2 as well as the results c 1 / c 2 are scalar values. 14 Engineering Mechanics page 225 Source 2 15 Physical formulas page 16 Source 4

9 Treatment of the inelastic impact Fig. 5: Relationship between impact energy and deformation work 16 Inelastic bodies deform plastically during impact. So you get a permanent change in shape 17. First joint section: The first joint section is the same as with an elastic joint. In the end, both bodies have a common velocity c. The deformation work, however, is not stored as tension energy, but has been converted into heat 18. Second joint section: The second joint section is completely omitted in the case of inelastic impact, since there is no stored tension energy. So there is no separation of the two bodies after the impact, since both continue to move with the velocity c. The final velocity c for both bodies is obtained analogously to the velocity of both bodies at the end of the first impact section of the elastic centric impact: c = m v m + m v + m Engineering Mechanics Page 227 Source 2 17 Engineering Mechanics Page 227 Source 2 18 Engineering Mechanics Page 227 Source 2

10 Treatment of the real joint The deformation work is not completely returned in the second joint section, but is partially converted into heat. Fig. 6: Energy loss in real collisions due to heat emission. Special cases in collision processes Central elastic collision of two bodies of the same mass In this special case of the central elastic collision, both collision partners have the same mass. So the following applies: m1 = m2 = m If we now insert this into the two equations of the central elastic collision, we get: c1 = v2 and 2 1 c = v bodies with the same mass exchange their momentum 20: p '= p and p 2 '= p Technical Mechanics Page 229 Source 2 20 METZLER Page 43 Source 1

11 Vertical elastic impact of a body on a wall In the case of a vertical elastic impact on a wall, it is assumed that the mass of the impactor is very small compared to the mass of the wall (m1 << m2). This gives the following relationship from the normal equation for the central elastic impact: c1 = 2v2 v1 Since the wall does not move due to its large mass, one can set v c1 = v 2 = 0 and thus get 21: 1 and v2 = 0 The change in velocity of the impactor is thus: v = v 1 (v 1) = 2v1 The impulse of force on the wall is: I = p = 2m1v1 In terms of amount, the change in momentum is twice as large as the momentum before or after the impact slate more elastic Impact of a body on a wall Fig. 7: Vector representation of an oblique elastic impact with a wall 22 The component of the momentum that lies parallel to the wall remains unchanged: p '= p par par For the perpendicular component of the momentum, analogous to the perpendicular elastic one, applies Collision with a wall: p '= p lower sink The law of reflection of optics applies to the elastic impact on a wall: ppar psenk () = p cos α () = p sin α 21 METZLER page 43 source 1 22 METZLER page 43 source 1

12 Two-dimensional collision between two spheres Initial conditions Fig. 8: Overview of the position of the velocity components in a two-dimensional collision 23 A two-dimensional collision between two spheres is an oblique, centric collision between two bodies. In this case, the velocity vectors of the two impact bodies (v 1 v2) do not lie along the impact normal (i.e. not perpendicular to the tangential plane) .Vectorial force representation and decomposition.First, the velocities must be parallel into one component, i.e. in the direction of the impact normal (vp) and into one Component perpendicular to the impact normal (vs) are decomposed. Now the impact can be viewed as one-dimensional, i.e. as centric and straight, by only taking the parallel component into account and leaving the vertical component unchanged. The new parallel component is calculated in the same way as for the centric straight elastic collision (see treatment of the fully elastic collision). Special attention must be paid to the distinction between vectors and scalars. 23 The Math and Physics of Billards Source 6

13 Mathematical treatment of the forces Fig. 9: Vector decomposition To keep the observation simple, in this example only the ball k 1 moves before the impact process. The calculation of the final velocity is also limited to the first ball. However, the values ​​of the second sphere can be calculated in the same way as the first. (In the following, v lower / c lower and v / c always mean the par par velocity components of the first ball). To break down the velocities into the individual components, the first step is to calculate the impact normal n 0. This is obtained by normalizing the connection vector of the two balls k1k2 0 k 1k 2 k 2 k 1 n to the length 1. 24. k 1k 2 = = kk 1 2 Next, one can calculate the angle α between the velocity vector v 1 and the impact normal 0 n with the help of the scalar product 25: α = cos 0 vn 0 v1 nv = vn cos α par 1 () The vertical component is now obtained by vector subtraction: With the help of the angle α and the angle functions one can now calculate the parallel component of the speed. v = vv lower 1 par The absolute value of the new parallel component (m1 m 2) v par is obtained with the equation for the cpar = m1 + m one-dimensional centric straight joint: 2 0 From this it follows: cpar = cpar v par and with vector addition the top speed: c1 = cpar + vsenk 24 The Math and Physics of Billards Source 6 25 Mathematical formulas page 79 Source 5

14 Explanation of certain source code excerpts 2.1. Class VECTOR2 as encapsulation of vector mathematics The class VECTOR2 is used to encapsulate the mathematics of two-dimensional vectors. It also offers methods for creating and calculating with vectors. Source code 1: C_Vector.h (lines: 8-26) class VECTOR2 public: VECTOR2 (); VECTOR2 (float x, float y); // Creates a vector with x and y component ~ VECTOR2 (); float CompX (void); // x component received float CompY (void); // get y component void Set (float x, float y); // set x and y components VECTOR2 operator + (VECTOR2 v); // Adding two vectors VECTOR2 operator - (VECTOR2 v); // Subtract two vectors VECTOR2 operator * (float fvalue); // Multiplication of the vector with a scalar float operator * (VECTOR2 v); // Scalar product of two vectors (returns a scalar) float Amount (void); // amount of a vector VECTOR2 Normalize (void); // Returns the unit vector protected: float x; // x component float y; // y component}; By overloading the operators, the class objects can be mathematically linked with each other with the operators +, -, *. Source code 2: sample code // creating two vector objects VECTOR2 v1 (5.0f, 5.0f); VECTOR2 v2 (10.0f, 10.0f); // Adding the vectors using the overloaded operator + VECTOR2 vresult = v1 + v2;

15 Management of the balls in a list object The properties of the balls are saved in the structure S_Ball. Source code 3: main.cpp (line: 75-90) // Management of the ball properties struct S_Ball float x, y; // x and y component of the position vector float vx, vy; // x and y components of the speed vector int fmass; // mass of the sphere int fsize; // diameter of the sphere in pixels int iid; // internal ID of the ball char cname [128]; // Name of the sphere (max. 128 characters) int icolor; // Color value of the ball S_Ball () // Standard constructor // Set all variables to standard values ​​x = 0; y = 0; vx = 0; vy = 0; fmass = 100; fsize = 20; icolor = 5; }}; A new ball is created by first creating an S_Ball object and providing it with suitable values ​​for the individual variables. Next, a copy of the S_Ball object is saved in the BallList list object. Source code 4: main.cpp (line:) // Create a new ball S_Ball Ball; // assign uniqueid Ball.iID = icurrid; // update available IDs icurrid ++; // adapt the name of the ball to the ID char * pbuffer = Ball.cName; sprintf (pbuffer, "kugel% d", ball.iid); // Set the position of the ball to the center of the simulation window RECT r = 0,0,0,0}; GetClientRect (hRenderWnd, & r); Ball.x = r.right / 2; Ball.y = r.bottom / 2; // add ball to list AddBall (& Ball);

16 Access to the individual balls is now possible via the BallList list object: Source code 5: Example code // Global list object std :: list balllist; // Iterator for the list object // The iterator can be used to access the objects stored in the list std :: list :: iterator it; // go through the list of the order for (it = balllist.begin (); it! = Balllist.end (); it ++) // access to the object at the current list position it-> object access (); } 2.3.Calculation of the simulation physics Collision of a ball with a wall Source code 6: main.cpp (line:) // r.right is the width of the window area // r.bottom is the height of the window area // it is the access iterator for the BallList, and thus to the individual balls if (it-> x-it-> fsize / 2 <15) it-> vx = it-> vx * -1;} if (it-> y-it-> fsize / 2 <15 ) it-> vy = it-> vy * -1;} if (it-> x + it-> fsize / 2 + 15> r.right) it-> vx = it-> vx * -1;} if (it-> y + it-> fsize / 2 + 15> r.bottom) it-> vy = it-> vy * -1;} It is checked whether the current position of the sphere is still within the simulation window area. When the ball has passed the upper or lower band, the Y component of the ball velocity is reversed. If, on the other hand, the ball has crossed the left or right band, the X component of the ball speed is reversed. (see slate elastic collision of a body on a wall).

17 Collision detection between two balls Source code 7: main.cpp (line:) // it is again the iterator for the BallList and allows access to the ball properties // Create vectors for the 2 balls VECTOR2 Vb1 (it-> x + it-> vx, it-> y + it-> vy); VECTOR2 Vb2 (er> x + er> vx, er> y + er> vy); // create and calculate connection vector VECTOR2 Vt; Vt = Vb1-Vb2; // If the amount of the connection vector is smaller than the radius // then there is a collision if (vt.amount () <(it-> fsize + er> fsize) / 2) // Calculate collision} // VECTOR2 :: Amount () returns the amount of the vector First the connection vector of the position vectors of the two spheres is calculated. If the amount, i.e. the length of this connection vector, is smaller than the sum of the spherical radii, then there is a collision between the two spheres. Fig.10: Collision detection with two balls

18 Collision calculations Source code 8: main.cpp (line:) // Ball1 and Ball2 are pointers to the ball objects involved in the collision // Create vector for ball 1 VECTOR2 k1 (ball1-> x, ball1-> y); VECTOR2 v1 (ball1-> vx, ball1-> vy); // create vector for ball 2 VECTOR2 k2 (ball2-> x, ball2-> y); VECTOR2 v2 (ball2-> vx, ball2-> vy); // The connection vector of the two balls is the impact normal VECTOR2 n = (k2-k1); // Angle between sphere1 and impact normal float f1 = (v1 * n) / (n * n); // Parallel component VECTOR2 vp1 = n * f1; // Vertical component VECTOR2 vs1 = v1-vp1; // angle between sphere2 and impact normal float f2 = (v2 * n) / (n * n); // parallel component VECTOR2 vp2 = n * f2; // Vertical component VECTOR2 vs2 = v2-vp2; // If the masses of the two balls are the same -> simplification // Parallel components are exchanged, vertical components remain the same if (ball1-> fmass == Ball2-> fMass) v1 = vs1 + vp2; v2 = vs2 + vp1; // split into speed components Ball1-> vx = v1.compx (); Ball1-> vy = v1.compy (); Ball2-> vx = v2.compx (); Ball2-> vy = v2.compy (); } else // if mass is not the same, then: Vvertical remains the same // Vparalell with pulse sets float v1x = elstoss (ball1-> fmass, vp1.compx (), ball2-> fmass, vp2.compx ()); float v1y = elstoss (ball1-> fmass, vp1.compy (), ball2-> fmass, vp2.compy ()); VECTOR2 vn1 (v1x, v1y); float v2x = elstoss (ball2-> fmass, vp2.compx (), ball1-> fmass, vp1.compx ()); float v2y = elstoss (ball2-> fmass, vp2.compy (), ball1-> fmass, vp1.compy ()); VECTOR2 vn2 (v2x, v2y); v1 = vs1 + vn1; v2 = vs2 + vn2; // divide into speed components Ball1-> vx = v1.compx (); Ball1-> vy = v1.compy (); Ball2-> vx = v2.compx (); Ball2-> vy = v2.compy (); }

19 Management of the collisions in a time table If two balls do not completely separate from each other immediately after a collision calculation, the simulation incorrectly detects a new collision. This effect occurs above all with very large scattering angles. To avoid this problem, the simulation only considers collisions of two balls that are a certain time away from the last collision of these two balls. For this purpose, a time table is created in the program, which saves all collisions together with their exact point in time. If a collision now occurs, the time table shows whether the collision has to be taken into account. For this purpose, the stored time value is compared with the current time value and a check is therefore made as to whether the last stored collision has passed long enough. Source code 9: main.cpp (line:) bool PhCheckTimeTable (int iid1, int iid2) // iid1 is the ID of the first ball that is involved in the collision // iid2 is the ID of the second ball that is involved in the collision / / TimeList is the time table in which the values ​​are stored for (tt = timelist.begin (); tt! = Timelist.end (); tt ++) // time table is checked // if for the two balls that were involved in the collision / / are involved, there is an entry in the table if ((tt-> iid1 == iid2 && tt-> iid2 == iid2) (tt-> iid2 == iid1 && tt-> iid1 == iid2)) // if the entry is older as iwaittime is} if (gettickcount ()> (tt-> itime + iwaittime)) tt-> itime = GetTickCount (); // create a new entry return true; // Detect collision and calculate it later} // If the entry wasn't long enough ago else return false; // Skip the collision and do not calculate}}} // If there was no entry in the table, create a new entry S_Time Time; Time.iID1 = iid1; // ID of the first ball Time.iID2 = iid2; // ID of the second ball Time.iTime = GetTickCount (); // "Time" at which the entry was created TimeList.push_back (Time); // Save the entry in the table return true; // Detect collision and calculate it later

20 Appendix 3.1. Source code for the simulation program The source code for the simulation program consists of the files C_Vector.h, C_Vector.cpp, resource.h and main.cpp. The files are located in the \ Simulation \ Quellecode \ directory on the enclosed CD-ROM. No printout of the source code is enclosed, as it contains a total of more than 3000 lines. Contents of the enclosed CD-ROM The enclosed CD-ROM contains: - a digital version of the technical work as a pdf file - a digital version of the manual as a pdf file - the simulation as an executable file - the source code of the simulation program - VC to compile the source code files - Acrobat Reader to open the pdf files 3.3. Separate instructions for the simulation program The instructions for the simulation program are included both as a digital version on the CD-ROM and as a separate printout of the technical work Printout of the Internet sources The Internet sources used (see 3.5 Sources) are included in the appendix in printed form.

21 References Literature sources: 1) METZLER Physik 3rd edition (Joachim Grehn and Joachim Krause) 2) VIEWEG - Technical Mechanics (Alfred Böge) 3) HARRI DEUTSCH - Lectures on Theoretical Physics I (Arnold Sommerfeld) 4) J.LINDAUER Physical formulas and Tables (hammer and hammer) 5) J.LINDAUER Mathematical formulas and tables (Barth, Wörle and Nikol) Internet sources: 6) The Math and Physics of Billards 7) Wikipedia Impulse (Version of December 16, 2006) 8) Wikipedia Impulse (Physik ) Final declaration I hereby declare that I have completed the technical work without outside help and have only used the sources and aids listed in the bibliography. Bad Neustadt a. d. Saale, the (signature)