POV-Ray : Newsgroups : povray.general : Preventing Randomly Placed Objects to Stick into Each Other Server Time
14 Nov 2024 21:12:38 EST (-0500)
  Preventing Randomly Placed Objects to Stick into Each Other (Message 1 to 5 of 5)  
From: Sven Littkowski
Subject: Preventing Randomly Placed Objects to Stick into Each Other
Date: 17 Feb 2005 11:40:00
Message: <web.4214c7c964e82d56e87562f60@news.povray.org>
Thanks for opening this my question.

I can place and rotate many objects by random in a scene. But how do I
prevent them to be randomly placed INTO each other?

Means:
(A) how to define a bigger security frame around each randomly placed and
rotated object, and
(B) how to set new objects without insulting that frame of any other
previous object?

Thank you for answering this probably difficult question.

Sven Littkowski


Post a reply to this message

From: Elias Pschernig
Subject: Re: Preventing Randomly Placed Objects to Stick into Each Other
Date: 18 Feb 2005 14:30:00
Message: <web.421642027850becd29f6b9c60@news.povray.org>
"Sven Littkowski" <wrt### [at] yahoocom> wrote:
> Thanks for opening this my question.
>
> I can place and rotate many objects by random in a scene. But how do I
> prevent them to be randomly placed INTO each other?
>
> Means:
> (A) how to define a bigger security frame around each randomly placed and
> rotated object, and
> (B) how to set new objects without insulting that frame of any other
> previous object?
>

I just finished skimming over most of the docs, and I'd say the functions
described here could be useful:
http://povray.org/documentation/view/3.6.1/229/

In particular, min_extend, max_extend and trace. I imagine, you could keep a
list of all the objects so far, then use e.g. trace to determine if
something is where you want to place a new object (using multiple rays)..
and that way find out a spot where to place the new one, probably with some
iterative algorithm.

The mechsim chapter in the megapov docs also sounds like it could provide an
easy solution:
http://megapov.inetart.net/manual-1.0/global_settings.html#mechsim

Personally, I have not much experience with either of the above - so maybe
someone else can give some more detailed hints.


Post a reply to this message

From: stm31415
Subject: Re: Preventing Randomly Placed Objects to Stick into Each Other
Date: 18 Feb 2005 15:35:00
Message: <web.421650ee7850becd9b0dd50e0@news.povray.org>
I would say that you ought to be able to use a loop that re-defines the
object that you are trace()ing to include the objects you are dropping...
this would, however, lead you to have stacked objects.
Or you could, as suggested, make an array of placed objects, and use mins
and maxes to keep out of trouble.
So it probably depends on what the application is. do you want a flat layer
fo objects, or just randomly place non-intersecting objects?

-S
5TF!


Post a reply to this message

From: Sven Littkowski
Subject: Re: Preventing Randomly Placed Objects to Stick into Each Other
Date: 20 Feb 2005 12:05:01
Message: <web.4218c3367850becd96ad883b0@news.povray.org>
Hi Sam and everyone else,

the objects are placed 3-dimensionally. Actually, these are space stations
and therefore need that security distance between each of them.

My experience and knowledge is low with POV-Ray. Truly, having a real source
code will help me much better than links to help pages where I still have
to try adapting and converting the difficult things there for my purposes.
Despite of that, I still express my thanks for the previous attempts to
help me. Please, go on helping me.

Thanks,

Sven


Post a reply to this message

From: Chris B
Subject: Re: Preventing Randomly Placed Objects to Stick into Each Other
Date: 20 Feb 2005 14:28:35
Message: <4218e4e3@news.povray.org>
"Sven Littkowski" <wrt### [at] yahoocom> wrote in message
news:web.4218c3367850becd96ad883b0@news.povray.org...
> Hi Sam and everyone else,
>
> the objects are placed 3-dimensionally. Actually, these are space stations
> and therefore need that security distance between each of them.
>
> My experience and knowledge is low with POV-Ray. Truly, having a real
source
> code will help me much better than links to help pages where I still have
> to try adapting and converting the difficult things there for my purposes.
> Despite of that, I still express my thanks for the previous attempts to
> help me. Please, go on helping me.
>
> Thanks,
>
> Sven
>

Hi Sven,

I've put some real source code on  'povray.binaries.scene-files' titled
'Randomly Placed Objects'.
It uses an array to store previously used positions (as suggested by Sam).
I think this'll do more or less what you want.

I've randomly oriented objects through a full 360 degrees.
To just give them a bit of a random wobble you can replace the rotate with:
      rotate (<rand(MyRand),rand(MyRand),rand(MyRand)>-0.5)*20

Have fun.
Chris B.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.