1. Homepage
  2. Programming
  3. CSCI-1200 Data Structures — Fall 2022 Homework 10 — Priority Queues for Mesh Simplification

CSCI-1200 Data Structures — Fall 2022 Homework 10 — Priority Queues for Mesh Simplification

Contact Us On WeChat
USRensselaer Polytechnic InstituteCSCI-1200CSCI1200Data StructuresPriority Queues for Mesh SimplificationC++

CSCI-1200 Data Structures — Fall 2022 Homework 10 — Priority Queues for Mesh Simplification CourseNana.COM


CourseNana.COM


CourseNana.COM

In this assignment we will work with a 2D mesh or graph of vertices, edges, and triangles. At the vertices we store colors loaded from an image in .ppm format. The goal in this assignment is to reduce the total size of the mesh, but still provide a reasonable approximation of the original image. The images below show meshes with approximately 80,000 triangles, 10,000 triangles, and 1,000 triangles (from left to right), displayed with and without the edges between the triangles drawn with white lines. Be sure to read the entire handout before beginning the assignment. CourseNana.COM

To perform this simplification, we will use a standard mesh processing operation, the edge collapse, which is illustrated below. First, we identify an edge in the mesh that should be removed (drawn in blue). Next, we locate the two triangles on either side of that edge (drawn in light blue), and remove these triangles from the mesh. Finally, we locate all triangles using exactly one of the two endpoints of the edge and change that endpoint coordinate to the midpoint of the collapsed edge. Note: We reuse one of the endpoints of the collapsed edge, while the other is deleted. The position of the reused vertex is edited. After the edge collapse is finished, the mesh has 1 fewer vertex, 2 fewer triangles, and 3 fewer edges (the blue edge and 2 green edges are removed). Note that if the edge to be collapsed lies on the boundary of the image/mesh, the collapse will result in a mesh with 1 fewer vertex, 1 fewer triangle, and 2 fewer edges. CourseNana.COM


CourseNana.COM

We provide a significant amount of code for this assignment. Be sure to review all of the provided code before starting your implementation. Search for the word “ASSIGNMENT” within these files to see the sections you need to fill in. The provided code should compile and run on your machine with no edits. The program has reasonable default values for all parameters, but you can override the defaults by providing any or all of these command line arguments (in any order): CourseNana.COM

-image <filename> -dimensions <cols> <rows> -target <count>
-shortest
-random
-color
-preserve_area
-debug
-linear
-priority_queue
CourseNana.COM

The image file must be a .ppm
The size of the grid for the original mesh
The target number of triangles after simplification
Choose the shortest edge to collapse
Choose a random edge to collapse
Choose an edge collapse with least impact on the overall appearance Disallow edge collapses that affect the total area of the mesh
Save intermediate meshes & perform extra error checking
Perform linear sweep over all edges to find the best edge collapse Use a priority queue to find the best edge collapse
CourseNana.COM

Your first task is to complete the implementation of the edge collapse. The provided code (which should be rewritten/replaced) simply deletes the two triangles and leaves a hole. This placeholder code will run for at least a few collapses, but if you enable debugging and the extra error checking this placeholder code will eventually crash with an error. Make sure your complete and correct implementation of the edge collapse works robustly, and can aggressively simplify a large mesh down to a small number of triangles. The Mesh::Check function (and later the PriorityQueue::check_heap function) are used to sanity check the state of your data as you implement and debug. Use a memory debugger and make sure you have no errors or memory leaks. CourseNana.COM

Once collapse is working, you can also experiment with the -preserve area command line option. Certain edges should not be collapsed because they change the shape of the boundary of the mesh (as shown below left and middle), and decrease the overall area. The image below right visualizes these illegal edges in red. Note that most of these edges are along the boundary of the mesh, but sometimes they appear in the interior. Sometimes an edge collapse will cause triangles in the neighborhood to twist or flip upside down and overlap other triangles. These situations can be detected by calculating the total area before & after the proposed collapse or checking the clockwise/counter-clockwise orientation of the vertices. We provide finished code to detect illegal edge collapses. CourseNana.COM


CourseNana.COM

In performing an edge collapse, a small neighborhood of the mesh is modified. Triangles change area and edges change length. In the diagrams above we see that the green edges (the edges that were touching one of the endpoints of the collapsed edge) change length. The orange edges (which share a vertex with one or more of the green edges) do not change length; however, their status as legal or illegal may change. After performing an edge collapse, you should recalculate both the length and the legal/illegal status (stored as Edge class member variables for efficiency) of the green & orange edges. Carefully study the Mesh, Triangle, Edge, and Vertex classes for helper functions that will help you identify these edges efficiently (without doing an expensive linear sweep through all edges in the mesh!). CourseNana.COM

Note: The use of a priority queue/heap for this problem is somewhat tricky because the length and/or legal/illegal status of an edge will change as the algorithm progresses. Therefore, we cannot use the STL Priority Queue and we instead need a custom PriorityQueue implementation that allows fast access to elements in the middle of the priority queue/heap. You’ll need to complete the implementation of several functions in this file. CourseNana.COM

Viewing the Output Meshes CourseNana.COM

The program outputs .html files using SVG (Scalable Vector Graphics) format. You should be able to view these files in a modern web browser on your laptop and use the small checkboxes at the top to toggle on & off the visualizations of the edges. CourseNana.COM

Extra Credit: Prioritizing Edge Collapse by Color CourseNana.COM

Explore alternate edge collapse criteria that consider not just the length and legality of a collapse, but also determine the relative impact the collapse will have on the overall appearance of the image by analyzing the colors of the vertices. Implement this variation with the optional -color command line option. Discuss the quality of your results in your README.txt and include screenshots of your more impressive results. CourseNana.COM

Get Expert Help On This Assignment

Scan above qrcode with Wechat

US代写,Rensselaer Polytechnic Institute代写,CSCI-1200代写,CSCI1200代写,Data Structures代写,Priority Queues for Mesh Simplification代写,C++代写,US代编,Rensselaer Polytechnic Institute代编,CSCI-1200代编,CSCI1200代编,Data Structures代编,Priority Queues for Mesh Simplification代编,C++代编,US代考,Rensselaer Polytechnic Institute代考,CSCI-1200代考,CSCI1200代考,Data Structures代考,Priority Queues for Mesh Simplification代考,C++代考,UShelp,Rensselaer Polytechnic Institutehelp,CSCI-1200help,CSCI1200help,Data Structureshelp,Priority Queues for Mesh Simplificationhelp,C++help,US作业代写,Rensselaer Polytechnic Institute作业代写,CSCI-1200作业代写,CSCI1200作业代写,Data Structures作业代写,Priority Queues for Mesh Simplification作业代写,C++作业代写,US编程代写,Rensselaer Polytechnic Institute编程代写,CSCI-1200编程代写,CSCI1200编程代写,Data Structures编程代写,Priority Queues for Mesh Simplification编程代写,C++编程代写,USprogramming help,Rensselaer Polytechnic Instituteprogramming help,CSCI-1200programming help,CSCI1200programming help,Data Structuresprogramming help,Priority Queues for Mesh Simplificationprogramming help,C++programming help,USassignment help,Rensselaer Polytechnic Instituteassignment help,CSCI-1200assignment help,CSCI1200assignment help,Data Structuresassignment help,Priority Queues for Mesh Simplificationassignment help,C++assignment help,USsolution,Rensselaer Polytechnic Institutesolution,CSCI-1200solution,CSCI1200solution,Data Structuressolution,Priority Queues for Mesh Simplificationsolution,C++solution,