Heightfield 1.0
|
A core heightfield on a hexagonal grid. More...
#include <hexagonheightfield.h>
Public Member Functions | |
HexagonHeightField () | |
Empty. | |
HexagonHeightField (const ScalarHexagonField2 &) | |
Create a heightfield from a scalar field. More... | |
HexagonHeightField (const Vector2 &, const double &, int, int, const double &=0.0) | |
Create the field structure. More... | |
~HexagonHeightField () | |
Empty. | |
Vector | Vertex (int, int) const |
Compute the vertex corresponding to a given sample. More... | |
Vector | Normal (int, int) const |
Compute the normal at a given sample. More... | |
double | Slope (int, int) const |
Compute the slope at a given integer point on the terrain. More... | |
void | CreateHexes (QVector< FrameScaled > &) const |
Create a stack representation of the model. More... | |
A core heightfield on a hexagonal grid.
|
explicit |
Create a heightfield from a scalar field.
This constructor provides implicit conversion.
s | Scalar field. |
|
explicit |
Create the field structure.
c | Origin. |
x,y | Size of the array. |
v | Default value of field. |
void HexagonHeightField::CreateHexes | ( | QVector< FrameScaled > & | frames | ) | const |
Create a stack representation of the model.
Stacks are defined as scaled hexagonal prisms.
frames | Set of instances. |
Vector HexagonHeightField::Normal | ( | int | i, |
int | j | ||
) | const |
Compute the normal at a given sample.
This function uses the weighted sum (area) of the normals of the triangles sharing the point on the grid. The returned vector is normalized.
i,j | Integer coordinates of the sample. |
double HexagonHeightField::Slope | ( | int | i, |
int | j | ||
) | const |
Compute the slope at a given integer point on the terrain.
i,j | Integer coordinates |
Vector HexagonHeightField::Vertex | ( | int | i, |
int | j | ||
) | const |
Compute the vertex corresponding to a given sample.
i,j | Integer coordinates of the sample. |