Question: 6 0 - 8 0 : Extending the previous work with spring based ( Hooke s Law ) real - time dynamic simulation to self

60-80: Extending the previous work with spring based (Hookes
Law) real-time dynamic simulation to self-sort the data
representations, thereby showing trading groups and relationships
as part of a resolved un-directed graph. Spring Based Simulation
The simulation defined within this assignment
is a simple network of springs; evaluated once
for each of the simulation progressions.
These use the basic principles of Hookes law
(spring force derived from extension) and
Newtons Laws of Motion. Spring Algorithm (1)
For each body (loop through the nodes). Reset
the resultant force (f) to zero
Spring Algorithm (2)
Loop through each of the arcs.
Calculate the direction vector between the two nodes forming the arc
(d) as a normalised direction vector and the distance between the two
nodes (l).
Calculate the spring force (Hookes Law =
) as a vector and accumulate these within the
nodes affected (countries at either end).
Calculate the vector force (f) for each node (remember one of the
nodes will have a positive force and the other will have a negative
force according Newtons 3rd law of motion) but multiplying the force
(scalar)+-f by the direction vector (d).
Add the calculated for vectors to their resultant force vectors for each
respective node.
Spring Algorithm (3)
Loop through each of the nodes (countries) to:
Calculate the acceleration due to the spring force (vector): Newtons
Second Law of Motion = where f is the nodes resultant force
vector calculated in the previous loop through the arcs.
Calculate the motion of the body based on its velocity, the time frame
for the motion and the acceleration: General Equation of Motion
(newtons 1st law of motion)
Add the motion to the current body position: =+
Calculate the new velocity of the body =/
Apply damping =(1.0 0
1)
Calculate kinetic energy for body and accumulate to global record
(optional): write the easy coding for c++. #include #include #include #include #include #include #include #include #include #include #include #include #include #include "raaConstants.h" #include "raaParse.h" #include "raaControl.h"// NOTES // look should look through the libraries and additional files I have provided to familarise yourselves with the functionallity and code. // The data is loaded into the data structure, managed by the linked list library, and defined in the raaSystem library. // You will need to expand the definitions for raaNode and raaArc in the raaSystem library to include additional attributes for the siumulation process // If you wish to implement the mouse selection part of the assignment you may find the camProject and camUnProject functions usefull // core system global data raaCameraInput g_Input; // structure to hadle input to the camera comming from mouse/keyboard events raaCamera g_Camera; // structure holding the camera position and orientation attributes raaSystem g_System; // data structure holding the imported graph of data - you may need to modify and extend this to support your functionallity raaControl g_Control; // set of flag controls used in my implmentation to retain state of key actions int layoutView =1; float cvY1=0.0f, cvY2=0.0f, cvY3=0.0f, cvY4=0.0f, cvY5=0.0f, cvY6=0.0f; //Stores the Y value of continents float wvY1=0.0f, wvY2=0.0f, wvY3=0.0f; //Stores the Y value of the worlds float upperNode =45.0; //A value assigned to a variable to structure the nodes aboev each other float newPosition[3]; //An array to store the new node position int countTimes =0; // global var: parameter name for the file to load const static char csg_acFileParam[]={"-input"}; // global var: file to load data from char g_acFile[256]; // core functions -> reduce to just the ones needed by glut as pointers to functions to fulfill tasks void display(); // The rendering function. This is called once for each frame and you should put rendering code here void idle(); // The idle function is called at least once per frame and is where all simulation and operational code should be placed void reshape(int iWidth, int iHeight); // called each time the window is moved or resived void keyboard(unsigned char c, int iXPos, int iYPos); // called for each keyboard press with a standard ascii key void keyboardUp(unsigned char c, int iXPos, int iYPos); // called for each keyboard release with a standard ascii key void sKeyboard(int iC, int iXPos, int iYPos); // called for each keyboard press with a non ascii key (eg shift) void sKeyboardUp(int iC, int iXPos, int iYPos); must be incldue in this coding. please give me the easy solution?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!