EECS 4491 /5391: Assignment 2
project | assignment | math代写 – 该题目是值得借鉴的math方面代写的题目
Part1: Spring Mass system [Marks 25]
Develop a spring mass system and a corresponding simulator that support an arbitrary number of particles. The particles can be connected with springs in arbitrary ways and are subject to gravity. There is a flat ground oriented along the y-axis that you should model using penalty forces. The simulator should support the following integration methods: Forward Euler, Symplectic Euler, and Verlet.
You must implement the interface commands below. None of these commands need to work after the user has started the simulation. Additionally, during grading these commands will only be called (during a particular invocation of the application) in the order in which they are given here.
- system <sys_name> dim
This command initializes the particle system to hold up to the given number of particles. Particles may be initialized to the origin of the world, or may not appear until added by the next command.
- system <sys_name> particle
This command sets a position, mass and velocity for a given particle.
- system <sys_name> all_velocities
This command sets the velocity of all particles.
- simulator <sim_name> link
This links the simulator to a particular particle system, and initializes it to work with a given number of springs.
- simulator <sim_name> spring
This sets up a given spring. If the restlength is a negative number, the system should automatically set the restlength of the spring to the distance between the corresponding particles at the time the command is given.
- simulator <sim_name> fix
This command nails particle
- simulator <sim_name> integration <euler|symplectic|verlet>
This changes the integration technique used by the given simulator and sets the time step of the integration.
- simulator <sim_name> ground
Sets the parameters of the penalty forces applied to particles that try to go underground.
- simulator <sim_name> gravity
Sets the acceleration due to gravity, in unit length per unit time squared.
- simulator <sim_name> drag
Sets the global drag (friction) coefficient (Fi = -kdrag vi). The command expects a positive number
-  Particle system.
-  Script commands.
-  Forward Euler.
-  Verlet.
-  Symplectic Euler.
-  Ground forces
-  Gravity
-  Locking of a particles position.
-  Particle and spring drawing.
- [Penalty] [-2] Provide a readme.txt file that explains in detail which of the requirements you have implemented, and what does not work.
- Call your system partSys and the simulator partSim so we can use the same scripts to test the assignment.
Bonus: Interaction [Marks 5]
Use the pointer to drag particles around. Pressing and holding down the left mouse button should insert a zero length spring in the system that drags the corresponding particle to the pointers position. Assume that the desired z value is the z-position of the selected particle at the time it was selected, and that the scene is not rotated, i.e. the xy-plane is aligned with the screen.
- Make sure you follow the exact syntax specified in the assignment. We will be using the same set of scripts to test your code. Notice that the scripts create one additional spring. That spring can be used for the interaction, so you do not have to instantiate one at run time. However, you are free to do so if you wan.t
- There is a lot of code already provided. You do not need to write your own vector, or quaternion libraries. However, if you have one you may use it.
- You may NOT use any other existing code.
- Do not use spaces in file names.
- If the code doesnt compile or doesnt run you will get 0 points. No partial points will be given.
- If your code doesnt parse correctly the input files you will get zero points. 7. Please follow the same guidelines of assignment 1 for the submission through moodle. In particular, remember to write a readme file with a description of what you’ve done, what’s missing, or any extra features that you may have added. We will test your projects primarily with the scripts that are posted online, so make sure it works for those. As usual we will NOT test your code with malformed or nonsensical commands. If you couldn’t get your project to work with our scripts, you may submit scripts of your making that do something we can look at (let us know in the readme though). Do this only as a LAST RESORT!
- use an appropriate time step. If the simulation explodes use 0.0001 for debugging reasons. When everything is working fine, the time step should be in the range (0.001, 0.01), preferably closer to 0.01.
- try to draw points using GL_POINTS instead of drawing spheres for each particle. You can even add an if-statement to use points or spheres depending on how many particles there are.
- double-check that you don’t accidentally have a memory leak and that you are not re-allocating variables that do not need to be re-allocated.
- double-check that you don’t accidentally copy large amounts of data unnecessarily.
- double-check you don’t accidentally have an O(n^2) or worse algorithm. You should be able to do things with just a few O(n) loops per time step. In particular, you should NOT be checking for the "closest particle to the mouse" every time step.
Another possible reason for performance problems is console output. Writing to the console can be expensive. Commenting out your console output may improve performance.