Gamedev Framework (gf)  0.5.0
A C++11 framework for 2D games
Public Member Functions | List of all members
gf::Noise3DTo2DAdapter Class Reference

An adapter that make a 2D noise from a 3D noise. More...

#include <gf/Noises.h>

Inheritance diagram for gf::Noise3DTo2DAdapter:
Inheritance graph
[legend]

Public Member Functions

 Noise3DTo2DAdapter (Noise3D &noise, Vector3d normal=Vector3d(0.0, 0.0, 1.0), Vector3d point=Vector3d(0.0, 0.0, 0.0))
 Constructor. More...
 
virtual double getValue (double x, double y) override
 Take a 2D noise value. More...
 
- Public Member Functions inherited from gf::Noise2D
virtual ~Noise2D ()
 Virtual destructor. More...
 
double operator() (double x, double y)
 Take a 2D noise value. More...
 

Detailed Description

An adapter that make a 2D noise from a 3D noise.

The 3D point is taken on a plane defined by a normal and a point. The 3D point has the same \( x \) and \( y \) coordinates as the 2D point, and the plane is used to determine the \( z \) coordinate.

By default, the \( z = 0 \) plane is used.

Constructor & Destructor Documentation

◆ Noise3DTo2DAdapter()

gf::Noise3DTo2DAdapter::Noise3DTo2DAdapter ( Noise3D noise,
Vector3d  normal = Vector3d(0.0, 0.0, 1.0),
Vector3d  point = Vector3d(0.0, 0.0, 0.0) 
)

Constructor.

Parameters
noiseThe original 3D noise
normalThe normal of the 3D plane
pointThe point of the 3D plane

Member Function Documentation

◆ getValue()

virtual double gf::Noise3DTo2DAdapter::getValue ( double  x,
double  y 
)
overridevirtual

Take a 2D noise value.

Parameters
xThe x coordinate of the noise value
yThe y coordinate of the noise value
Returns
The noise value

Implements gf::Noise2D.