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

Erosion. More...

#include <heightfield.h>

Inheritance diagram for HeightFieldErosion:
HeightField ScalarField2 Array2 Box2

Public Member Functions

 HeightFieldErosion (const HeightField &)
 Setup erosion using a heightfield. More...
 
void HillSlope (double, double=1.0)
 Hillslope erosion. More...
 
void DebrisSlope (double, double=1.0)
 Debris slope erosion. More...
 
void StreamPower (double, double=1.0)
 Stream power erosion. More...
 
void HillSlope (double, double, double, double)
 Hillslope erosion with constrained range. More...
 
void DebrisSlope (double, double, double, double)
 Debris slope erosion with constrained range. More...
 
- Public Member Functions inherited from HeightField
 HeightField ()
 Empty.
 
 HeightField (const ScalarField2 &)
 Create a heightfield from a scalar field. More...
 
 HeightField (const Box2 &, const QImage &, const double &=0.0, const double &=256.0 *256.0 - 1.0, bool=true)
 Create a heightfield from an image. More...
 
 HeightField (const Box2 &, int, int, const double &=0.0)
 Create a flat heightfield. More...
 
 HeightField (const Box2 &, int, int, const QVector< double > &)
 Create a heightfield. More...
 
 ~HeightField ()
 Empty.
 
double GetHeight (const Vector2 &) const
 Compute the height at a given position. More...
 
Vector Vertex (const Vector2 &, bool=true) const
 Compute the vertex position on the terrain. More...
 
Vector Vertex (int, int) const
 Compute the vertex corresponding to a given sample. More...
 
QVector< VectorArrayVertexes (const QVector< QPoint > &) const
 Compute the coordinates of a set of points on the grid. More...
 
Vector Normal (const Vector2 &, bool=true) const
 Compute the normal for a given position on the terrain. 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...
 
double Slope (const QPoint &, const QPoint &) const
 Compute the slope between two points. More...
 
double AverageSlope (int, int) const
 Compute the average slope at a given integer point on the terrain. More...
 
double Aspect (int, int) const
 Compute the aspect (face orientation) at a given integer point on the terrain. More...
 
double K () const
 Compute the Lipschitz constant of the signed distance field defined as f(x,y,z)=z-h(x,y).
 
void Subdivide (const double &, Random &=Random::R239)
 Refine the terrain. More...
 
ScalarField2 StreamArea () const
 Compute the stream area field of the terrain. More...
 
ScalarField2 StreamAreaWeighted (const double &=2.0) const
 Compute the stream area field of the terrain. More...
 
ScalarField2 StreamAreaSteepest () const
 Compute the stream area field of the terrain. More...
 
ScalarField2 StreamAreaLimited (const double &) const
 Compute the stream area field of the terrain using a limited flow propagation. More...
 
ScalarField2 StreamLength (bool=false) const
 Compute the stream length. More...
 
ScalarField2 StreamSourceElev (bool=false) const
 Return the maximum source elevation of the flows converging to each point in the height field. More...
 
VectorField2 FlowField (ScalarField2 &) const
 Compute the flow field of the terrain. More...
 
ScalarField2 AverageSlope () const
 Compute the average slope field of the terrain.
 
ScalarField2 Slope (bool=false) const
 Compute the maximum slope field of the terrain. More...
 
ScalarField2 Aspect () const
 Compute the aspect field (face orientation) of the terrain.
 
ScalarField2 WetnessIndex (const double &=1.0e-3, bool=false) const
 Compute the wetness index field of the terrain. More...
 
ScalarField2 StreamPower (bool=false) const
 Compute the stream power field of the terrain. More...
 
ScalarField2 StreamPower (double, double) const
 Compute the stream power field of the terrain. More...
 
ScalarField2 ReliefSteepness (const double &) const
 Compute the omni-directional relief and steepness. More...
 
ScalarField2 Peakedness (const double &) const
 Compute the peakedness of a terrain, defined as the percentage of cells in a disk that have lower or equal elevation than the center position. More...
 
ScalarField2 TopographicPositionIndex (const double &r) const
 Compute the TPI, an index that measures how much a cell rises with respect to the mean elevation of a given radius. It is very similar in spirit to Peakedness, but here we obtain a value in m instead of the % of cells below it. More...
 
ScalarField2 LocalVariance (int=3) const
 Compute the local variance. More...
 
ScalarField2 SurfaceRoughness (int=3) const
 Compute the surface roughness. More...
 
ScalarField2 HillslopeAsymmetry (double, double=0, double=45) const
 Compute the hillslope asymmetry map for a given direction. More...
 
ScalarField2 Accessibility (const double &, int=16) const
 Compute the accessibility. More...
 
ScalarField2 Light (const Vector &, bool=false) const
 Compute the direct lighting. More...
 
int FillDepressions ()
 Fills all pits and removes all digital dams from the HeightField. More...
 
int FillDepressions (const double &)
 Modifies the HeightField to guarantee drainage. More...
 
int FillDepressions (ScalarField2 &) const
 Fills all pits and removes all digital dams from the HeightField. More...
 
int FillDepressions (const double &, ScalarField2 &) const
 Modifies the HeightField to guarantee drainage. More...
 
void CompleteBreach ()
 Breach depressions. More...
 
bool Intersect (const Ray &, double &, Vector &, const Box &, const double &, const double &=1.0e8, const double &=1.0e-4) const
 Compute the intersection between a ray and the surface of the heightfield. More...
 
bool Intersect (const Ray &, QVector< double > &, QVector< Vector > &, const Box &, const double &) const
 Compute the intersection between a ray and the surface of the heightfield. More...
 
bool IntersectBox (const Ray &, double &, Vector &, Vector &, const Box &) const
 Compute the intersection between a ray and the surface border of the heightfield. More...
 
double Shade (const Vector &, const QVector< Vector > &, const QVector< double > &, const double &) const
 Shade a vector of the terrain. More...
 
ScalarField2 Sun (const double &, int=5, int=1, int=0, int=12) const
 Compute the average direct lighting from the sun over a year. More...
 
ScalarField2 SelfShadow (const Vector &) const
 Compute the self shadowing map. More...
 
ArrayInteger2 Flow (bool=false) const
 Compute the flow topology. More...
 
ArrayInteger2 Geomorphons (const double &=0.02) const
 Compute the geomorphon index map. More...
 
ArrayInteger2 GeomorphonsTangent (double, double=0.02) const
 Compute the geomorphon index map. More...
 
ArrayInteger2 GeomorphonsAggregated (const double &=0.02) const
 Compute the aggregated geomorphon index map. More...
 
Box GetBox () const
 Get the bounding box of the heightfield. More...
 
double Signed (const Vector &) const
 Compute the signed distance do the heightfield. More...
 
void Scale (const Vector &)
 Scale the height field. More...
 
void Unity ()
 Scale the heightfield so that the compact support should fit within unit box. More...
 
void Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const
 Draw a heightfield. More...
 
QVector< QPoint > Up (int, int) const
 Compute the cells that are uphill of input point. More...
 
QVector< QPoint > Down (int, int) const
 Compute the cells that are downhill of input point. More...
 
int CheckFlowSlope (const QPoint &, FlowStruct &) const
 Compute the flow directions at a given point. More...
 
int CheckFlowSlopeWeighted (const QPoint &, FlowStruct &, const double &=2.0) const
 Compute the flow directions at a given point, using an L2 metric. More...
 
int CheckFlowDirectionsAngle (const QPoint &, const double &, FlowStruct &) const
 Compute the flow directions at a given point. More...
 
Mesh CreateMesh (bool=true, bool=false, const double &=0.0) const
 Create the geometry of the heightfield. More...
 
Mesh CreateMeshSide (const double &=0.0) const
 Create the geometry of the border of the terrain. More...
 
void CreateCubes (Box &, QVector< FrameScaled > &, const double &=-10.0) const
 Create a stack representation of the model. More...
 
void Carve (const CubicCurve &, const double &, const double &)
 Carve the terrain using a cubic curve, whose elevation define the prescribed elevation along the curve. More...
 
void Carve (const QuadricCurve &, const double &, const double &)
 Carve the terrain using a quadric curve, whose elevation define the prescribed elevation along the curve. More...
 
void Carve (const CubicCurveSet &, const double &, const double &)
 Carve the terrain using a piecewise cubic curve, whose elevation define the prescribed elevation along the curve. More...
 
void Carve (const QuadricCurveSet &, const double &, const double &)
 Carve the terrain using a piecewise quadric curve, whose elevation define the prescribed elevation along the curve. More...
 
void Carve (const Segment &, const double &, const double &)
 Carve the terrain using a segment, whose elevation define the prescribed elevation along the curve. More...
 
void Carve (const SmoothDisc2 &, const double &)
 Flatten the scalar field. More...
 
ScalarField2 GradientDistance (const HeightField &) const
 Compute the gradient distance between two heightfields. More...
 
ScalarField2 Sea (const double &=0.0) const
 Compute the water elevation in every cell according to a uniform sea level. More...
 
QVector< double > Cross (const Vector2 &, const Vector2 &, int) const
 Compute the elevation along a segment. More...
 
void SmoothBreachMultiScale (const QVector< double > &)
 Smooth breaching with a given input series. More...
 
void SmoothBreachGeometric (double, double)
 Smooth breaching with a geometric series. More...
 
void SmoothBreachLinear (double)
 Smooth breaching process. More...
 

Additional Inherited Members

- Static Public Attributes inherited from HeightField
static const double flat = 1.0e-8
 Small negative epsilon value used in breaching and flow algorithms.
 

Detailed Description

Erosion.

Constructor & Destructor Documentation

◆ HeightFieldErosion()

HeightFieldErosion::HeightFieldErosion ( const HeightField h)
explicit

Setup erosion using a heightfield.

Parameters
hHeightfield

Member Function Documentation

◆ DebrisSlope() [1/2]

void HeightFieldErosion::DebrisSlope ( double  k,
double  t,
double  a,
double  b 
)

Debris slope erosion with constrained range.

Parameters
kErosion coefficient.
tTime step.
a,bSlope range for cropping values.

◆ DebrisSlope() [2/2]

void HeightFieldErosion::DebrisSlope ( double  k,
double  t = 1.0 
)

Debris slope erosion.

Compute debris slope erosion using h=h- k t \Nabla h .

Parameters
kErosion coefficient.
tTime step.

◆ HillSlope() [1/2]

void HeightFieldErosion::HillSlope ( double  k,
double  t,
double  a,
double  b 
)

Hillslope erosion with constrained range.

Parameters
kErosion coefficient.
tTime step.
a,bLaplacian range for cropping values.

◆ HillSlope() [2/2]

void HeightFieldErosion::HillSlope ( double  k,
double  t = 1.0 
)

Hillslope erosion.

Compute hill slope erosion using h=h- k t \Delta h .

Parameters
kErosion coefficient.
tTime step.

◆ StreamPower()

void HeightFieldErosion::StreamPower ( double  k,
double  t = 1.0 
)

Stream power erosion.

Parameters
kErosion coefficient.
tTime step.