|
|
"Anthony D. Baye" wrote:
> I'm looking for a fractal pattern to simulate the veins in a leaf, a function
> would do nicely, but I need something that can be rotated around a point.
>
I posted a way to use the logistic map as a pattern last year. Applying a few
warps like the ones below might get you started.
// ----------------------------------------
// Persistence of Vision Ray Tracer Scene Description File
// File: lm_pattern.pov
// Vers: 3.6, 3.7
// Desc: Logistic Map Pattern Example
// Date: 20010-08-03
// Auth: David Wagner
// Cite: http://en.wikipedia.org/wiki/Logistic_map
//
#include "colors.inc"
// ----------------------------------------
// Returns the distance to the nearest logistic value after lm_imin iterations.
#declare lm_i_distance_min = function( lm_r, lm_pop, lm_val, lm_nearestpop,
lm_i, lm_istart, lm_iend ) {
select(lm_i > lm_iend, 0,
lm_i_distance_min(
lm_r,
lm_r*lm_pop*(1-lm_pop),
lm_val,
select(lm_i > lm_istart & ( (abs(lm_pop-lm_val) <
abs(lm_nearestpop-lm_val)) ),0,
lm_nearestpop,
lm_pop),
lm_i+1, lm_istart, lm_iend ),
//abs(lm_val-lm_nearestpop) // Includes a straight line along the edge.
select(lm_nearestpop<(1-0.5/lm_iend),0,1,abs(lm_val-lm_nearestpop) )
)//end recursion select
};
// Calls the recursive iterating function.
#declare lm_fn_distance_min = function( lm_r, lm_val, lm_istart, lm_iend ) {
lm_i_distance_min(lm_r,0.5, lm_val, 1, 1, lm_istart, lm_iend)
};
// ----------------------------------------
#local lm_istart= 20 ;//Minimum iterations.
#local lm_iend =100 ;//Maximum iterations.
#local n_circum = 25 ;//Number of repeats around the circle.
#local r_offset= 0.0;//Can make a rosette in the center. Try 0.01 or larger.
cylinder{<0,0,0>,y*0.1, r_offset+4
texture{
pigment {
function { lm_fn_distance_min(z,x, lm_istart, lm_iend) }
poly_wave 0.25
color_map{[0 0.25*Green][1 LimeGreen]}
warp{ repeat x flip x} //circumferential
warp{ repeat z*4 } //radial
warp{turbulence 0.1*(x+y)}
translate z*r_offset
scale 0.5/ n_circum *(x) +y+z
warp{ cylindrical orientation z dist_exp 0 }
warp{ black_hole <0,0,0>, 4 inverse falloff 0.5}
warp{turbulence 0.1*(x+y)}
}//end pigment
}//end texture
}
// ----------------------------------------
camera {
location <0,6,-9>
direction 1.5*z
right x*image_width/image_height
look_at <0.0, 0.0, 0.0>
}
sky_sphere {
pigment {
gradient y
color_map {
[0.0 rgb <0.6,0.7,1.0>]
[0.7 rgb <0.0,0.1,0.8>]
}
}
}
light_source {<0, 0, 0>
color rgb <1, 1, 1>
translate <-30, 30, -30>
}
// ----------------------------------------
Post a reply to this message
|
|