|
|
From a scene file saved in 2005, I have a piece of code containing an isosurface
with a smooth twist. I would like to extend this from 1/4 turn into many turns.
Ultimatly it would be part of an ornate fence.
// +w320 +h240
background { color rgb <1.000,1.000,1.000> }
#declare Default_Red =
texture {
pigment {
color rgbft <1.000,0.000,0.000,0.000,0.000>
}
}
#default{ texture{ Default_Red } }
#declare Gray_80_ =
texture {
pigment {
color rgbft <0.800,0.800,0.800,0.000,0.000>
}
}
#declare Camera =
camera {
perspective
location <-3.377,5.850,-12.283>
up y
right 1.333*x
angle 15.096
sky <0.136,0.904,0.407>
look_at < 0.623, -0.150, -0.283 >
} // end Camera
#local fn_A=function(x){abs(x)-.5};
#local fn_B=function{abs(z)-3/16/2};
#local fn_C=function{abs(y)-.5};
#local N=.25;
#local fn_Smooth=function(x){x*x*x*(10+x*(6*x-15))};
#local fn_twistY=function{z*sin(fn_Smooth(x)*2*pi*N) +
y*cos(fn_Smooth(x)*2*pi*N)};
#local fn_twistZ=function{z*cos(fn_Smooth(x)*2*pi*N) -
y*sin(fn_Smooth(x)*2*pi*N)};
#local
fn_twist_Box=function{max(fn_A(x-.5),fn_B(x,fn_twistY(x,y,z),fn_twistZ(x,y,z)),fn_C(x,fn_twistY(x,y,z),fn_twistZ(x,y,z)
))};
isosurface {
function {
fn_twist_Box(x-.5,y,z)
}
contained_by {box{<.5,-.5,-.5>,<1.5,.5,.5>}}
threshold 0
accuracy 0.001
max_gradient 1.58
max_trace 9
scale <1,1,1>
rotate <0,0,0>
translate <0,0,0>
}
light_source { // Light_Source
< 0.000000, 0.000000, 0.000000 >, color rgb <1.000,1.000,1.000>
fade_power 0.000
fade_distance 100.000
media_attenuation off
media_interaction on
translate <3.000000,10.000000,-12.500000>
} // end Light_Source
union { // CSG0
box { // Box0
< -1.2500000, -0.5000000, -0.0937500 >, < 1.2500000, 0.5000000, 0.0937500 >
translate <-0.750000,0.000000,0.000000>
} // end Box0
box { // Box1
< -1.0000000, -0.0937500, -0.5000000 >, < 1.0000000, 0.0937500, 0.5000000 >
translate <2.500000,0.000000,0.000000>
} // end Box1
texture{ Gray_80_ }
} // end CSG0
camera{ Camera }
// end code
I can change the cross section to:
#local fn_B=function{abs(z)-.25};
#local fn_C=function{abs(y)-.25};
to get my 1/2" wrought iron bar, but i'm stumped at getting multiple turns over
a desired length.
Help would be appreciated.
Stephen S
Post a reply to this message
|
|
|
|
....
> Oh wait... more turns then scale (stretch) seems to work.
....
Image with the updated isosurface in p.b.i
#local fn_A=function(x){abs(x)-1};
#local fn_B=function{abs(z)-.25};
#local fn_C=function{abs(y)-.25};
#local N=1.;
#local fn_Smooth=function(x){x*x*x*(10+x*(6*x-15))};
#local fn_twistY=function{z*sin(fn_Smooth(x)*2*pi*N) +
y*cos(fn_Smooth(x)*2*pi*N)};
#local fn_twistZ=function{z*cos(fn_Smooth(x)*2*pi*N) -
y*sin(fn_Smooth(x)*2*pi*N)};
#local
fn_twist_Box=function{max(fn_A(x-1),fn_B(x,fn_twistY(x,y,z),fn_twistZ(x,y,z)),fn_C(x,fn_twistY(x,y,z),fn_twistZ(x,y,z))
)};
isosurface {
function {
fn_twist_Box(x-.5,y,z)
}
contained_by {box{<.5,-.5,-.5>,<1.5,.5,.5>}}
threshold 0
accuracy 0.001
max_gradient 10.58
max_trace 9
translate <-.5,0,0>
scale <10,1,1>
rotate <0,0,0>
}
Post a reply to this message
|
|