POV-Ray : Newsgroups : povray.newusers : Stacking stones without overlapping Server Time
15 Oct 2024 19:01:08 EDT (-0400)
  Stacking stones without overlapping (Message 1 to 10 of 64)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Ari
Subject: Stacking stones without overlapping
Date: 15 Jun 2017 11:05:00
Message: <web.5942a025555127989d2528170@news.povray.org>
Hi folks, I am new to the software and this community. I am a year 1 engineer
and am recently required to learn this software. So far, I could do some very
simple coding work only and my aim is to make a code to generate a scene
consisting of numerous sand grains like
http://news.povray.org/povray.binaries.images/attachment/%3C4d98c518%40news.povray.org%3E/27841-grains.jpg
Could anyone tell me how to stack some objects without them being overlapping
like the picture above? Besides, how could I approach to generate such code
(using array? rand? or any other?) Thank you!


Post a reply to this message

From: Bald Eagle
Subject: Re: Stacking stones without overlapping
Date: 15 Jun 2017 12:30:00
Message: <web.5942b561d8d105e9c437ac910@news.povray.org>
Welcome, Ari   :)

I'd suggest having a look at Jonathan Hunt's excellent pebbles.pov file:

http://news.povray.org/povray.text.scene-files/thread/%3C48d158e3$1@news.povray.org%3E/

If you're interested in experimenting with some simple self-written scenes first
/ along the way, I'd suggest learning some of the random functions:

http://www.f-lohmueller.de/pov_tut/random/random6e.htm

The easiest way to place your grains so that they don't intersect is to treat
them as perfect spheres, and make sure that the distance between the centers is
no less than the sum of the radii.

You can look into structuring your placement algorithm so that it's as fast as
possible.   There are "naive" ways, and then there are ways that make use of
subdividing the space to make the search for a valid place to place a new grain
a lot faster.

https://www.google.com/search?q=algorithm+o

http://news.povray.org/povray.newusers/message/%3C53260cc5%40news.povray.org%3E/#%3C53260cc5%40news.povray.org%3E


[As an aside, is there an easy mechanism by which I can access the thread for
the given image from the image's URL?]
http://news.povray.org/povray.binaries.images/attachment/%3C4d98c518%40news.povray.org%3E/27841-grains.jpg


Post a reply to this message

From: Stephen
Subject: Re: Stacking stones without overlapping
Date: 15 Jun 2017 12:38:10
Message: <5942b7f2$1@news.povray.org>
On 6/15/2017 4:04 PM, Ari wrote:
> Hi folks, I am new to the software and this community. I am a year 1 engineer
> and am recently required to learn this software.

Ah! ha! the evil professor strikes again. :)


> So far, I could do some very
> simple coding work only and my aim is to make a code to generate a scene
> consisting of numerous sand grains like
>
http://news.povray.org/povray.binaries.images/attachment/%3C4d98c518%40news.povray.org%3E/27841-grains.jpg

It would gave been better if you had posted the link to the thread. That 
way the answer might be in it. Or at least a good clue.

> Could anyone tell me how to stack some objects without them being overlapping
> like the picture above? Besides, how could I approach to generate such code
> (using array? rand? or any other?) Thank you!
>

What you will want to use is the trace command to find out the distance 
to the object below. You also might want to use min_extent & max_extent 
to return the minimum and maximum coordinates of a #declared object's 
bounding box. ( <-- straight from the help file :-) )

It is not trivial what you want to do, btw.
I am sure you will get help here in the form of general pointers to help 
you work it out. :-)
Remember your evil professor may be reading this thread. ;-)

-- 

Regards
     Stephen


Post a reply to this message

From: Kenneth
Subject: Re: Stacking stones without overlapping
Date: 15 Jun 2017 13:40:07
Message: <web.5942c630d8d105e9883fb31c0@news.povray.org>
As Stephen said, placing lots of objects so that don't overlap or intersect is
not trivial-- but it CAN be done, of course. With the proper coding in POV-Ray's
"scene description language" (SDL), just about *anything* is possible. (By the
way, just placing lots of objects randomly *is* trivially simple, using
seed(...), rand(...), and a #while loop or #for loop. But there's a very good
chance that some/many of the objects WILL overlap.)

Personally, I haven't tried making a scene like yours, with lots of
NON-overlapping random objects. But it's an important coding concept, one that
can be used in so *many* ways. I need to learn it as well! ;-)


Post a reply to this message

From: Bald Eagle
Subject: Re: Stacking stones without overlapping
Date: 15 Jun 2017 14:45:01
Message: <web.5942d54dd8d105e9c437ac910@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> As Stephen said, placing lots of objects so that [they] don't overlap or intersect
is
> not trivial-- but it CAN be done, of course.

Well, I'd have to say that writing the code to do it isn't complicated, and may
indeed be "trivial".
Writing GOOD code that minimizes the number of intersection tests, and
efficiently fills the interstices IS a task that requires a fair amount of
education, knowledge, forethought, experience, creativity, skill, talent, and
inspiration.
But I think there are likely enough extant examples on the web of things that
are close enough so that he can implement it in a reasonable amount of time.

> With the proper coding in POV-Ray's
> "scene description language" (SDL), just about *anything* is possible.

Indeed.  :)  I like to keep everything in my scenes wholly in POV-Ray, and
completely generated by the SDL, if at all possible.
Sometimes it's not exactly "practical" - but proof-of-concept projects rarely
are.


Another thought just occurred to me - a wicked fast way to do something very
close to this, with no need for any sort of coding whatsoever.
It all lies in what Form you choose to code this in.  I'll just let that hint of
an idea Crackle on the back burner for a while until the coding for it becomes
Solid.

;)


Post a reply to this message

From: Kenneth
Subject: Re: Stacking stones without overlapping
Date: 15 Jun 2017 15:50:00
Message: <web.5942e402d8d105e9883fb31c0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

>...a task that requires a fair amount of
> education, knowledge, forethought, experience, creativity, skill, talent, and
> inspiration.

Yeah; I'm working on those ;-)

I need a Star Trek 'brain boost'


Post a reply to this message

From: Stephen
Subject: Re: Stacking stones without overlapping
Date: 15 Jun 2017 17:08:06
Message: <5942f736$1@news.povray.org>
On 6/15/2017 8:46 PM, Kenneth wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
>
>> ...a task that requires a fair amount of
>> education, knowledge, forethought, experience, creativity, skill, talent, and
>> inspiration.
>
> Yeah; I'm working on those ;-)
>

I gave up on that years ago and signed a long contract in blood with Satan.


> I need a Star Trek 'brain boost'
>
>
As always. :)

https://www.youtube.com/watch?v=FCARADb9asE

-- 

Regards
     Stephen


Post a reply to this message

From: Thomas de Groot
Subject: Re: Stacking stones without overlapping
Date: 16 Jun 2017 02:46:53
Message: <59437edd@news.povray.org>
On 15-6-2017 20:43, Bald Eagle wrote:

> Another thought just occurred to me - a wicked fast way to do something very
> close to this, with no need for any sort of coding whatsoever.
> It all lies in what Form you choose to code this in.  I'll just let that hint of
> an idea Crackle on the back burner for a while until the coding for it becomes
> Solid.
>
> ;)
>
>

That is really wicked!! ;-)

-- 
Thomas


Post a reply to this message

From: Ari
Subject: Re: Stacking stones without overlapping
Date: 16 Jun 2017 03:00:00
Message: <web.5943814dd8d105e99d2528170@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Welcome, Ari   :)
>
> I'd suggest having a look at Jonathan Hunt's excellent pebbles.pov file:
>
>
http://news.povray.org/povray.text.scene-files/thread/%3C48d158e3$1@news.povray.org%3E/
>
> If you're interested in experimenting with some simple self-written scenes first
> / along the way, I'd suggest learning some of the random functions:
>
> http://www.f-lohmueller.de/pov_tut/random/random6e.htm
>
> The easiest way to place your grains so that they don't intersect is to treat
> them as perfect spheres, and make sure that the distance between the centers is
> no less than the sum of the radii.
>
> You can look into structuring your placement algorithm so that it's as fast as
> possible.   There are "naive" ways, and then there are ways that make use of
> subdividing the space to make the search for a valid place to place a new grain
> a lot faster.
>
> https://www.google.com/search?q=algorithm+o
>
>
http://news.povray.org/povray.newusers/message/%3C53260cc5%40news.povray.org%3E/#%3C53260cc5%40news.povray.org%3E
>
>
> [As an aside, is there an easy mechanism by which I can access the thread for
> the given image from the image's URL?]
>
http://news.povray.org/povray.binaries.images/attachment/%3C4d98c518%40news.povray.org%3E/27841-grains.jpg
Thank you for the useful information, Eagle!
I would try to read them and see if I could be equipped with such important
skills.
By the way, the thread URL is
http://news.povray.org/povray.binaries.images/thread/%3Cweb.4d97bab0dc7be259e5cacc00%40news.povray.org%3E/?mtop=360023
 :D


Post a reply to this message

From: Thomas de Groot
Subject: Re: Stacking stones without overlapping
Date: 16 Jun 2017 03:06:38
Message: <5943837e$1@news.povray.org>
On 15-6-2017 18:27, Bald Eagle wrote:

> [As an aside, is there an easy mechanism by which I can access the thread for
> the given image from the image's URL?]
>
http://news.povray.org/povray.binaries.images/attachment/%3C4d98c518%40news.povray.org%3E/27841-grains.jpg
>

The name Samuel Benge imposes itself on me for some reason, but I am not 
really sure and I cannot find anything related to this in the code I 
have from him. The image is very familiar and I remember we have 
discussed this in the (recent?) past. So, yes indeed, we need a better 
link to the thread.

-- 
Thomas


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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