First Tutorial - Falling cube


Published on

Published in: Technology, Spiritual
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

First Tutorial - Falling cube

  1. 1. Tutorial Falling CubeSchool of Electrical Engineering & Computer Science, 1National University of Sciences & Technology, Pakistan
  2. 2. Run Sofa Modeler• After installing sofa• Go to the bin folder at installed location and double click the Modeler Muhammad Muddassir Malik 2
  3. 3. Modeler• After double clicking a Modeler a GUI window will open up as shown below, with sofa components on its left side and scene graph on its right. Muhammad Muddassir Malik 3
  4. 4. • There you will see root node already added. – This node will control the global behavior of the simulation. – Majority of them are used to control the Collisions and the responses between two or more objects during the simulation. • In our current exercise there is only one object so all of them are not needed. – All new nodes will be added under it and consequently properties added to it will effect upon all other nodes. Muhammad Muddassir Malik 4
  5. 5. Deleting the unwanted nodes• Delete all of the already placed properties root node by selecting them and pressing the delete button (as they are not required in our current exercise) Muhammad Muddassir Malik 5
  6. 6. Adding a node• Then you have to add a node under whom whole properties for a physical entity is going to be placed.• For this you have to drag and drop GNode (placed almost at left bottom of the Modeler under Sofa Components) on Root node. Muhammad Muddassir Malik 6
  7. 7. Adding a node Muhammad Muddassir Malik 7
  8. 8. Name the node• To name the node double click on the node and overwrite your desired name in object name blank of property 1/2 tab. In this example we will name it cube and then press the ok button. Muhammad Muddassir Malik 8
  9. 9. Mesh topology• First of all to define and/or load the topology our object’s mesh we have to add the MeshTopology component.• MeshToplogy define the topology and the relation of one vertices with the other.• Drag and Drop MeshTopology (lying in Topology drop down of the sofa components) on the cube node. Muhammad Muddassir Malik 9
  10. 10. Mesh topology Muhammad Muddassir Malik 10
  11. 11. Loading the Mesh• Now we need to load and link the mesh of our object.• Three easy ways to link and/or load the mesh with the topology are – Load the mesh with in MeshTopolgy object.(practiced in this exercise) – Link the already Loaded Mesh (loaded through a loader e.g. MeshObjLoader) – Define the position of vertices in the mechanical object.• To load the mesh file double click the MeshTopolgy Object and it will open up a new Window.• In Property 1/3, under file topology Click on the three dots like … in front filename of the object and browse it to the location of your intended object file (which is C:sofasharemeshcube.obj in our current case). Muhammad Muddassir Malik 11
  12. 12. Loading the Mesh Muhammad Muddassir Malik 12
  13. 13. Mechanical state• To define the mechanical properties and degree of freedom you will have to add mechanicalObject. – Here in Mechanical state of Rigid type object can only act in a non-deformable way. – While Vec3d type objects could act in both deformable and non-deformable way. – LaparoscopicRigid3 act same as Rigid type but with a pivot in its center. – Here 3d means three dimensional degrees of freedom with precision of double and 3f means 3 dimensional degree of freedom with precision of float. Muhammad Muddassir Malik 13
  14. 14. Adding MechanicalObject• Click Mechanical State to open the drop down – there you will find another drop down on the right side • click to open that dropdown and select Vec3d from it• Drag and drop MechanicalObject with Vec3d option on the node present in the scene graph. Muhammad Muddassir Malik 14
  15. 15. Adding Mass to the object• To define the mass of the object you have to add a Mass component.• Click on the Mass option (Just above Mechanical State) in sofa components to have a look at the available mass options in a drop down form.• Select the Uniform Mass (simplest) of Vec3d for the current exercise others will be used in relatively complex type of exercises. – Make sure it is of same type as of MechanicalObject which is Vec3d in our current case.• Drag and drop it on the cube node. Muhammad Muddassir Malik 15
  16. 16. Adding Mass to the object Muhammad Muddassir Malik 16
  17. 17. Adding Solvers• Now to solve all of the equations running behind the intended simulation we have to add some mathematical solver.• For the instance you will have to add an ode solver followed by a linear solver for our current exercise.• Resultant of our ODE solver are the Linear equations which are further efficiently solved by Linear Solver.• For that you will have to drag and drop EulerImplicitSolver from ode solver and CGLinearSolver from Linear Solver. Muhammad Muddassir Malik 17
  18. 18. Adding Solvers Muhammad Muddassir Malik 18
  19. 19. Visual node• Afterwards we will put another GNode in our cube Node to handle the graphical display.• For that we will again drag and drop GNode on cube node and name it cubeVisual. Muhammad Muddassir Malik 19
  20. 20. Visual Model• We will now have to place a graphical display modeler in the node.• For that we will drag and drop the OglModel from the VisualModel dropdown.• In the property 2/4 of OglModel we will browse file mesh the location of the intended show model which is C:sofasharemeshcube.obj in our current case. Muhammad Muddassir Malik 20
  21. 21. OglModelMuhammad Muddassir Malik 21
  22. 22. Mapping• Now to map our graphical model on the mechanical object we will use a mapping function.• For this purpose you will have to drag and drop BarycentricMapping from the mapping dropdown of the sofa component to the Visual Node. Muhammad Muddassir Malik 22
  23. 23. Adding Barycentric Mapping Muhammad Muddassir Malik 23
  24. 24. Run sofa• Now you are done with your development of first exercise i.e. falling cube due to gravitational force.• Click the run in sofa button, lying on the to middle of the modeler screen. Muhammad Muddassir Malik 24
  25. 25. Animate• It will open up another GUI window.• There you have to click the animate button to run the animation. Muhammad Muddassir Malik 25
  26. 26. VideoMuhammad Muddassir Malik 26