The purpose of this exercise is to generalize this algorithm to finding the clos
ID: 3851829 • Letter: T
Question
The purpose of this exercise is to generalize this algorithm to finding the closest two points in a 3-dimensional space. For example, an air traffic controller has responsibility for a number of aircraft and each aircraft is represented by an X-coord, a Y-coord and a Z-coord. This exercise will deal with a 3-dimensional array of coordinates, representing aircraft and will, for each aircraft in the list, find its 3 nearest neighboring aircraft. The result will be a list of 12 aircraft, each followed by the distances to each of its 3 nearest neighbors. The fundamental declaration of the array will reflect the fact that the area around an airport is divided into geographically-based sectors in order to keep the number of aircraft assigned to any one controller to a minimum. So each aircraft will have 3 levels of identifying values, a sector number from 0 to 4, an aircraft ID number from 0 to 11 and 3 coordinates representing its latitude, longitude and altitude. The array declaration will resemble the following: int [] [] [] ac = new int [4][12][3]; where the first subscript (0..3) is a sector number, the second subscript is the aircraft ID number (0..11) per sector and the third subscript values are the location identifiers 0-latitude, 1-longitude and 2-altitude of the ac. Lat and long will be integer values between 1 and 128 while altitude will be an integer value between 1 and 350 (representing hundreds of feet). Thus a variable such as ac[2][7][2] will contain the number-2 value (altitude) for the number-7 aircraft in the number-2 sector. The values of each subscript will be generated randomly since there will be 4 sectors of 12 aircraft each and 3 location values for each. Thus there will be 144 location values (48 latitudes, 48 longitudes and 48 altitudes) and 144 subscript values to locate the data in the array. Since there are 4 sectors, no single controller will care about the aircraft in neighboring sectors so the program will prompt the user for a sector number between 1 and 4 (which will be converted to a subscript between 0 and 3). The result should be a list of text-lines, resembling the following: Sector 2 Ac – 1 Lat – 17, Long – 46, Alt – 140 Near01 Ac – 6 Lat – 17, Long – 42, Alt – 140 Near02 Ac – 11 Near03 Ac – 4 Ac – 2
Explanation / Answer
Algorithm:
Hence, this is the algorithm for finding the closest two points in the 3D space .
Please rate the answer if it helped......Thankyou
Hope it helps.....
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.