|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I am looking to use a simple loop to call a macro to repeatedly add an
object to a scene. The only problem I am having, however, is that since
the objects are randomly placed and rotated, some of them are intersecting.
I would like to know if there is a way to detect if another object is in
the way before placing another object in any random space.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi
Have a look at section 6.1.4.6 of the documentation
the trace() function could help you.
I suggest you to add your objects in a union and call trace to scan the
place where you want to add the next one.
HTH
Marc
web.3fa08e76fac903efda84c90@news.povray.org...
> I am looking to use a simple loop to call a macro to repeatedly add an
> object to a scene. The only problem I am having, however, is that since
> the objects are randomly placed and rotated, some of them are
intersecting.
> I would like to know if there is a way to detect if another object is in
> the way before placing another object in any random space.
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Marc Jacquier <jac### [at] wanadoofr> wrote:
> Have a look at section 6.1.4.6 of the documentation
> the trace() function could help you.
> I suggest you to add your objects in a union and call trace to scan the
> place where you want to add the next one.
Once again: trace() (or inside()) will help you putting *points* in
the scene so that they will not be inside any object. There's no easy way
of putting freely-shaped objects in the scene so that they will not intersect
with any other object.
General collision detection is a quite complicated problem, not easily
solvable by using trace() or inside(). (You can make approximations by
sampling points on the surface and inside the object you want to place in
the scene and looking at each of these points if it's inside of any other
object in the scene, but besides this getting slow it doesn't guarantee
a 100% success.)
One approximation is easy, though. If it's enough that objects are
bounded by an imaginary sphere (so that the object is completely inside
this sphere) you can place objects in the scene so that no object is
closer to another object than the radius of this sphere. In this case
you only need to compare the distances between the centers of these
imaginary spheres and place objects only when the distance to all the
other centers is larger than the radius (#if(vlength(Center1-Center2)>Radius)).
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
The problem I see with using imaginary spheres is that what I am doing
amounts to dropping 400 pennies on the floor, but not wanting any to
overlap or touch. I really have no way of finding an object once I drop
it, so checking anything like a radius of a sphere around it is out, unless
I rewrite everything, which would be amazingly hard considering the varible
amount of objects. I guess I will have to be content with overlaps then, or
else use millions of trace() calls.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <web.3fa1f33040941870b9670050@news.povray.org>,
"Robo210" <nomail@nomail> wrote:
> The problem I see with using imaginary spheres is that what I am doing
> amounts to dropping 400 pennies on the floor, but not wanting any to
> overlap or touch. I really have no way of finding an object once I drop
> it, so checking anything like a radius of a sphere around it is out, unless
> I rewrite everything, which would be amazingly hard considering the varible
> amount of objects. I guess I will have to be content with overlaps then, or
> else use millions of trace() calls.
This is certainly not an "amazingly hard" problem. Just store the
locations of the objects in an array. Check each new point against the
other points in the array, and then place an object at each point. No
need for changing the number of objects to be any more difficult than
changing a single value.
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |