Heightfield 1.0
Public Member Functions | List of all members
HexagonHeightField Class Reference

A core heightfield on a hexagonal grid. More...

#include <hexagonheightfield.h>

Inheritance diagram for HexagonHeightField:
ScalarHexagonField2 HexagonArray2 Hexagon2

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...
 

Detailed Description

A core heightfield on a hexagonal grid.

Constructor & Destructor Documentation

◆ HexagonHeightField() [1/2]

HexagonHeightField::HexagonHeightField ( const ScalarHexagonField2 s)
explicit

Create a heightfield from a scalar field.

This constructor provides implicit conversion.

Parameters
sScalar field.

◆ HexagonHeightField() [2/2]

HexagonHeightField::HexagonHeightField ( const Vector2 c,
const double &  r,
int  x,
int  y,
const double &  v = 0.0 
)
explicit

Create the field structure.

Parameters
cOrigin.
x,ySize of the array.
vDefault value of field.

Member Function Documentation

◆ CreateHexes()

void HexagonHeightField::CreateHexes ( QVector< FrameScaled > &  frames) const

Create a stack representation of the model.

Stacks are defined as scaled hexagonal prisms.

Parameters
framesSet of instances.

◆ Normal()

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.

Parameters
i,jInteger coordinates of the sample.

◆ Slope()

double HexagonHeightField::Slope ( int  i,
int  j 
) const

Compute the slope at a given integer point on the terrain.

Parameters
i,jInteger coordinates

◆ Vertex()

Vector HexagonHeightField::Vertex ( int  i,
int  j 
) const

Compute the vertex corresponding to a given sample.

Parameters
i,jInteger coordinates of the sample.