A generator of Newton fractal 2D images. More...
#include </home/chochlik/devel/oglplus/include/oglplus/images/newton.hpp>
Classes | |
struct | X3Minus1 |
The X^3-1 function and its derivation. More... | |
struct | X4Minus1 |
The X^4-1 function and its derivation. More... | |
Public Member Functions | |
template<typename Function = DefaultFunction, typename Mixer = DefaultMixer> | |
NewtonFractal (GLsizei width, GLsizei height, Vec3f c1, Vec3f c2, Vec2f lb=Vec2f(-1.0f,-1.0f), Vec2f rt=Vec2f(1.0f, 1.0f), Function func=Function(), Mixer mixer=Mixer()) | |
Creates a RGB texture using c1 and c2 for colorizing of the fractal. More... | |
template<typename Function = DefaultFunction, typename Mixer = DefaultMixer> | |
NewtonFractal (GLsizei width, GLsizei height, Function func=Function(), Mixer mixer=Mixer()) | |
Creates a Red texture colorized from black to red. More... | |
GLsizei | Dimension (std::size_t i) const |
Returns the i-th dimension of the image. More... | |
GLsizei | Width (void) const |
Returns the width of the image. | |
GLsizei | Height (void) const |
Returns the height of the image. | |
GLsizei | Depth (void) const |
Returns the depth of the image. | |
GLsizei | Channels (void) const |
Returns the number of channels. | |
PixelDataType | Type (void) const |
Returns the pixel data type. | |
PixelDataFormat | Format (void) const |
Return the pixel data format. | |
PixelDataInternalFormat | InternalFormat (void) const |
Return a suitable pixel data internal format. | |
template<typename T > | |
const T * | Data (void) const |
Returns a pointer to the data. | |
const void * | RawData (void) const |
Returns an untyped pointer to the data. | |
std::size_t | DataSize (void) const |
Returns the size of data in bytes. | |
Vector< double, 4 > | Pixel (GLsizei width, GLsizei height, GLsizei depth) const |
Returns the pixel at the specified coordinates. | |
double | Component (GLsizei width, GLsizei height, GLsizei depth, GLsizei component) const |
Returns the component of the pixel at the specified coordinates. | |
template<typename T > | |
T | ComponentAs (GLsizei width, GLsizei height, GLsizei depth, GLsizei component) const |
Returns the component of the pixel at the specified coordinates. | |
A generator of Newton fractal 2D images.
This class generates two dimensional RGB images of rendering of the newton polynomial root finding numeric method of a specified function (X^3-1 by default). You can also specify two colors for the gradient used for the coloring of the fractal.
The polynomials to be used are specified by a class wrapping two static functions f
and df
. f
is returns the value of the polynomial for a specified complex value and df
returns the value of the first derivative of the polynomial for a specified complex value as shown in the following code example:
oglplus::images::NewtonFractal::NewtonFractal | ( | GLsizei | width, |
GLsizei | height, | ||
Vec3f | c1, | ||
Vec3f | c2, | ||
Vec2f | lb = Vec2f(-1.0f, -1.0f) , |
||
Vec2f | rt = Vec2f( 1.0f, 1.0f) , |
||
Function | func = Function() , |
||
Mixer | mixer = Mixer() |
||
) |
Creates a RGB texture using c1 and c2 for colorizing of the fractal.
width | the width of the image in pixels |
height | the height of the image in pixels |
c1 | the "low" end (minimal number of iterations) of the gradient used for colorizing of the fractal |
c2 | the "high" end (maximal number of iterations) of the gradient used for colorizing of the fractal |
lb | the left bottom coordinate of the viewport in the complex space to be rendered. |
rt | the right top coordinate of the viewport in the complex space to be rendered. |
func | the object wrapping the functions calculating the value of the polynomial and its first derivative (see the class documentation). |
mixer | function controling the colorization |
oglplus::images::NewtonFractal::NewtonFractal | ( | GLsizei | width, |
GLsizei | height, | ||
Function | func = Function() , |
||
Mixer | mixer = Mixer() |
||
) |
Creates a Red texture colorized from black to red.
width | the width of the image in pixels |
height | the height of the image in pixels |
func | the object wrapping the functions calculating the value of the polynomial and its first derivative (see the class documentation). |
mixer | function controling the colorization |
|
inherited |
Returns the i-th dimension of the image.
0: Width 1: Height 2: Depth 3: Channels
References oglplus::images::Image::Channels(), oglplus::images::Image::Depth(), oglplus::images::Image::Height(), and oglplus::images::Image::Width().