|
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. | |
| HeightFieldSediment (const ScalarField2 &) | |
| Create a terrain with no sediments from an elevation field. | |
| HeightFieldSediment (const ScalarField2 &, const ScalarField2 &) | |
| Create a terrain with sediments. | |
| ~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. | |
| bool | Intersect (const Ray &, double &, Vector &) const |
| Compute the intersection between a ray and the surface of the terrain. | |
| void | SmoothRock (int=1) |
| Smoothes the bedrock layer. | |
| 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. | |
| double | Bedrock (int, int) const |
| Return the bedrock elevation. | |
| double | Sand (const Vector2 &) const |
| Compute the sand thickness. | |
| double | Sand (int, int) const |
| Return the sand thickness. | |
| 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. | |
| void | BedrockLevel (const Vector2 &, const double &, const double &) |
| Level the bedrock to the target elevation. | |
| void | BedrockUplift (const double &) |
| Modify the bedrock using a uniform uplift. | |
| void | BedrockUplift (const ScalarField2 &) |
| Uplift. | |
| void | ThermalImpact (const double &) |
| Globally transform a thin layer of bedrock into sediments. | |
| void | ThermalImpactSlope (const double &) |
| Globally transform a thin layer of bedrock into sediments. | |
| void | Stabilize (const double &, const double &=0.84) |
| Stabilizes sediments over the entire terrain. | |
| bool | StabilizeStep (int, int, const double &, ScalarField2 &) |
| Perform a stabilization step on the given layered cell. | |
| int | CheckFlowSlope (const QPoint &, FlowStruct &) const |
| Compute the flow directions at a given point. | |
| int | CheckFlowDirectionsAngle (const QPoint &, const double &, QPoint *, double *, double *, double *) const |
| Compute the flow directions at a given point. | |
| bool | SelectFlowDirection (const QPoint &, QPoint &, double &) const |
| Select flow direction. | |
| 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.
|
explicit |
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. |
|
explicit |
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. |
Compute the intersection between a ray and the surface of the terrain.
The algorithm uses a ray marching approach, therefore this function may require many iterations and the resulting intersection may not be accurate.
| ray | The ray. |
| t | Intersection depth. |
| q | Intersection point. |
|
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). |