Post on 24-Feb-2016
description
Cao HanD-A7-2819-0
Project Supervisor: Dr. Wu WenFaculty of Science and Technology
University of Macau
3D Physical Simulation
Part I: construct a Newton’s cradle by a physical engine and the C++ language.
Principle of physical simulationNewton’s cradle analysisCollision detectionNumerical ComputationDeformable body simulation
Outline
Part II: implement a Newton’s cradle with haptic feedback
Interaction with Newton’s cradleScenes SwitchingCutting RopesHaptic FeedbackSpring Effects
Conclusion
Outline (cont.)
Physical Environme
nt
Resultant Force
AccelerationVelocity
Position
Principle of SimulationProblem: Given the physical environment, to find the position of the object
Drag
For
ce
Gravity
Drag Force provide centripetal forceDrag Force = centripetal force(1/2mv^2) + the subforce of gravity along the rope
Newton’s cradle analysisProblem: how to compute the sumforce
If Distance < 2 * radiusCollision Happen
Collision DetectionProblem: Detects if two balls collide
: the mass of body a : the mass of body b: the velocity of a before the collision : the velocity of b before 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
Energy and Momentum keeps the conservation in the system
Collision Detection (cont.)
12𝑀𝑎𝑉 𝑎
2+12𝑀𝑏𝑉 𝑏
2=12𝑀𝑎𝑉 𝑎 ′
2+12𝑀𝑏𝑉 𝑏′
2
Center line
a b
The Euler Method
The Fourth-order Runge-Kutta (RK4) Method
Numerical Computation
Problem: given the acceleration, calculate the position every dt time
The Euler Method
Euler Method
Real motion
Ball
T=92
T=198
T=244
The Fourth-order Runge-Kutta (RK4) Method
Euler Method
Real motion RK4
Ball
T=66
T=90
T=306
A particle
Spring Force
Rope
SpringForce = - Distance * SpringConstant FrinctionForce = - Velocity * FrictionalConstant
Which indicates the force direction
Deformable Body Simulation
Interaction with Newton’s cradleHandle Mirror Reflection ProblemCutting RopesHaptic FeedbackSpring EffectsUser Interface
Part II: Implement a Newton’s cradle with haptic feedback
Sensable Phantom DesktopNominal position resolution 1100 dpi 0.02
mm
Workspace 6 x 5 x 5 inches
16 x 12 x 12 cm
Backdrive friction 0.23 oz. 0.06 N
Maximum exertable force 1.80 lbf. 7.9 N
Continuous exertable force (24 hrs) 0.4 lbf. 1.7 N
Stiffness Approx. 18 lbs./in.
3.16 N/mm
Inertia (apparent mass at tip) <0.10 lbm.
<45 g
Interaction with Newton’s Cradle
Main.x3d(Update)
UI.x3dUI.py
ballCountmass
ballRadius
damping bounce
stringLength
Main.x3d: main modeling fileUI.x3d : file used for modeling UI
UI.py : to pass messages between UI components
Damping, mass, ballCount, stringLength, Bounce, ballRadius, bounce:Parameters of Newton’s cradle controlled by UI components
globalCreation
->Create()
Handle Mirror Reflection Problem
Transparent Objects Problem of Mirror Reflection
Mirror Reflection
Scene 1 Scene 2 Scene 6Scene 5Scene 4Scene 3
Problem : <PlanReflection> have a bug
Handle Mirror Reflection Problem (cont.)
Scene 1 Scene 2 Scene 6Scene 5Scene 4Scene 3
Mirror Reflection
1. decrease the size of transparent objects2. untransparentize the objects
1. recover the size of objects2. transparentize the objects
The cylinders for receiving the mouse event
Cutting Ropes
Multiple Cuts
Single Cut
Cutting Rope = Delete node <SingleAxisHingeJoint />
Haptic FeedbackMake the geometry touchable by defining a touchable surface to the geometry
<SmoothSurface/>
SmoothSurface DepthMapSurface HapticTexturesSurface MagneticSurface FrictionalSurface OpenHapticsSurface
Spring Effect SpringForce = - Distance * SpringConstant FrinctionForce = - Velocity * FrictionalConstantSpringConstant = 30FrictionalConstant = 10
Spring Effect with Mouse
Spring Effect with Haptic Device
Start: Button Event & Object is touchedEnd: Button Event
Special: the feedback of the device would be provided by node < SpringEffect >
Which indicates the force direction
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
Two stationary bodies: no sound
Play Sound (cont.)
Ball, Board, CollisionTime
Collision History…,…,……,…,……,…,……,…,……,…,…
If Bodies are new Then play soundElse if last collision time+0.01 < Current Collision timeThen Play Sound
The sound function can adjust the volume of the sound according to the intensity of the collision.
Play Sound (cont.)
Center line
Compute the subtraction of velocities on the
direction of the center line and map it to 0~1 range to represent the
intensity
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
Conclusion