#include <heightfield.h>
Public Member Functions | |
| HeightField () | |
| Constructs the heightfield. | |
| HeightField (unsigned int numCols, unsigned int numRows) | |
| Constructs the heightfield while at the same time allocated memory to store data of the desired number of rows and columns. | |
| void | Allocate (unsigned int numCols, unsigned int numRows) |
| Allocates enough memory to store data of the desired number of rows and columns. | |
| short | GetHeight (unsigned int c, unsigned int r) const |
| Gets the height stored at the given row and column. | |
| float | GetInterpolatedHeight (float x, float y) const |
| Gets a bi-linearly interpolated height value from the specified height field. | |
| void | SetHeight (unsigned int c, unsigned int r, short newHeight) |
| Sets the height stored at the given row and column. | |
| const short * | GetHeightFieldData () const |
| Gets a pointer directly to the array of height values. | |
| unsigned int | GetNumColumns () const |
| Gets the number of columns in this heightfield. | |
| unsigned int | GetNumRows () const |
| Gets the number of rows in this heightfield. | |
| osg::Image * | ConvertToImage () const |
| Converts this heightfield into a valid Image. | |
| void | ConvertFromImage (const osg::Image &image) |
| Converts the specified image into a valid heightfield. | |
| void | ConvertFromRaw (unsigned int numColumns, unsigned int numRows, short *heightData) |
| Copies a chunk of raw data values into this heightfield. | |
| void | SetXInterval (float interval) |
| void | SetYInterval (float interval) |
| float | GetXInterval () const |
| float | GetYInterval () const |
Protected Member Functions | |
| virtual | ~HeightField () |
| Destroys the memory in use by the heightfield. | |
The elevation data is 16-bit short values, therefore, the elevation can be a maximum of SHRT_MAX (32767) and a minimum of SHRT_MIN (-32768) with zero equaling "flat" or at sea-level. This range should satisfy the needs of most applications. For example, the highest peak in the world is located on Mount Everest which sits at 8850 meters or 29,035 feet.
| dtTerrain::HeightField::HeightField | ( | ) |
Constructs the heightfield.
Note, the data is invalid at this point until is gets allocated.
| dtTerrain::HeightField::HeightField | ( | unsigned int | numCols, | |
| unsigned int | numRows | |||
| ) |
Constructs the heightfield while at the same time allocated memory to store data of the desired number of rows and columns.
| numCols | Number of columns stored in the heightfield. | |
| numRows | Number of rows stored in the heightfield. |
| dtTerrain::HeightField::~HeightField | ( | ) | [protected, virtual] |
Destroys the memory in use by the heightfield.
| void dtTerrain::HeightField::Allocate | ( | unsigned int | numCols, | |
| unsigned int | numRows | |||
| ) |
Allocates enough memory to store data of the desired number of rows and columns.
Any exising data is destroyed before allocating room for the new data.
| numCols | Number of columns stored in the heightfield. | |
| numRows | Number of rows stored in the heightfield. |
| HeightFieldException::OUT_OF_BOUNDS | if either the number of rows or columns is equal to zero. |
| short dtTerrain::HeightField::GetHeight | ( | unsigned int | c, | |
| unsigned int | r | |||
| ) | const |
Gets the height stored at the given row and column.
| c | Column in the heightfield. | |
| r | Row in the heightfield. |
| HeightFieldException::OUT_OF_BOUNDS | if c or r is greater than the number of rows or columns in the heightfield. |
| float dtTerrain::HeightField::GetInterpolatedHeight | ( | float | x, | |
| float | y | |||
| ) | const |
Gets a bi-linearly interpolated height value from the specified height field.
| void dtTerrain::HeightField::SetHeight | ( | unsigned int | c, | |
| unsigned int | r, | |||
| short | newHeight | |||
| ) |
Sets the height stored at the given row and column.
| c | Column in the heightfield. | |
| r | Row in the heightfield. |
| HeightFieldException::OUT_OF_BOUNDS | if c or r is greater than the number of rows or columns in the heightfield. |
| const short* dtTerrain::HeightField::GetHeightFieldData | ( | ) | const [inline] |
Gets a pointer directly to the array of height values.
| unsigned int dtTerrain::HeightField::GetNumColumns | ( | ) | const [inline] |
Gets the number of columns in this heightfield.
| unsigned int dtTerrain::HeightField::GetNumRows | ( | ) | const [inline] |
Gets the number of rows in this heightfield.
| osg::Image * dtTerrain::HeightField::ConvertToImage | ( | ) | const |
Converts this heightfield into a valid Image.
| void dtTerrain::HeightField::ConvertFromImage | ( | const osg::Image & | image | ) |
Converts the specified image into a valid heightfield.
| image | The image to convert. |
| void dtTerrain::HeightField::ConvertFromRaw | ( | unsigned int | numColumns, | |
| unsigned int | numRows, | |||
| short * | heightData | |||
| ) |
Copies a chunk of raw data values into this heightfield.
Space for the data is automatically allocated so there is no need to call Allocate() on the heightfield first.
| numColumns | Number of columns in the data. | |
| numRows | Number of rows in the data. | |
| heightData | Pointer to the actual data values. If this is NULL, no action is taken. |
| void dtTerrain::HeightField::SetXInterval | ( | float | interval | ) | [inline] |
| void dtTerrain::HeightField::SetYInterval | ( | float | interval | ) | [inline] |
| float dtTerrain::HeightField::GetXInterval | ( | ) | const [inline] |
| float dtTerrain::HeightField::GetYInterval | ( | ) | const [inline] |