Heightfield 1.0
|
A height field with one sediment (sand) layer. More...
#include <heightfieldsediment.h>
Public Member Functions | |
HeightFieldSediment () | |
Create an empty terrain. | |
HeightFieldSediment (const Box2 &, int, int) | |
Create a flat terrain with no sediments. More... | |
HeightFieldSediment (const ScalarField2 &) | |
Create a terrain with no sediments from an elevation field. More... | |
HeightFieldSediment (const ScalarField2 &, const ScalarField2 &) | |
Create a terrain with sediments. More... | |
~HeightFieldSediment () | |
Empty. | |
Array2 | GetArray () const |
Return the array representing the grid domain. | |
ScalarField2 | AlphaBlend () const |
Compute the alpha blending between sand and bedrock. | |
HeightField | GetHeightField () const |
Convert the layered model into a simple heightfield. | |
void | SmoothRock (int=1) |
Smoothes the bedrock layer. More... | |
HeightField & | GetBedrock () |
Access to the bedrock scalar field. | |
ScalarField2 & | GetSand () |
Access to the sand scalar field. | |
double | Bedrock (const Vector2 &) const |
Compute the bedrock elevation. More... | |
double | Bedrock (int, int) const |
Return the bedrock elevation. More... | |
double | Sand (const Vector2 &) const |
Compute the sand thickness. More... | |
double | Sand (int, int) const |
Return the sand thickness. More... | |
void | Subdivide () |
Double the resolution of the terrain. | |
void | BedrockFlatten (const Vector2 &, const double &, const double &=0.25) |
Flatten the bedrock around the target point. More... | |
void | BedrockLevel (const Vector2 &, const double &, const double &) |
Level the bedrock to the target elevation. More... | |
void | BedrockUplift (const double &) |
Modify the bedrock using a uniform uplift. More... | |
void | BedrockUplift (const ScalarField2 &) |
Uplift. More... | |
void | ThermalImpact (const double &) |
Globally transform a thin layer of bedrock into sediments. More... | |
void | ThermalImpactSlope (const double &) |
Globally transform a thin layer of bedrock into sediments. More... | |
void | Stabilize (const double &, const double &=0.84) |
Stabilizes sediments over the entire terrain. More... | |
bool | StabilizeStep (int, int, const double &, ScalarField2 &) |
Perform a stabilization step on the given layered cell. More... | |
int | CheckFlowSlope (const QPoint &, FlowStruct &) const |
Compute the flow directions at a given point. More... | |
int | CheckFlowDirectionsAngle (const QPoint &, const double &, QPoint *, double *, double *, double *) const |
Compute the flow directions at a given point. More... | |
bool | SelectFlowDirection (const QPoint &, QPoint &, double &) const |
Select flow direction. More... | |
void | TRUC (const QPoint &q, const double &slope, const double &V_T, double &V_T_S, double &V_E_R, double &V_E_S, double &V_D_S) |
Compute eroded material. | |
Protected Member Functions | |
void | Evaporate (const double &, const double &, double &, double &, double &) |
Evaporate some water from the droplet. | |
Protected Attributes | |
HeightField | bedrock |
Bedrock. | |
ScalarField2 | sand |
Sand, i.e., sediments. | |
A height field with one sediment (sand) layer.
HeightFieldSediment::HeightFieldSediment | ( | const Box2 & | box, |
int | nx, | ||
int | ny | ||
) |
Create a flat terrain with no sediments.
nx,ny | Subdivision of the terrain. |
box | Rectangular domain. |
HeightFieldSediment::HeightFieldSediment | ( | const ScalarField2 & | b | ) |
Create a terrain with no sediments from an elevation field.
b | Bedrock. |
HeightFieldSediment::HeightFieldSediment | ( | const ScalarField2 & | b, |
const ScalarField2 & | s | ||
) |
Create a terrain with sediments.
b | Bedrock. |
s | Sediments. |
|
inline |
Compute the bedrock elevation.
p | Point. |
|
inline |
Return the bedrock elevation.
i,j | Integer coordinates. |
void HeightFieldSediment::BedrockFlatten | ( | const Vector2 & | c, |
const double & | r, | ||
const double & | s = 0.25 |
||
) |
Flatten the bedrock around the target point.
The neighboring elevation should converge to the terrain level at target point.
c | Center. |
r | Radius. |
s | Scaling of the effect. |
void HeightFieldSediment::BedrockLevel | ( | const Vector2 & | c, |
const double & | r, | ||
const double & | z | ||
) |
Level the bedrock to the target elevation.
c | Center. |
r | Radius. |
z | Elevation. |
void HeightFieldSediment::BedrockUplift | ( | const double & | u | ) |
Modify the bedrock using a uniform uplift.
u | Constant ulift. |
void HeightFieldSediment::BedrockUplift | ( | const ScalarField2 & | u | ) |
Uplift.
u | Uplift scalar field. |
int HeightFieldSediment::CheckFlowDirectionsAngle | ( | const QPoint & | p, |
const double & | s, | ||
QPoint * | point, | ||
double * | height, | ||
double * | slope, | ||
double * | nslope | ||
) | const |
int HeightFieldSediment::CheckFlowSlope | ( | const QPoint & | p, |
FlowStruct & | flow | ||
) | const |
Compute the flow directions at a given point.
p | Point. |
flow | Flow information. |
|
inline |
Compute the sand thickness.
p | Point. |
|
inline |
Return the sand thickness.
i,j | Integer coordinates. |
bool HeightFieldSediment::SelectFlowDirection | ( | const QPoint & | a, |
QPoint & | b, | ||
double & | slope | ||
) | const |
Select flow direction.
Compute the different flow directions and perform a random selection among candidates.
a | Cell. |
b | Returned neighboring cell. |
slope | Returned slope. |
void HeightFieldSediment::SmoothRock | ( | int | n = 1 | ) |
Smoothes the bedrock layer.
n | Number of iterations. |
void HeightFieldSediment::Stabilize | ( | const double & | e, |
const double & | sar = 0.84 |
||
) |
Stabilizes sediments over the entire terrain.
This is a an optimized algorithm with an internal queue to handle only the relevant unstable stacks during the stabilization process.
e | Elevation of sediments transported at every step of the algorithm. |
sar | Slope corresponding to the critical angle of repose, by default tan(40°) ~ 0.84. |
Without optimization, the brute force stabilization algorithm may be implemented as follows:
bool HeightFieldSediment::StabilizeStep | ( | int | x, |
int | y, | ||
const double & | eee, | ||
ScalarField2 & | deltaSand | ||
) |
Perform a stabilization step on the given layered cell.
void HeightFieldSediment::ThermalImpact | ( | const double & | s | ) |
Globally transform a thin layer of bedrock into sediments.
s | Thickness (in meters). |
void HeightFieldSediment::ThermalImpactSlope | ( | const double & | s | ) |
Globally transform a thin layer of bedrock into sediments.
s | Thickness (in meters). |