OGLplus (0.52.0) a C++ wrapper for OpenGL

oglplus::images::NewtonFractal Class Reference

A generator of Newton fractal 2D images. More...

#include </home/chochlik/devel/oglplus/include/oglplus/images/newton.hpp>

Inheritance diagram for oglplus::images::NewtonFractal:
Collaboration diagram for oglplus::images::NewtonFractal:

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 TData (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.
 

Detailed Description

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:

struct MyPoly
{
static Vec2f f(Vec2f x);
static Vec2f df(Vec2f x);
};

Constructor & Destructor Documentation

template<typename Function = DefaultFunction, typename Mixer = DefaultMixer>
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.

Parameters
widththe width of the image in pixels
heightthe height of the image in pixels
c1the "low" end (minimal number of iterations) of the gradient used for colorizing of the fractal
c2the "high" end (maximal number of iterations) of the gradient used for colorizing of the fractal
lbthe left bottom coordinate of the viewport in the complex space to be rendered.
rtthe right top coordinate of the viewport in the complex space to be rendered.
functhe object wrapping the functions calculating the value of the polynomial and its first derivative (see the class documentation).
mixerfunction controling the colorization
template<typename Function = DefaultFunction, typename Mixer = DefaultMixer>
oglplus::images::NewtonFractal::NewtonFractal ( GLsizei  width,
GLsizei  height,
Function  func = Function(),
Mixer  mixer = Mixer() 
)

Creates a Red texture colorized from black to red.

Parameters
widththe width of the image in pixels
heightthe height of the image in pixels
functhe object wrapping the functions calculating the value of the polynomial and its first derivative (see the class documentation).
mixerfunction controling the colorization

Member Function Documentation

GLsizei oglplus::images::Image::Dimension ( std::size_t  i) const
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().


The documentation for this class was generated from the following file:
  • /home/chochlik/devel/oglplus/include/oglplus/images/newton.hpp

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).