|
![](/i/fill.gif) |
Here is working of my iso-frame function/macro.
Macro is faster becouse create ready function() for dimension but if you want
parameters of f_frame as function of x,y,z then use function{}. I've tried
various version of below functions (unrolling torus as equation, temporary
functions) but below is fastes IMO. Frame bases on f_torus so it is on x-z
space.
#version 3.5;
#include "math.inc"
#include "functions.inc"
#include "finish.inc"
#local Max=3;
// enviroment
camera{
orthographic
location -2*Max*z
direction z
up 1.5*Max*y
right 1.5*Max*x*image_width/image_height
}
background{ color rgb 1}
light_source{ (y/2-x-z)*300 color rgb 1 }
sphere{
0,1
pigment{granite color_map{[0 rgb .5][1 rgb 1]} scale .01}
hollow
scale 1000
no_image
}
// MAIN PART
#macro f_frame_fast(DX,DZ,Major,Minor)
#local DX2=(DX/2-Major);
#local DZ2=(DZ/2-Major);
function{f_torus(select(abs(x)-DX2,0,abs(x)-DX2),y,select(abs(z)-DZ2,0,abs(z)-DZ2),Major,Minor)}
#end
#declare f_frame_slow=function(x,y,z,DX,DZ,Major,Minor)
{f_torus(select(abs(x)-DX/2,0,abs(x)-(DX/2-Major)),y,select(abs(z)-DZ/2,0,abs(z)-(DZ/2-Major)),Major,Minor)};
// dimensions of frame
#local DX=Max;
#local DZ=Max*469/700; // dimensions of image
#local Major=Max/10;
#local Minor=Max/20;
union{
// frame
isosurface{
#local F=f_frame_fast(DX,DZ,Major,Minor);
function{F(x,y,z)-f_agate(x*2,y*2,z*2)/100}
contained_by{box{-Max,Max}}
accuracy .001
pigment{color rgb 1}
finish{reflection .5}
rotate x*90
}
// photo
polygon{
5
0,x,x+y,y,0
pigment{image_map{jpeg "3.jpg"}}
finish{Glossy}
translate -.5*(x+y)
scale <DX,DZ,1>
}
scale 1.75
}
Post a reply to this message
|
![](/i/fill.gif) |