|
![](/i/fill.gif) |
Hi peeps.
Remember this? (Yeah, it's only a short render.)
Anyway, somebody wanted the code...
// Just useful.
#declare ReMul = function (Xr, Xi, Yr, Yi) {Xr * Yr - Xi * Yi};
#declare ImMul = function (Xr, Xi, Yr, Yi) {Xr * Yi + Xi * Yr};
#declare Re2 = function (Zr, Zi) { Zr*Zr - Zi*Zi};
#declare Im2 = function (Zr, Zi) {2*Zr*Zi};
#declare Re3 = function (Zr, Zi) { Zr*Zr*Zr - 3*Zr*Zi*Zi};
#declare Im3 = function (Zr, Zi) {3*Zr*Zr*Zi - Zi*Zi*Zi};
// Change if you like...
#declare End = function (Zr, Zi) {Zr*Zr + Zi*Zi};
// Build recursive definition...
#declare Fn = array[8];
#declare Fn[0] = function (Zr, Zi, Tr, Ti, Br, Bi) {End(Zr, Zi)};
#declare lp=1;
#while (lp<8)
#declare Fn[lp] = function (Zr, Zi, Tr, Ti, Br, Bi)
{
Fn[lp-1]
(
Re3(Zr, Zi) - ReMul(Zr, Zi, Tr, Ti) + Br,
Im3(Zr, Zi) - ImMul(Zr, Zi, Tr, Ti) + Bi,
Tr, Ti, Br, Bi
)
};
#declare lp = lp + 1;
#end
#undef lp
// Change this at will... (Must be < 8 tho.)
#declare Iterations = 2;
// Don't touch...
#declare InitP = function (Ar, Ai, Br, Bi) {Fn[Iterations](+Ar, +Ai,
3*Re2(Ar, Ai), 3*Im2(Ar, Ai), Br, Bi)};
#declare InitM = function (Ar, Ai, Br, Bi) {Fn[Iterations](-Ar, -Ai,
3*Re2(Ar, Ai), 3*Im2(Ar, Ai), Br, Bi)};
// Now draw something!!
camera
{
location <0, 0, -4.5>
look_at <0, 0, 0>
}
light_source {<-2, +3, -5>, colour rgb <1.0, 0.0, 1.0>}
light_source {<+2, -3, -5>, colour rgb <0.0, 1.0, 0.0>}
object
{
isosurface
{
function {min(InitP(z, 0, x, y) - 4, 10)} // M+ set, A = (z, 0), B
= (x, y).
contained_by {box {-2, +2}}
max_gradient exp(7)
}
texture
{
pigment {colour rgb 1}
finish {ambient 0 specular 0.5}
}
}
Top tip: Take out the max() function and watch the render drop from 350
pixels/second to 50 pixels/second. :-)
As-is, renders the attached image. Took 4 minutes on my shiny new AMD64
machine - but running in 32-bit mode. :-( The part you'll want to change
is the isosurface function; if you change that 0 to some other figure,
interesting things can happen. (Maybe you even wanna animate it?)
Alternatively, change to InitP(x, y, z, 0) to swap the hyperplanes
round. (Remember, you're drawing a 3D slice of a 4D shape!)
Also, InitP() draws the M+ set. The *Mandelbrot* set is the intersection
of the M+ set and the M- set. (Use InitM() for M-.) It can be most
interesting to draw both sets at once. Use a different pigment for each
isosurface - and it looks best with x, y, z, 0 rather than z, 0, x, y.
Also of interest: slice the isosurface and stick a matching 2D plot on
the cross-section! (I will do this later if I figure out pigment
functions...)
Post a reply to this message
Attachments:
Download 'cubic2.png' (23 KB)
Preview of image 'cubic2.png'
![cubic2.png](/povray.binaries.images/attachment/%3C42af3d9e%40news.povray.org%3E/cubic2.png?ttop=441697&toff=5200&preview=1)
|
![](/i/fill.gif) |