Reference:Fractal Pattern
Fractal patterns supported in POV-Ray:
- The Mandelbrot set with exponents up to 33. The formula for these is:
z(n+1) = z(n)^p + c
, wherep
is the correspondent exponent. - The equivalent Julia sets.
- The magnet1 and magnet2 fractals (which are derived from some magnetic renormalization transformations; see the fractint help for more details). Both 'Mandelbrot' and 'Julia' versions of them are supported.
For the Mandelbrot and Julia sets, higher exponents will be slower for two reasons:
- For the exponents 2,3 and 4 an optimized algorithm is used. Higher exponents use a generic algorithm for raising a complex number to an integer exponent, and this is a bit slower than an optimized version for a certain exponent.
- The higher the exponent, the slower it will be. This is because the amount of operations needed to raise a complex number to an integer exponent is directly proportional to the exponent. This means that exponent 10 will be (very) roughly twice as slow as exponent 5.
The syntax is:
MANDELBROT: mandel ITERATIONS [, BUMP_SIZE] [exponent EXPONENT] [exterior EXTERIOR_TYPE, FACTOR] [interior INTERIOR_TYPE, FACTOR] JULIA: julia COMPLEX, ITERATIONS [, BUMP_SIZE] [exponent EXPONENT] [exterior EXTERIOR_TYPE, FACTOR] [interior INTERIOR_TYPE, FACTOR] MAGNET MANDEL: magnet MAGNET_TYPE mandel ITERATIONS [, BUMP_SIZE] [exterior EXTERIOR_TYPE, FACTOR] [interior INTERIOR_TYPE, FACTOR] MAGNET JULIA: magnet MAGNET_TYPE julia COMPLEX, ITERATIONS [, BUMP_SIZE] [exterior EXTERIOR_TYPE, FACTOR] [interior INTERIOR_TYPE, FACTOR]
Where:
ITERATIONS
is the number of times to iterate (up to 2^32-1) the algorithm.
COMPLEX
is a 2D vector denoting a complex number.
MAGNET_TYPE
is either 1 or 2.
exponent
is an integer between 2 and 33. If not given, the default is 2.
interior
and exterior
specify special coloring algorithms. You can specify one of them or both at the same time. They only work with the fractal patterns.
EXTERIOR_TYPE
and INTERIOR_TYPE
are integer
values between 0 and 6 (inclusive). When not specified, the default value of INTERIOR_TYPE
is 0 and for EXTERIOR_TYPE 1.
FACTOR
is a float. The return value of the pattern is multiplied by
FACTOR
before returning it. This can be used to scale the value range
of the pattern when using interior and exterior coloring (this is often needed to get the
desired effect). The default value of FACTOR is 1.
The different values of EXTERIOR_TYPE
and INTERIOR_TYPE
have the following
meaning:
- 0: Returns just 1
- 1: For exterior: The number of iterations until bailout divided by ITERATIONS.
Note: This is not scaled by FACTOR (since it is internally scaled by 1/ITERATIONS instead).
For interior: The absolute value of the smallest point in the orbit of the calculated point - 2: Real part of the last point in the orbit
- 3: Imaginary part of the last point in the orbit
- 4: Squared real part of the last point in the orbit
- 5: Squared imaginary part of the last point in the orbit
- 6: Absolute value of the last point in the orbit
- 7: For exterior only: the number of iterations modulo FACTOR and divided by FACTOR.
Note: This is of course not scaled by FACTOR. The covered range is 0 to FACTOR-1/FACTOR.
- 8: For exterior only: the number of iterations modulo FACTOR+1 and divided by FACTOR.
Note: This is of course not scaled by FACTOR. The covered range is 0 to 1.
Example:
box {<-2, -2, 0>, <2, 2, 0.1> pigment { julia <0.353, 0.288>, 30 interior 1, 1 color_map { [0 rgb 0] [0.2 rgb x] [0.4 rgb x+y] [1 rgb 1] [1 rgb 0] } } }