Heightfield 1.0
HeightFieldNext8 Class Reference

This class implements the structure coding the flow direction over a terrain. More...

#include <heightfield.h>

Inheritance diagram for HeightFieldNext8:
Array2 Box2

Public Member Functions

 HeightFieldNext8 (const HeightField &, bool)
 Create the flow direction field.
 
 HeightFieldNext8 ()
 Empty.
 
 ~HeightFieldNext8 ()
 Empty.
 
unsigned char At (int, int) const
 Return the flowing directions, compacted into one byte.
 
unsigned char At (const QPoint &) const
 Return the flowing directions, compacted into one byte.
 
QPoint FlowTo (const QPoint &) const
 Return the steepest flow direction.
 
QPoint FlowTo (const QPoint &, int) const
 Return the k-th flow direction.
 
int N (int, int) const
 Return the number of flowing directions.
 
int N (const QPoint &) const
 Return the number of flowing directions.
 

Protected Member Functions

unsigned char Flow (const HeightField &, const QPoint &, bool) const
 Compute the flow directions at a given point.
 

Protected Attributes

QVector< unsigned char > flow
 Array of directions.
 

Detailed Description

This class implements the structure coding the flow direction over a terrain.

Constructor & Destructor Documentation

◆ HeightFieldNext8()

HeightFieldNext8::HeightFieldNext8 ( const HeightField & h,
bool steep )

Create the flow direction field.

Parameters
hHeightfield.
steepSet to true if steepest slope is needed (which is the D8 algorithm), false for complete flow (which is D∞ algorithm).

Member Function Documentation

◆ At() [1/2]

unsigned char HeightFieldNext8::At ( const QPoint & p) const
inline

Return the flowing directions, compacted into one byte.

Parameters
pPoint.

◆ At() [2/2]

unsigned char HeightFieldNext8::At ( int i,
int j ) const
inline

Return the flowing directions, compacted into one byte.

Parameters
i,jInteger coordinates of the sample.

◆ Flow()

unsigned char HeightFieldNext8::Flow ( const HeightField & h,
const QPoint & a,
bool steep ) const
protected

Compute the flow directions at a given point.

Parameters
hHeightfield.
aPoint.
steepBoolean, set to true to compute only the steepest slope, false to compute the average flow.

◆ FlowTo() [1/2]

QPoint HeightFieldNext8::FlowTo ( const QPoint & p) const

Return the steepest flow direction.

Note that the instance should have been initialized with the steepest slope algorithm. This is the same as:

QPoint p;
QPoint f=flow.FlowTo(p,0);
QVector< unsigned char > flow
Array of directions.
Definition heightfield.h:260
HeightFieldNext8(const HeightField &, bool)
Create the flow direction field.
Definition heightfield-next.cpp:14
Parameters
pPoint.

◆ FlowTo() [2/2]

QPoint HeightFieldNext8::FlowTo ( const QPoint & p,
int k ) const

Return the k-th flow direction.

Note that the instance should have been initialized with the average flow algorithm.

Parameters
pPoint.
kIndex of the k-th flow direction.

◆ N() [1/2]

int HeightFieldNext8::N ( const QPoint & p) const

Return the number of flowing directions.

Parameters
pPoint.

◆ N() [2/2]

int HeightFieldNext8::N ( int i,
int j ) const

Return the number of flowing directions.

Parameters
i,jInteger coordinates of the sample.