|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
From: Christoph Hormann
Subject: Re: Cylinder heightfield macro using eval_pigment
Date: 10 Jun 2000 04:05:54
Message: <3941F6E2.4FA816F3@gmx.de>
|
|
|
| |
| |
|
|
Thanks for sharing this with us.
There is a bracket missing in the sphere's finish statement:
sphere{<X,Cf1*Hv,Z>, Tv*(Cy_Rad/2)
pigment{rgb Cv1}finish{diffuse 1
} ^
don't know how you lost that, but it keeps the code from running.
BTW, how about a possibility to use other forms than cylinders
(boxes, prisms, ...) :-)
Christoph
--
Christoph Hormann <chr### [at] gmxde>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
|
| |
| |
|
|
From: SamuelT
Subject: Re: Cylinder heightfield macro using eval_pigment
Date: 10 Jun 2000 14:53:35
Message: <39428F50.D38BA3A6@aol.com>
|
|
|
| |
| |
|
|
Hmm, darn cut and paste.... you lose stuff going from application to
another sometimes....
I've already modified the code to accept spheres, I'm sure boxes wouls
be very easy. Prisms, I don't know. I suppose I could make a 5 or
6-sided prism with random points, something like <
sin(rand(NewSeed)*360)*Tv, cos(rand(NewSeed)*360)*Tv > for each point,
but I haven't tried it yet to see if it will work.
Christoph Hormann wrote:
> Thanks for sharing this with us.
>
> There is a bracket missing in the sphere's finish statement:
>
> sphere{<X,Cf1*Hv,Z>, Tv*(Cy_Rad/2)
> pigment{rgb Cv1}finish{diffuse 1
> } ^
>
> don't know how you lost that, but it keeps the code from running.
>
> BTW, how about a possibility to use other forms than cylinders
> (boxes, prisms, ...) :-)
>
> Christoph
>
> --
> Christoph Hormann <chr### [at] gmxde>
> Homepage: http://www.schunter.etc.tu-bs.de/~chris/
--
Samuel Benge
E-Mail: STB### [at] aolcom
Visit my isosurface tutorial at http://members.aol.com/stbenge
Post a reply to this message
|
|
| |
| |
|
|
From: SamuelT
Subject: Re: Cylinder heightfield macro using eval_pigment
Date: 10 Jun 2000 15:38:34
Message: <394299DF.6F94CB92@aol.com>
|
|
|
| |
| |
|
|
Okay, this code places columns with 6 random sides (see image at
povray.binaries.images) :
#macro Cy_Hf( Cy_Pgmnt, Cy_Rad, Cy_Num, Cy_High )
#$ X = 0; #$ Z = 0; #$ Tv = 10/Cy_Num; #$ Hv = Cy_High; #$ R=seed(58728);
#$ Rv=0;
#$ Tex = pigment{Cy_Pgmnt}
union{
#while(Z<10+Tv)
#while(X<10+Tv)
#% Cv = eval_pigment(Tex , <X,0,Z>); #% Cf = vlength(Cv);
prism{linear_spline 0,Cf 7,
<sin((pi*2/6*1))*Tv*Cy_Rad,cos(pi*2/6*1)*Tv*Cy_Rad>
<sin((pi*2/6*2+rand(R)*(pi/3)-(pi/6)))*Tv*Cy_Rad,cos(pi*2/6*2+rand(R)*(pi/3)-(pi/6))*Tv*Cy_Rad>
<sin((pi*2/6*3+rand(R)*(pi/3)-(pi/6)))*Tv*Cy_Rad,cos(pi*2/6*3+rand(R)*(pi/3)-(pi/6))*Tv*Cy_Rad>
<sin((pi*2/6*4+rand(R)*(pi/3)-(pi/6)))*Tv*Cy_Rad,cos(pi*2/6*4+rand(R)*(pi/3)-(pi/6))*Tv*Cy_Rad>
<sin((pi*2/6*5+rand(R)*(pi/3)-(pi/6)))*Tv*Cy_Rad,cos(pi*2/6*5+rand(R)*(pi/3)-(pi/6))*Tv*Cy_Rad>
<sin((pi*2/6*6+rand(R)*(pi/3)-(pi/6)))*Tv*Cy_Rad,cos(pi*2/6*6+rand(R)*(pi/3)-(pi/6))*Tv*Cy_Rad>
<sin((pi*2/6*7))*Tv*Cy_Rad,cos(pi*2/6*1)*Tv*Cy_Rad>
rotate y*rand(R)*360
pigment{rgb Cv}
finish{diffuse 1} translate<X,0,Z>
}
#$ X = X+Tv;
#end
#$ X = 0; #$ Z = Z+Tv;
#end
translate<-5,0,-5>
}
#end
--
Samuel Benge
E-Mail: STB### [at] aolcom
Visit my isosurface tutorial at http://members.aol.com/stbenge
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|