Question: Please have answer in C programming, will thumbs up! (3) Examine the structs defined in polygonSet.h. Make sure that you understand how they fit together.

Please have answer in C programming, will thumbs up!

Please have answer in C programming, will thumbs up! (3) Examine thestructs defined in polygonSet.h. Make sure that you understand how they fittogether. A Polygon contains vertices where each Vertex links to the nextvertex along the polygon boundary. The polygon keeps track of the very

(3) Examine the structs defined in polygonSet.h. Make sure that you understand how they fit together. A Polygon contains vertices where each Vertex links to the next vertex along the polygon boundary. The polygon keeps track of the very first vertex, as well as the last one that was added (as it is being constructed). The polygon also keeps a pointer to the next polygon in the PolygonSet. Lastly, a PolygonS et just maintains a first and last polygon. You need to adjust the code in the compute Boundaries) function so that it dynamically creates a polygon p each time that it finds a part in the image to start tracing. As seen in the code, this is when it finds a '1' pixel with a 0' to its left. This point, at location [y|[x] in the grid, will become the first vertex of the polygon, and it is marked as a '2' in the grid. Note that the grid is arranged as [row[column)]... that is why the code uses grid[y][x] as opposed to grid [x][y]. The traceWholeBorder) function will require that newly-created polygon p, and it will then trace out the remainder of the part's boundary while adding vertices to this polygon as it goes. Once the traceWholeBorder() function completes, the polygon should be completed. So, you will need to add this polygon to the polvgon set pSet. Make sure to handle the special case where this is the first polygon in the set. You will also need to go into the traceWholeBorder() function to make sure that you are adding dynamically-allocated vertices to the polygon as each border point in the grid is found (identified by a '2' being placed there) Compute the boundaries of the obstacles in the grid. Add a polygon to pSet for each completed border. Polygon *p / This will point to each polygon that you will trace for( int ys]; y

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 Databases Questions!