http://nameless.cis.udel.edu/class_wiki/index.php?title=CISC440_F2019_HW3&feed=atom&action=historyCISC440 F2019 HW3 - Revision history2024-03-28T17:35:46ZRevision history for this page on the wikiMediaWiki 1.28.0http://nameless.cis.udel.edu/class_wiki/index.php?title=CISC440_F2019_HW3&diff=1715&oldid=prevCer: /* Required elements */2019-11-01T14:18:42Z<p><span dir="auto"><span class="autocomment">Required elements</span></span></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 14:18, 1 November 2019</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l37" >Line 37:</td>
<td colspan="2" class="diff-lineno">Line 37:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* Modify the Flocker class so that it has a ''fear_force'' that makes it flee from Predators, with high priority, when they get close enough '''[3 points]'''.  This does not necessarily need to be pure avoidance---there could be a different (e.g. zigzag) motion mode that is activated.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* Modify the Flocker class so that it has a ''fear_force'' that makes it flee from Predators, with high priority, when they get close enough '''[3 points]'''.  This does not necessarily need to be pure avoidance---there could be a different (e.g. zigzag) motion mode that is activated.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* Modify Bullet_Utils.cpp so that:</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* Modify Bullet_Utils.cpp so that:</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>** The ''velocity'' of each flocker is transferred to the corresponding rigid body when switching to physics mode '''[<del class="diffchange diffchange-inline">4 </del>points]'''  </div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>** The ''velocity'' of each flocker is transferred to the corresponding rigid body when switching to physics mode '''[<ins class="diffchange diffchange-inline">2 </ins>points]'''  </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>** A pair of the ''vertical'' sides of the box become obstacles like the ground '''[<del class="diffchange diffchange-inline">3 </del>points]'''</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>** A pair of the ''vertical'' sides of the box become obstacles like the ground '''[<ins class="diffchange diffchange-inline">2 </ins>points]'''</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Please include a README with your submission that briefly explains your approach to the Predator drawing and ''hunger_force'', as well as the Flocker ''fear_force''.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Please include a README with your submission that briefly explains your approach to the Predator drawing and ''hunger_force'', as well as the Flocker ''fear_force''.</div></td></tr>
<!-- diff cache key my_wiki:diff:version:1.11a:oldid:1714:newid:1715 -->
</table>Cerhttp://nameless.cis.udel.edu/class_wiki/index.php?title=CISC440_F2019_HW3&diff=1714&oldid=prevCer: /* Graduate students only */2019-11-01T14:17:42Z<p><span dir="auto"><span class="autocomment">Graduate students only</span></span></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 14:17, 1 November 2019</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l46" >Line 46:</td>
<td colspan="2" class="diff-lineno">Line 46:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* Modify copy_flocker_states_to_graphics_objects() and copy_graphics_objects_to_flocker_states() in Bullet_Utils.cpp so that 3-D orientation information is properly transferred back and forth between the graphics side and the physics side of the simulation.  This means that in DRAW_MODE_OBJ your models should be drawn at different orientations '''[2 points]'''</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* Modify copy_flocker_states_to_graphics_objects() and copy_graphics_objects_to_flocker_states() in Bullet_Utils.cpp so that 3-D orientation information is properly transferred back and forth between the graphics side and the physics side of the simulation.  This means that in DRAW_MODE_OBJ your models should be drawn at different orientations '''[2 points]'''</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* Draw a vertical cylinder of radius 1 in the center of the box (it should go from floor to ceiling of the box).  Make changes to both Flocker and Predator (1) ''spawning'' so that none are born inside the cylinder, and (2) ''motion behaviors'' to avoid this cylinder smoothly while still exhibiting their other natural behaviors '''[2 points]'''.  The cylinder should drawn with solid polygons (not wireframe) in a striped or checkerboard pattern with colors that contrast with the boids.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* Draw a vertical cylinder of radius 1 in the center of the box (it should go from floor to ceiling of the box).  Make changes to both Flocker and Predator (1) ''spawning'' so that none are born inside the cylinder, and (2) ''motion behaviors'' to avoid this cylinder smoothly while still exhibiting their other natural behaviors '''[2 points]'''.  The cylinder should drawn with solid polygons (not wireframe) in a striped or checkerboard pattern with colors that contrast with the boids.</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* Add the cylinder as an obstacle in the physics mode, so that it can be collided with. '''[<del class="diffchange diffchange-inline">1 point</del>]'''</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* Add the cylinder as an obstacle in the physics mode, so that it can be collided with. '''[<ins class="diffchange diffchange-inline">2 points</ins>]'''</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>This is worth '''5 points'''.  The apparent total possible of <del class="diffchange diffchange-inline">20 </del>will be multiplied by <del class="diffchange diffchange-inline">0.75 </del>to make <del class="diffchange diffchange-inline">15 </del>the maximum possible.</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>This is worth '''5 points'''.  The apparent total possible of <ins class="diffchange diffchange-inline">18 </ins>will be multiplied by <ins class="diffchange diffchange-inline">2/3 </ins>to make <ins class="diffchange diffchange-inline">12 </ins>the maximum possible.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Install instructions==</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Install instructions==</div></td></tr>
</table>Cerhttp://nameless.cis.udel.edu/class_wiki/index.php?title=CISC440_F2019_HW3&diff=1679&oldid=prevCer: Created page with "''Due Thursday, October 24'' ==Description== This assignment is intended to acquaint you with flocking-type particle systems and physics simulation using the [http://bullet..."2019-10-15T14:23:56Z<p>Created page with "''Due Thursday, October 24'' ==Description== This assignment is intended to acquaint you with flocking-type particle systems and physics simulation using the [http://bullet..."</p>
<p><b>New page</b></p><div>''Due Thursday, October 24'' <br />
<br />
==Description==<br />
<br />
This assignment is intended to acquaint you with flocking-type particle systems and physics simulation using the [http://bulletphysics.org Bullet library]. You are given template code ([https://drive.google.com/file/d/1DFa0QVdgM1aAds3zFUjjdbMn3rcgNz8u/view?usp=sharing bullet_creatures.zip] -- see instructions below) which simulates a simple system of creatures in a 3-D box. A base class ''Creature'' defines a generic boid with no specific behaviors, and the class ''Flocker'' is derived from it which instantiates [http://www.red3d.com/cwr/boids/ Reynolds' flocking rules]. When a creature leaves the box it is "wrapped" to the other side. <br />
<br />
Keyboard shortcuts for camera control:<br />
<br />
* 'a'/'d': Change longitude of "orbital" perspective outside the box<br />
* 'w'/'s': Change latitude of orbital camera view<br />
* 'z'/'c': Zoom in/out<br />
* 'x': Return to default camera view<br />
<br />
Drawing modes for rendering each flocker:<br />
<br />
* Space bar: Pause/unpause simulation<br />
* '7': Textured .obj model (DRAW_MODE_OBJ). Orientations are all identical in the template code. Choose model from "cube", "suzanne", or "banana" via command-line flag (e.g. "bullet_creatures banana")<br />
* '8': Two orthogonal "arrowhead" polygons pointing in the direction of travel (DRAW_MODE_POLY). This is the default<br />
* '9': Just X, Y, and Z axes of the local "frame" of the creature (DRAW_MODE_AXES)<br />
* '0': A colored point at the creature's current position, as well as a fading history of recent positions (DRAW_MODE_HISTORY). The color indicates the current mix of the different behavioral forces on the creature's motion, with the red channel proportional to ''separation'' force, green proportional to ''alignment'', and blue to ''cohesion''. This draw mode does not update properly in physics mode (see below)<br />
<br />
Pressing the 'p' key toggles "physics" mode. In the template code, odd-numbered presses cause the flocking to stop and all of the boids to fall under the influence of gravity until they hit the bottom of the box. Even-numbered presses remove the gravitational force and allow flocking to resume.<br />
<br />
<!--<br />
Command-line options:<br />
<br />
* -n: Number of flockers <br />
* -h: Length of position history for each flocker<br />
--><br />
Your job is to make several modifications and additions to the code, detailed below.<br />
<br />
==Required elements==<br />
<br />
* In the empty ''Predator'' class also derived from Creature:<br />
** Fill in its ''draw()'' function such that it can clearly be distinguished from the flockers. This can be as simple as copying flocker drawing code and changing the color scheme (For this and the next item you will also have to make changes in main.cpp to construct ONE Predator object, draw it, and update it) '''[2 points]'''. <br />
** Fill in its ''update()'' function (and make any other necessary modifications to member variables and the constructor) so that it chases flockers based on a ''hunger_force'' '''[3 points]'''<br />
* Modify the Flocker class so that it has a ''fear_force'' that makes it flee from Predators, with high priority, when they get close enough '''[3 points]'''. This does not necessarily need to be pure avoidance---there could be a different (e.g. zigzag) motion mode that is activated.<br />
* Modify Bullet_Utils.cpp so that:<br />
** The ''velocity'' of each flocker is transferred to the corresponding rigid body when switching to physics mode '''[4 points]''' <br />
** A pair of the ''vertical'' sides of the box become obstacles like the ground '''[3 points]'''<br />
<br />
Please include a README with your submission that briefly explains your approach to the Predator drawing and ''hunger_force'', as well as the Flocker ''fear_force''.<br />
<br />
==Graduate students only==<br />
<br />
* Modify copy_flocker_states_to_graphics_objects() and copy_graphics_objects_to_flocker_states() in Bullet_Utils.cpp so that 3-D orientation information is properly transferred back and forth between the graphics side and the physics side of the simulation. This means that in DRAW_MODE_OBJ your models should be drawn at different orientations '''[2 points]'''<br />
* Draw a vertical cylinder of radius 1 in the center of the box (it should go from floor to ceiling of the box). Make changes to both Flocker and Predator (1) ''spawning'' so that none are born inside the cylinder, and (2) ''motion behaviors'' to avoid this cylinder smoothly while still exhibiting their other natural behaviors '''[2 points]'''. The cylinder should drawn with solid polygons (not wireframe) in a striped or checkerboard pattern with colors that contrast with the boids.<br />
* Add the cylinder as an obstacle in the physics mode, so that it can be collided with. '''[1 point]'''<br />
<br />
This is worth '''5 points'''. The apparent total possible of 20 will be multiplied by 0.75 to make 15 the maximum possible.<br />
<br />
==Install instructions==<br />
<br />
The download will unzip to a directory called <tt>bullet_creatures</tt>. This directory should be placed in the OpenGL tutorials hierarchy at the same level as the other tutorial and playground directories. To compile the code in it, you will need to target the bullet_creatures directory. <br />
<br />
On Ubuntu, this meant modifying <tt>CMakeLists.txt</tt> and running <tt>cmake ..</tt> one time from the <tt>build</tt> directory. Then <tt>make bullet_creatures</tt> and <tt>launch-bullet_creatures.sh</tt> should work. Here is a link to the modified [https://drive.google.com/file/d/1rvN4NOCN40xSpAzoqPy4IdLy1pNXHAUZ/view?usp=sharing CMakeLists.txt] -- let me know if you are still confused about what changes to make.<br />
<br />
<!--On Piazza, please post what you need to do for XCode and Visual Studio if it is non-trivial.--><br />
==Submission instructions==<br />
<br />
Submit a zipped version of your modified bullet_creatures directory. Clean it up before submission -- it should only contain .cpp, .hh, and shader files.</div>Cer