|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I'd like to randomly position some objects inside an isosurface, but I have
no idea as to how to do it. Can anyone help me? Also, would it be possible
to extend this to an arbitary object?
Rohan _e_ii
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
The inside primitive might come handy for your purpose.
Here is a macro I wrote for the french "boxed" challenge (
http://povgaleries.tuxfamily.org/defis/PageDefi003.php ), it positions N
subobj inside the obj along a grid of NxNxN, it also moves a bit the
positions randomly, so it is not really a random repartition, but I
think that little changes would make it random.
I hope that's what you're looking for,
JC
#macro sub_objectise (obj, subobj, N, TheSeed)
#local Pmin=min_extent (obj);
#local Pmax=max_extent (obj);
#local delta_obj=(Pmax-Pmin)/(2*N);
#local i=0;
#while (i<N)
#local j=0;
#while (j<N)
#local k=0;
#while (k<N)
// On prend une position dans la grille et on la decale un peu
// pour eviter que tout soit aligne.
#local Pos=<Pmin.x+(Pmax.x-Pmin.x)*i/N,
Pmin.y+(Pmax.y-Pmin.y)*j/N,
Pmin.z+(Pmax.z-Pmin.z)*k/N>+
<rand(MySeed)*delta_obj.x,
rand(MySeed)*delta_obj.y,
rand(MySeed)*delta_obj.z>;
#if (inside (obj, Pos) >= 1.0)
#local a1=360*rand(TheSeed);
#local a2=360*rand(TheSeed);
#local a3=360*rand(TheSeed);
object { subobj rotate <a1,a2,a3> translate Pos }
#end
#local k = k + 1;
#end
#local j = j + 1;
#end
#local i = i + 1;
#end
#end
Rohan Bernett wrote:
> I'd like to randomly position some objects inside an isosurface, but I have
> no idea as to how to do it. Can anyone help me? Also, would it be possible
> to extend this to an arbitary object?
>
> Rohan _e_ii
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Rohan Bernett wrote:
> I'd like to randomly position some objects inside an isosurface, but I have
> no idea as to how to do it. Can anyone help me? Also, would it be possible
> to extend this to an arbitary object?
Have a look at the inside() function. It works for all objects ith well
defined inside and outside (like isosurfaces)
Christoph
--
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 17 Jun. 2003 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Christoph Hormann <chr### [at] gmxde> wrote:
> Have a look at the inside() function. It works for all objects ith well
> defined inside and outside (like isosurfaces)
You can place *points* inside an object with this method. However, how
can you place objects with dimensions randomly inside another object (and
be sure that no part of the first object comes out of the second)?
--
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
You can check that the bounding box edges of the object you insert are
also inside the object in which you insert, that still isn't perfect but
you can generalise that to check that condition on points of a grid
within the object you want to insert, that way you would asymptotically
get close to the solution.
But sometimes you insert such small objects that you don't really need
to check that they don't come out.
JC
Warp wrote:
> Christoph Hormann <chr### [at] gmxde> wrote:
>
>>Have a look at the inside() function. It works for all objects ith well
>>defined inside and outside (like isosurfaces)
>
>
> You can place *points* inside an object with this method. However, how
> can you place objects with dimensions randomly inside another object (and
> be sure that no part of the first object comes out of the second)?
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"JC (Exether)" <no### [at] spamfr> wrote in message news:3f61be70@news.povray.org...
>
> But sometimes you insert such small objects that you don't really need
> to check that they don't come out.
If I see you dating my sister, you're a dead man.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
:-)))
Ooopss ...
Tom Melly wrote:
> "JC (Exether)" <no### [at] spamfr> wrote in message news:3f61be70@news.povray.org...
>
>>But sometimes you insert such small objects that you don't really need
>>to check that they don't come out.
>
>
> If I see you dating my sister, you're a dead man.
>
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |