220 likes | 317 Views
3D Physical Simulation. Cao Han D-A7-2819-0 Project Supervisor: Dr. Wu Wen Faculty of Science and Technology University of Macau. Outline. Part I: construct a Newton’s cradle by a physical engine and the C++ language. Principle of physical simulation Newton’s cradle analysis
E N D
3D Physical Simulation Cao Han D-A7-2819-0 Project Supervisor: Dr. Wu Wen Faculty of Science and Technology University of Macau
Outline • Part I: construct a Newton’s cradle by a physical engine and the C++ language. • Principle of physical simulation • Newton’s cradle analysis • Collision detection • Numerical Computation • Deformable body simulation
Outline (cont.) • Part II: implement a Newton’s cradle with haptic feedback • Interaction with Newton’s cradle • Scenes Switching • Cutting Ropes • Haptic Feedback • Spring Effects • Conclusion
Principle of Simulation • Problem: Given the physical environment, tofind the position of the object
Newton’s cradle analysis Problem: how to compute the sumforce Drag Force Gravity Drag Force provide centripetal force Drag Force = centripetal force(1/2mv^2) + the subforce of gravity along the rope
Collision Detection Problem: Detects if two balls collide If Distance < 2 * radius Collision Happen
Collision Detection (cont.) Energy and Momentum keeps the conservation in the system Center line b a : the mass of body a : the mass of body b : the velocity of a before the collision : the velocity of bbefore the collision along the rope along the rope. : the velocity of a after the collision : the velocity of b after the collision along the rope along the rope
Numerical Computation • The Euler Method • The Fourth-order Runge-Kutta (RK4) Method Problem: given the acceleration, calculate the position every dt time
The Euler Method T=92 Ball Real motion T=198 Euler Method T=244
The Fourth-order Runge-Kutta (RK4) Method T=66 Ball Real motion RK4 T=90 T=306 Euler Method
Deformable Body Simulation Rope Spring Force Which indicates the force direction A particle SpringForce = - Distance * SpringConstant FrinctionForce = - Velocity * FrictionalConstant
Part II: Implement a Newton’s cradle with haptic feedback • Interaction with Newton’s cradle • Handle Mirror Reflection Problem • Cutting Ropes • Haptic Feedback • Spring Effects • User Interface Sensable Phantom Desktop
Interaction with Newton’s Cradle mass ballCount stringLength globalCreation ->Create() Main.x3d (Update) UI.x3d UI.py bounce damping ballRadius Damping, mass, ballCount, stringLength, Bounce, ballRadius, bounce: Parameters of Newton’s cradle controlled by UI components Main.x3d: main modeling file UI.x3d : file used for modeling UI UI.py : to pass messages between UI components
Handle Mirror Reflection Problem Mirror Reflection Scene 1 Scene 2 Scene 3 Scene 4 Scene 5 Scene 6 Transparent Objects Problem of Mirror Reflection Problem : <PlanReflection> have a bug
Handle Mirror Reflection Problem (cont.) Mirror Reflection Scene 1 Scene 2 Scene 3 Scene 4 Scene 5 Scene 6 1. decrease the size of transparent objects 2. untransparentize the objects 1. recover the size of objects 2. transparentize the objects
Cutting Ropes The cylinders for receiving the mouse event Multiple Cuts Single Cut Cutting Rope = Delete node <SingleAxisHingeJoint />
Haptic Feedback SmoothSurface DepthMapSurface HapticTexturesSurface MagneticSurface FrictionalSurface OpenHapticsSurface Make the geometry touchable by defining a touchable surface to the geometry <SmoothSurface/>
Spring Effect Which indicates the force direction SpringForce = - Distance * SpringConstant FrinctionForce = - Velocity * FrictionalConstant SpringConstant = 30 FrictionalConstant = 10 Start: Button Event & Object is touched End: Button Event Special: the feedback of the device would be provided by node < SpringEffect > Spring Effect with Mouse Spring Effect with Haptic Device
Play Sound • Requirements • Two stationary bodies: no sound • The sound function can adjust the volume of the sound according to the intensity of the collision.
Play Sound (cont.) Collision History …,…,… Ball, Board, CollisionTime …,…,… …,…,… …,…,… • Two stationary bodies: no sound …,…,… If Bodies are new Then play sound Else if last collision time+0.01 < Current Collision time Then Play Sound
Play Sound (cont.) • The sound function can adjust the volume of the sound according to the intensity of the collision. Compute the subtraction of velocities on the direction of the center line and map it to 0~1 range to represent the intensity Center line
Conclusion • A Newton’s cradle has been constructed by a physical engine we design. • A Newton’s cradle with haptic feedback has been implemented by H3D. • I get lots of experiences about haptic programming and 3D physical simulation. With these experience, I will still work hard in the further study