#include <MidpointDisplacementAlgorithm.h>
|
| MidpointDisplacementAlgorithm (int width, int height, float cornerValueFrom, float cornerValueTo) |
|
void | RandomizeSurfaceCorners (float cornerValueFrom, float cornerValueTo) |
|
float * | GenerateSurfaceByMidpointDisplacement (int x1, int y1, int x2, int y2, int level) |
|
| TerrainAlgorithm (int width, int height) |
|
| ~TerrainAlgorithm () |
|
unsigned int | PointIndex (int x, int y) const |
|
float | GetLowestValue () const |
|
float | GetHighestValue () const |
|
MidpointDisplacementAlgorithm::MidpointDisplacementAlgorithm |
( |
int |
width, |
|
|
int |
height, |
|
|
float |
cornerValueFrom, |
|
|
float |
cornerValueTo |
|
) |
| |
Initializes the attributes, allocates the memory for the terrain data and sets the corner values.
- Parameters
-
[in] | width | Size of the terrain surface to generate in X-axis. |
[in] | height | Size of the terrain surface to generate in Y-axis. |
[in] | cornerValueFrom | Lower boundary of the interval from which the pseudo-random values are generated. |
[in] | cornerValueTo | Upper boundary of the interval from which the pseudo-random values are generated. |
float * MidpointDisplacementAlgorithm::GenerateSurfaceByMidpointDisplacement |
( |
int |
x1, |
|
|
int |
y1, |
|
|
int |
x2, |
|
|
int |
y2, |
|
|
int |
level |
|
) |
| |
Core of the algorithm - method that is applied to the points which lie in a rectangle given by two corner points and subsequently divides the rectangle in four approximately large rectangles and calls itself upon them. Recursion stops when the smaller rectangle contains no more points.
[Based] on the midpoint displacement algorithm, described e.g. in Modern Computer Graphics, p.278
- Parameters
-
[in] | northWest | North-West corner of the rectangle in which the computation takes place. |
[in] | southeEast | South-East corner of the rectangle in which the computation takes place. |
- Returns
- Terrain surface data stored in one-dimensional array.
void MidpointDisplacementAlgorithm::RandomizeSurfaceCorners |
( |
float |
cornerValueFrom, |
|
|
float |
cornerValueTo |
|
) |
| |
Randomizes the corners of the terrain surface. To each of the four corners a new pseudo-radom value from the given interval will be assigned. Positive values only.
- Parameters
-
[in] | cornerValueFrom | Lower boundary of the interval from which the pseudo-random values are generated. |
[in] | cornerValueTo | Upper boundary of the interval from which the pseudo-random values are generated. |
const int MidpointDisplacementAlgorithm::InitialLevel = 1 |
|
static |
The documentation for this class was generated from the following files: