COMP2401 : Create an Obstacles.h File - Dynamically-Allocated Array of Obstacle - Computer Science Assignment Help

Download Solution Order New Solution
Assignment Task :

• You will need to create an obstacles.h file that defines the following typedefs: 

 An Obstacle type that maintains the x, y, width and height of a rectangular object.  Examine the display.c code to see how these attributes must be defined. 

 A Vertex type that maintains the x,y coordinate of the vertex as well as a linked list of  neighbouring vertices. That is, each vertex keeps a linked list of vertices that it  connects to in the graph. You should keep pointers to the first neighbour in the list (i.e.,  the head) and the last neighbour in the list (i.e., the tail). The vertex should also keep a  pointer to the obstacle that it belongs to (so that we can ask later if two vertices are  corners on the same obstacle). Again, see the display.c code for how some of these  vertex attributes must be defined. Note that the neighbours are actually Neighbour types … not Vertex types.

A Neighbour type that represents an item in the linked list of vertex neighbours. It  should keep a pointer to a Vertex that it represents, as well as a pointer to the next  Neighbour in the list. 

 Finally, an Environment type should be created that maintains a pointer to a  dynamically-allocated array of Obstacle types and the number of obstacles that have  been allocated. It should also maintain a pointer to a dynamically-allocated array of  Vertex types and the number of vertices that have been allocated. You can check the  test program and display.c code to make sure that you are defining this properly. 

 

You may add other things to this header file as/if you need them. 

• Create all remaining necessary functions and procedures in a pathPlanner.c file. The  functions required are indicated by the code in the test program. Note that each time the test  program displays something, it waits for the user to press ENTER. You may want to write  these functions in steps … by starting with the commenting out of code that you do not want to  test. So, you can first make sure that all your vertices are created properly … then your  complete graph … and finally your visibility graph. You should write the code as efficiently as  possible. You MUST NOT hardcode any arrays. The vertices of the environment MUST be  allocated dynamically, although the size will always be 4 times the number of obstacles. As  for the neighbours of a vertex …they must be created individually … you may NOT create an  array of neighbours at any time … they MUST be represented as a linked-list. 

• Complete your code as necessary so that a call to valgrind returns 0 errors and 0 memory  leaks. Make sure that your code is efficient and that you are making good use of your written  functions. 

 

This Computer Science Assignment has been solved by our Computer Science  Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.