|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Does anyone have Gail's Clutter macro - I can't find it anywhere
Thanks
Duncan
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Doh!
Sorry, JRGs macro - Too early in the morning for this!
"Duncan Adamson" <dja### [at] docicacuk> wrote in message
news:3b9f1daf$1@news.povray.org...
> Does anyone have Gail's Clutter macro - I can't find it anywhere
> Thanks
> Duncan
>
>
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Doh!
> Sorry, JRGs macro - Too early in the morning for this!
Following is the entire post containing what I think you are after.
Subject: Clutter macro
From: "JRG" <jrg### [at] hotmailcom>
Newsgroups: povray.text.scene-files
Date: Thu, 5 Jul 2001 23:52:55 +0200
NNTP-Posting-Host: 151.21.198.149
Message-ID: <3b44e1b0@news.povray.org>
//-----clutter macro---------------
//-----Author: Jonathan Rafael Ghiglia
//-----Date: 5th July 2001 14.30
/*-----params
objects array
objects related array (radius & number)
obstacles array
x & z limits
random seed
*/
#macro clutter (
ob_ar,
ob_rel_ar,
obstacle_ar,
x_lim,
z_lim,
RS
)
#local ob=dimension_size (ob_ar,1);
#local i=0;
#local num_tot=0;
#while (i<ob)
#local step_tot=ob_rel_ar[i][0];
#local num_tot=num_tot+step_tot;
#local i=i+1;
#end
#local pos= array [num_tot][2]
#local i=0;
#local num=0;
#while (i<ob)
#local j=0;
#while (j<ob_rel_ar[i][0])
#local temp_pos= <rand(RS)*x_lim,0,rand(RS)*z_lim>;
//-------check the coordinates-------
#local _i=0;
#local _error=0;
#while (_i<num)
#if (vlength (temp_pos-pos[_i][0])<(vlength
(pos[_i][1])+ob_rel_ar[i][1]))
#local _er=1; #else #local _er=0; #end
#local _error=_error+_er;
#local _i=_i+1;
#end
//-------check the obstacles
#local _i=0;
#while (_i<dimension_size(obstacle_ar,1))
#if (vlength (temp_pos-obstacle_ar[_i][0])<(vlength
(obstacle_ar[_i][1])+ob_rel_ar[i][1])) #local _er=1; #else #local _er=0;
#end
#local _error=_error+_er;
#local _i=_i+1;
#end
//----------
#if (_error=0)
#local pos[num][0]=temp_pos;
#local pos[num][1]=ob_rel_ar[i][1]*<1,0,1>;
#local num=num+1; #debug concat("parsed ",str(num,0,0)," positions\n")
#local j=j+1;
#end
#end
#local i=i+1;
#end
//-------now place the objects----------
union {
#local _n=0;
#local _p=0;
#while (_n<ob)
#local _sub=0;
#while (_sub<ob_rel_ar[_n][0])
object {ob_ar[_n] rotate 360*rand(RS)*y translate pos[_p][0]}
#local _p=_p+1;
#local _sub=_sub+1;
#end
#local _n=_n+1;
#end
}
//-----end of macro----
#end
/* Note: this macro is far from being optimized and elegant. It was made
in
a hurry today after lunch.
How to use this macro:
You have to declare three arrays:
ob_ar[n]: this array should contain your different objects you want to
place.
ob_rel_ar[n][2]: ob_rel_ar[n][0] defines how many copies of the n_th
object
you want to place;
ob_rel_ar[n][1] defines the max radius of the n_th
object
(i.e. for a sphere its actual radius, for a box
l/2*sqrt(2), etc. briefly
the min area which should be left free around the n_th
object)
obstacle_ar[m][2]: obstacle_ar[m][0] defines the coordinates of the
centre
of an area you want to leave free (or which is already occupied
by other objects).
obstacle_ar[m][1] defines the radius of the m_th area
to
leave free (it has to be a vector of the xy plane: use radius*<1,0,0>).
While placing the obstacles remeber that the objects are placed in a
rectangle with the lower left corner at the origin.
Then you simply have to add the x_limit and z_limit and finally the
random
seed... it's rather simple isn't it?
You can use and change this code anyway you want.
If you find errors or if you make cool changes please contact me:
jrg### [at] hotmailcom
*/
#local test_macro= true; // make a simple test
// ----------------------------------------
#if (test_macro)
#declare Location = <-2, 3, -4>;
#declare Look_at = <0, 0, 0>;
camera
{
location Location
look_at Look_at
}
sky_sphere { pigment { rgb <0.6, 0.8, 1> } }
light_source {
<0,3.5,5> rgb <60/255,60/255,90/255>*2.5
fade_distance 5 fade_power 3
}
light_source
{ <4, 5, -5>
rgb <1, 1, 1>*2.5
fade_power 2
fade_distance 5
}
// ----------------------------------------
plane { y, 0
pigment {color rgb <1, 1, 1>}
finish { ambient 0 diffuse 0.5 specular 0.4 roughness 0.01 reflection
0.2 }
}
//----------------------------------------
#declare total_objects=1000; // 50 seconds of parsing with my Athlon
#declare ob_ar=array[2]
#declare ob_ar[1]=sphere {0,0.05 pigment {rgb <1,.95,.9>*0.8} finish
{ambient 0 diffuse 0.2 specular 1.5 roughness 0.03 reflection
0.5*<1,.95,.9>
metallic brilliance 1.5}translate 0.05*y}
#declare ob_ar[0]=box {-0.5,0.5 translate 0.5*y scale 0.1 pigment {rgb
<1,.95,.9>*0.8} finish {ambient 0 diffuse 0.2 specular 1.5 roughness 0.03
reflection 0.5*<1,.95,.9> metallic brilliance 1.5}}
#declare ob_rel_ar=array[2][2]
#declare ob_rel_ar[1][0]=total_objects/2;
#declare ob_rel_ar[1][1]=0.05;
#declare ob_rel_ar[0][0]=total_objects/2;
#declare ob_rel_ar[0][1]=0.05*sqrt(2);
#declare obstacle_ar=array[3][2]
#declare obstacle_ar[0][0]=<5,0,5>;
#declare obstacle_ar[0][1]=<1,0,0>;
#declare obstacle_ar[1][0]=<8,0,8>;
#declare obstacle_ar[1][1]=<0.7,0,0>;
#declare obstacle_ar[2][0]=<4,0,8>;
#declare obstacle_ar[2][1]=<0.7,0,0>;
object {
clutter (
ob_ar,
ob_rel_ar,
obstacle_ar,
10,
10,
seed(1000000))
translate <-5,0,-5>}
torus {0.95,0.05
pigment {rgb <1,.2,0>}
finish {specular 1 roughness 0.005}}
torus {0.65,0.05
pigment {rgb <.8,1,.2>}
finish {specular 1 roughness 0.005}
translate <3,0,3>}
torus {0.65,0.05
pigment {rgb <0,.5,1>}
finish {specular 1 roughness 0.005}
translate <-1,0,3>}
//-----------------
#end
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
[snip]
Oh well, straight after I posted it, I checked the groups again, and
found that an updated version had been posted.
Bye for now,
Jamie.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
This is the very first version of that macro. A much more comprehensive
version is posted in p-b-s-f
Cheers,
--
Jonathan
"Jamie Davison" <jam### [at] ntlworldcom> ha scritto nel messaggio
news:MPG.1609c79cfde823959899ff@news.povray.org...
> > Doh!
> > Sorry, JRGs macro - Too early in the morning for this!
>
> Following is the entire post containing what I think you are after.
>
> Subject: Clutter macro
> From: "JRG" <jrg### [at] hotmailcom>
> Newsgroups: povray.text.scene-files
> Date: Thu, 5 Jul 2001 23:52:55 +0200
> NNTP-Posting-Host: 151.21.198.149
> Message-ID: <3b44e1b0@news.povray.org>
>
> //-----clutter macro---------------
> //-----Author: Jonathan Rafael Ghiglia
> //-----Date: 5th July 2001 14.30
>
>
> /*-----params
> objects array
> objects related array (radius & number)
> obstacles array
> x & z limits
> random seed
> */
>
>
> #macro clutter (
> ob_ar,
> ob_rel_ar,
> obstacle_ar,
> x_lim,
> z_lim,
> RS
> )
>
> #local ob=dimension_size (ob_ar,1);
> #local i=0;
> #local num_tot=0;
> #while (i<ob)
> #local step_tot=ob_rel_ar[i][0];
> #local num_tot=num_tot+step_tot;
> #local i=i+1;
> #end
> #local pos= array [num_tot][2]
> #local i=0;
> #local num=0;
> #while (i<ob)
> #local j=0;
> #while (j<ob_rel_ar[i][0])
> #local temp_pos= <rand(RS)*x_lim,0,rand(RS)*z_lim>;
> //-------check the coordinates-------
> #local _i=0;
> #local _error=0;
> #while (_i<num)
> #if (vlength (temp_pos-pos[_i][0])<(vlength
> (pos[_i][1])+ob_rel_ar[i][1]))
> #local _er=1; #else #local _er=0; #end
> #local _error=_error+_er;
> #local _i=_i+1;
> #end
> //-------check the obstacles
> #local _i=0;
> #while (_i<dimension_size(obstacle_ar,1))
> #if (vlength (temp_pos-obstacle_ar[_i][0])<(vlength
> (obstacle_ar[_i][1])+ob_rel_ar[i][1])) #local _er=1; #else #local _er=0;
> #end
> #local _error=_error+_er;
> #local _i=_i+1;
> #end
> //----------
> #if (_error=0)
> #local pos[num][0]=temp_pos;
> #local pos[num][1]=ob_rel_ar[i][1]*<1,0,1>;
> #local num=num+1; #debug concat("parsed ",str(num,0,0)," positions\n")
> #local j=j+1;
> #end
> #end
> #local i=i+1;
> #end
> //-------now place the objects----------
> union {
> #local _n=0;
> #local _p=0;
> #while (_n<ob)
> #local _sub=0;
> #while (_sub<ob_rel_ar[_n][0])
> object {ob_ar[_n] rotate 360*rand(RS)*y translate pos[_p][0]}
> #local _p=_p+1;
> #local _sub=_sub+1;
> #end
> #local _n=_n+1;
> #end
> }
>
> //-----end of macro----
> #end
>
>
>
>
> /* Note: this macro is far from being optimized and elegant. It was made
> in
> a hurry today after lunch.
>
> How to use this macro:
>
> You have to declare three arrays:
>
> ob_ar[n]: this array should contain your different objects you want to
> place.
>
> ob_rel_ar[n][2]: ob_rel_ar[n][0] defines how many copies of the n_th
> object
> you want to place;
> ob_rel_ar[n][1] defines the max radius of the n_th
> object
> (i.e. for a sphere its actual radius, for a box
> l/2*sqrt(2), etc. briefly
> the min area which should be left free around the n_th
> object)
>
> obstacle_ar[m][2]: obstacle_ar[m][0] defines the coordinates of the
> centre
> of an area you want to leave free (or which is already occupied
> by other objects).
> obstacle_ar[m][1] defines the radius of the m_th area
> to
> leave free (it has to be a vector of the xy plane: use radius*<1,0,0>).
>
> While placing the obstacles remeber that the objects are placed in a
> rectangle with the lower left corner at the origin.
>
> Then you simply have to add the x_limit and z_limit and finally the
> random
> seed... it's rather simple isn't it?
>
> You can use and change this code anyway you want.
> If you find errors or if you make cool changes please contact me:
> jrg### [at] hotmailcom
>
> */
>
>
>
> #local test_macro= true; // make a simple test
>
> // ----------------------------------------
>
>
> #if (test_macro)
>
> #declare Location = <-2, 3, -4>;
> #declare Look_at = <0, 0, 0>;
>
> camera
> {
> location Location
> look_at Look_at
> }
>
> sky_sphere { pigment { rgb <0.6, 0.8, 1> } }
>
> light_source {
> <0,3.5,5> rgb <60/255,60/255,90/255>*2.5
> fade_distance 5 fade_power 3
> }
>
>
> light_source
> { <4, 5, -5>
> rgb <1, 1, 1>*2.5
> fade_power 2
> fade_distance 5
> }
>
> // ----------------------------------------
>
> plane { y, 0
> pigment {color rgb <1, 1, 1>}
> finish { ambient 0 diffuse 0.5 specular 0.4 roughness 0.01 reflection
> 0.2 }
> }
>
> //----------------------------------------
>
>
> #declare total_objects=1000; // 50 seconds of parsing with my Athlon
>
> #declare ob_ar=array[2]
> #declare ob_ar[1]=sphere {0,0.05 pigment {rgb <1,.95,.9>*0.8} finish
> {ambient 0 diffuse 0.2 specular 1.5 roughness 0.03 reflection
> 0.5*<1,.95,.9>
> metallic brilliance 1.5}translate 0.05*y}
> #declare ob_ar[0]=box {-0.5,0.5 translate 0.5*y scale 0.1 pigment {rgb
> <1,.95,.9>*0.8} finish {ambient 0 diffuse 0.2 specular 1.5 roughness 0.03
> reflection 0.5*<1,.95,.9> metallic brilliance 1.5}}
> #declare ob_rel_ar=array[2][2]
> #declare ob_rel_ar[1][0]=total_objects/2;
> #declare ob_rel_ar[1][1]=0.05;
> #declare ob_rel_ar[0][0]=total_objects/2;
> #declare ob_rel_ar[0][1]=0.05*sqrt(2);
> #declare obstacle_ar=array[3][2]
> #declare obstacle_ar[0][0]=<5,0,5>;
> #declare obstacle_ar[0][1]=<1,0,0>;
> #declare obstacle_ar[1][0]=<8,0,8>;
> #declare obstacle_ar[1][1]=<0.7,0,0>;
> #declare obstacle_ar[2][0]=<4,0,8>;
> #declare obstacle_ar[2][1]=<0.7,0,0>;
>
>
> object {
> clutter (
> ob_ar,
> ob_rel_ar,
> obstacle_ar,
> 10,
> 10,
> seed(1000000))
> translate <-5,0,-5>}
>
> torus {0.95,0.05
> pigment {rgb <1,.2,0>}
> finish {specular 1 roughness 0.005}}
> torus {0.65,0.05
> pigment {rgb <.8,1,.2>}
> finish {specular 1 roughness 0.005}
> translate <3,0,3>}
> torus {0.65,0.05
> pigment {rgb <0,.5,1>}
> finish {specular 1 roughness 0.005}
> translate <-1,0,3>}
>
>
> //-----------------
> #end
>
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|