Terra 1.0
TerraAddNoise Class Reference

Add noise to the surface. More...

#include <archestree.h>

Inheritance diagram for TerraAddNoise:
TerraUnary TerraNode

Public Member Functions

 TerraAddNoise (TerraNode *node, const Vector2 &, const double &, const SimplexTurbulence2 &)
 Create a blending node.
 TerraAddNoise (TerraNode *node, const SmoothVertex2 &, const SimplexTurbulence2 &)
 Create a blending node.
virtual ScalarAlpha ElevationAlpha (const Vector2 &) const
 Compute the weight and the height of a given point in the plane.
void Draw (QGraphicsScene &) const
 Draw the sub-tree.
virtual int Memory () const
 Compute the size of a node.
virtual TerraNode * Copy () const
int Traversal (const Vector2 &) const
 Compute the number of nodes that are traversed when evaluating the tree.
Public Member Functions inherited from TerraUnary
 TerraUnary (TerraNode *)
 Create an unary node.
 ~TerraUnary ()
 Recusively destroy the sub-tree.
Public Member Functions inherited from TerraNode
 TerraNode (const Box2 &=Box2::Infinity)
 Create a node.
virtual Box2 GetBox () const
 Returns the bouding box of a node.
virtual double Elevation (const Vector2 &) const
 Compute the elevation at a given position.
virtual double Alpha (const Vector2 &) const
 Compute the alpha mask at a given position.
virtual Vector2 Gradient (const Vector2 &) const
 Compute the gradient at a given position.
virtual Vector Normal (const Vector2 &) const
 Compute the normal at a given position.
virtual void writeJson (QJsonObject &)
 Compute the Json Document of the subtree.
ScalarField2 Sample (const Array2 &) const
 Create a discrete scalar field by sampling the elevation over a given domain.
ScalarField2 Alpha (const Array2 &) const
 Create a discrete scalar field by sampling the elevation over a given domain.
void Blend (HeightField &) const
 Blend a given node with an existing terrain over an input heightfield.
void Add (HeightField &) const
 Add a given node with an existing heightfield.

Protected Attributes

SimplexTurbulence2 fractal
 Turbulence.
SmoothVertex2 vertex
 Smooth vertex kernel.
Protected Attributes inherited from TerraUnary
TerraNode * node = nullptr
 Sub-tree.
Protected Attributes inherited from TerraNode
Box2 box = Box2::Infinity
 Infinite bounding box.

Additional Inherited Members

Static Protected Attributes inherited from TerraNode
static const double epsilon = 1e-2
 Epsilon value for gradient computations.

Detailed Description

Add noise to the surface.

This class is an convenience class equivalent to the following sub-tree:

TerraNode* subtree = new TerraVertex(Vector(0.0, 0.0, 5.0), 100.0);
TerraNode* add = new TerraVertexNoise(Vector(0.0, 0.0,0.0), 50.0, SimplexTurbulence2(0.0,5.0,10.0));
TerraNode* sub = new TerraAdd(subtree, add);
TerraAdd(TerraNode *, TerraNode *, const double &=1.0)
Create the node.
Definition terraadd.cpp:14
This class implements a generic node in the ArchesTree model.
Definition archestree.h:79
TerraVertex(const Vector &, const double &, const double &=1.0)
Create a flat point primitive.
Definition terravertex.cpp:15
TerraVertexNoise(const Vector &, const double &, const SimplexTurbulence2 &, const double &=1.0)
Create a noise disc primitive.
Definition terravertexnoise.cpp:16

Constructor & Destructor Documentation

◆ TerraAddNoise() [1/2]

TerraAddNoise::TerraAddNoise ( TerraNode * node,
const Vector2 & c,
const double & r,
const SimplexTurbulence2 & fractal )

Create a blending node.

Parameters
vArgument children.

References fractal, TerraUnary::node, and TerraAddNoise().

Referenced by Copy(), Memory(), and TerraAddNoise().

◆ TerraAddNoise() [2/2]

TerraAddNoise::TerraAddNoise ( TerraNode * node,
const SmoothVertex2 & v,
const SimplexTurbulence2 & fractal )

Create a blending node.

Parameters
vArgument children.

References fractal, TerraUnary::node, TerraUnary::TerraUnary(), and vertex.

Member Function Documentation

◆ Copy()

TerraNode * TerraAddNoise::Copy ( ) const
virtual

Reimplemented from TerraNode.

References fractal, TerraUnary::node, TerraAddNoise(), and vertex.

◆ ElevationAlpha()

ScalarAlpha TerraAddNoise::ElevationAlpha ( const Vector2 & p) const
virtual

◆ Memory()

int TerraAddNoise::Memory ( ) const
virtual

Compute the size of a node.

Reimplemented from TerraUnary.

References TerraNode::Memory(), TerraUnary::node, and TerraAddNoise().

◆ Traversal()

int TerraAddNoise::Traversal ( const Vector2 & p) const
virtual

Compute the number of nodes that are traversed when evaluating the tree.

Parameters
pPoint.

Reimplemented from TerraUnary.

References TerraNode::box, Box2::Inside(), TerraUnary::node, and TerraNode::Traversal().