13.07.2015 Views

Algorithms for the visualization and simulation of mobile ad hoc and ...

Algorithms for the visualization and simulation of mobile ad hoc and ...

Algorithms for the visualization and simulation of mobile ad hoc and ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

10Terrain ClassThe Terrain class is <strong>the</strong> primary interface through which users interact with <strong>the</strong>terrain data. The class presents <strong>the</strong> data as a large matrix where each cell containsan elevation value, measured in meters from sea level. The origin <strong>of</strong> this matrix isdefined to be <strong>the</strong> lower left corner.The boundaries <strong>of</strong> this matrix are defined intwo ways. First <strong>the</strong> bounding box can be accessed as a set <strong>of</strong> latitude <strong>and</strong> longitudecoordinates specifying <strong>the</strong> lower left <strong>and</strong> upper right corners <strong>of</strong> <strong>the</strong> bounding box.The second method is to simply return <strong>the</strong> width <strong>and</strong> height <strong>of</strong> <strong>the</strong> area covered inmeters. Accessing <strong>the</strong> grid in this manner hides <strong>the</strong> details about <strong>the</strong> resolution <strong>of</strong><strong>the</strong> terrain data since different file <strong>for</strong>mats have differing resolutions.Accessing Terrain ElevationsKnowing <strong>the</strong>se st<strong>and</strong>ards <strong>for</strong> referencing coordinateswithin <strong>the</strong> terrain classes’ grid, users can access <strong>the</strong> actual elevation data inseveral different ways. The first method allows <strong>the</strong>m to sample a single point <strong>of</strong> elevationat any coordinate within <strong>the</strong> defined grid. If <strong>the</strong> position <strong>the</strong>y chose to sampledoes not contain a discrete elevation value, one will be interpolated using bilinearinterpolation.The second method <strong>of</strong> access allows <strong>the</strong> users to extract a sub-matrix <strong>of</strong> elevationdata. The user specifies <strong>the</strong> lower left <strong>and</strong> upper right coordinates <strong>of</strong> <strong>the</strong> boundingbox <strong>of</strong> <strong>the</strong> desired sub-matrix. If <strong>the</strong> coordinates <strong>of</strong> <strong>the</strong> users bounding box does notfall onto discrete values in <strong>the</strong> elevation matrix, <strong>the</strong> bounding box will be enlargedto <strong>the</strong> nearest set <strong>of</strong> discrete points that encompass <strong>the</strong> users original coordinates.Figure 2.6 provides an illustration <strong>of</strong> this mechanism. Using this method <strong>of</strong> access,no interpolation will be done, only discrete elevation values will be returned.The third method <strong>of</strong> access allows <strong>the</strong> users to generate terrain pr<strong>of</strong>iles along ei<strong>the</strong>ra horizontal or vertical line. The vertical pr<strong>of</strong>ile takes two coordinates that define a

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!