|
|
For images of what this macro does, see message 'Cylinder Heightfield
Uploaded' in povray.binaries.images.
This macro has four fields describing the intended result:
Cy_Hf( Cy_Pgmnt, Cy_Rad, Cy_Num, Cy_High )
* Cy_Pgmnt - This is where you tell the macro what pigment you want to
use. You MUST add a color_map to the pigment, or else POV_Ray will throw
an error. See the bug report in povray.unofficial.patches for details.
* Cy_Rad - This is the radius of the cylinders. Normal values range from
0 (0% of hf segment) to 1 (100% of hf segment).
* Cy_Num - This is how many grid squares x & z you want the heightfield
to have. Cylinders will scale accordingly.
* Cy_High - This is how high the heightfield will be.
The size of the heightfield is 10 units by 10 units. Encase in a union
to change it.
Here's an example of the invoked macro:
Cy_Hf(
pigment{granite scale 12
color_map{[0 rgb<0,0,.1>][.25 rgb<0 .35 0>][.5 rgb<1 1 .6>][1 rgb 1]}
}
.3, 31, 2
)
//************************Here's the Code
#macro Cy_Hf( Cy_Pgmnt, Cy_Rad, Cy_Num, Cy_High )
#$ X = 0; #$ Z = 0; #$ Tv = 10/Cy_Num; #$ Hv = Cy_High;
#$ Tex = pigment{Cy_Pgmnt}
union{
#while(Z<10+Tv)
#while(X<10+Tv)
#% Cv1 = eval_pigment(Tex , <X,0,Z>); #% Cf1 = vlength(Cv1);
#% Cv2 = eval_pigment(Tex , <X+Tv,0,Z>); #% Cf2 = vlength(Cv2);
#% Cv3 = eval_pigment(Tex , <X,0,Z+Tv>); #% Cf3 = vlength(Cv3);
#if(X<10)
cylinder{<X,Cf1*Hv,Z>, <X+Tv,Cf2*Hv,Z>, Tv*(Cy_Rad/2)
pigment{gradient x scale Tv*2 translate x*X-(Tv/2)
color_map{[.35 rgb Cv1][.65 rgb Cv2]}
}
finish{diffuse 1}
}
#end
#if(Z<10)
cylinder{<X,Cf1*Hv,Z>, <X,Cf3*Hv,Z+Tv>, Tv*(Cy_Rad/2)
pigment{gradient z scale Tv*2 translate z*Z-(Tv/2)
color_map{[.35 rgb Cv1][.65 rgb Cv3]}
}
finish{diffuse 1}
}
#end
sphere{<X,Cf1*Hv,Z>, Tv*(Cy_Rad/2)
pigment{rgb Cv1}finish{diffuse 1
}
#$ X = X+Tv;
#end
#$ X = 0; #$ Z = Z+Tv;
#end
translate<-5,0,-5>
}
#end
//**************************End of the Line, Buddy
--
Samuel Benge
E-Mail: STB### [at] aolcom
Visit my isosurface tutorial at http://members.aol.com/stbenge
Post a reply to this message
|
|