|
|
"Dudo" <nomail@nomail> wrote:
> Hi,
>
> how can I put a color gradient along the sphere sweep path?
> I have seen such visualizations in VMD..
>
> Thanks
> D.
I can't put a colour gradient on a sphere sweep either. The following changes
the colour along a spline curve of constant radius. If you want the radius to
change, you should use a roundcones rather than cylinders. I can help you with
that if you want.
#include "colors.inc"
//
global_settings {max_trace_level 5}
background{White}
camera {orthographic location <3,1,0> look_at <0,1,0>}
light_source {<-140,200,300> rgb <1, 1, 1>*1.5}
light_source {<140,200,-300> rgb <0.9, 0.9, 1.00>*0.8 shadowless}
//
// Define a spline
//
#declare MySpline1 =
spline {
// Smooth flowing curve. My favourite.
natural_spline
//
-.25, <0,0,-1>
0.00, <1,0,0>
0.25, <0,0.25,1>
0.50, <-1,0.5,0>
0.75, <0,0.75,-1>
1.00, <1,2,0>
1.25, <0,2,1>
}
//
// Calculate the pigment
//
#macro MyPig(ctt)
#if (ctt < 0.5)
#local rr = 1;
#local gg = 2*ctt;
#else
#local rr = 2*(1-ctt);
#local gg = 1;
#end
<rr,gg,0>
#end
//
//Path of the Spline
//
union{
#declare ctr = 0;
#declare oldpos = MySpline1(ctr);
sphere{oldpos 0.1 pigment{ rgb MyPig(ctr) } }
#while (ctr < 1)
#declare ctr = ctr + 0.002;
#declare newpos = MySpline1(ctr);
cylinder{oldpos, newpos 0.1 pigment { rgb MyPig(ctr) } }
sphere{newpos 0.1 pigment { rgb MyPig(ctr) } }
#declare oldpos = newpos;
#end
}
Post a reply to this message
|
|