philsupertramp/game-math
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Private Member Functions | List of all members
NewtonFractal Class Reference

#include <Fractals.h>

Public Member Functions

 NewtonFractal (double detailFactor=1, double _min=-1.0, double _max=1.0, int _maxIter=100, double _tol=1e-5)
 
Matrix< double > operator() () const
 

Public Attributes

double detail
 detail factor for approximation More...
 
double xMin = -1.0
 start and end value on x-axis More...
 
double xMax = 1.0
 
double yMin = -1.0
 start and end value on y-axis More...
 
double yMax = 1.0
 
int maxIter = 100
 max number iterations for newton algorithm More...
 
double tol = 1e-5
 tolerance used for newton algorithm More...
 

Static Private Member Functions

static Matrix< double > fun (const Matrix< double > &x)
 
static Matrix< double > jac (const Matrix< double > &x)
 

Detailed Description

Newton fractals

Examples
numerics/TestFractals.cpp.

Constructor & Destructor Documentation

◆ NewtonFractal()

NewtonFractal::NewtonFractal ( double  detailFactor = 1,
double  _min = -1.0,
double  _max = 1.0,
int  _maxIter = 100,
double  _tol = 1e-5 
)
inline

Default constructor

Parameters
detailFactordetermines how detailed the fractal is displayed
_minmin value (chose from [-1, 1])
_maxmax value (chose from [-1, 1])
_maxIternumber maximum iterations for newton algorithm
_toltolerance used for newton algoirthm

Member Function Documentation

◆ fun()

static Matrix< double > NewtonFractal::fun ( const Matrix< double > &  x)
inlinestaticprivate

Newton fractal function

$$ \begin{pmatrix} x_0^3 - 3x_0 \cdot x_1^2 - 1 \\ -x_1^3 + 3x_0^2 \cdot x_1 \end{pmatrix} $$

Parameters
xpoint to evaluate
Returns
evaluated value

◆ jac()

static Matrix< double > NewtonFractal::jac ( const Matrix< double > &  x)
inlinestaticprivate

Helper, jacobian matrix of fun

$$ \begin{pmatrix} 3 x_0^2 x_1^2 & -6 x_0x_1\\ 6 x_0 x_1 & 3 x_0^2 - 3x_1^2 \end{pmatrix} $$

Parameters
xcurrent value (2 dimensional)
Returns
2 by 2 jacobian matrix evaluated in x

◆ operator()()

Matrix< double > NewtonFractal::operator() ( ) const
inline

Approximates newton fractal given by NewtonFractal::fun and NewtonFractal::jac.

Returns
Classified roots, meaning pixels approximated with same roots hold same values

Member Data Documentation

◆ detail

double NewtonFractal::detail

detail factor for approximation

◆ maxIter

int NewtonFractal::maxIter = 100

max number iterations for newton algorithm

◆ tol

double NewtonFractal::tol = 1e-5

tolerance used for newton algorithm

◆ xMax

double NewtonFractal::xMax = 1.0

◆ xMin

double NewtonFractal::xMin = -1.0

start and end value on x-axis

◆ yMax

double NewtonFractal::yMax = 1.0

◆ yMin

double NewtonFractal::yMin = -1.0

start and end value on y-axis


The documentation for this class was generated from the following file: