|
|
Hello everyone,
assuming I placed by random values (rotation and location) a random-amount
of objects into a scene, how can i prevent these objects sometimes placed
INTO each other?
How can I establish something like a "security frame" around each object and
prevent any other object to be inside that frame?
Thank you in advance,
Sven Littkowski
Post a reply to this message
|
|
|
|
Sven Littkowski wrote:
> Hello everyone,
>
> assuming I placed by random values (rotation and location) a random-amount
> of objects into a scene, how can i prevent these objects sometimes placed
> INTO each other?
>
> How can I establish something like a "security frame" around each object
> and prevent any other object to be inside that frame?
>
> Thank you in advance,
>
> Sven Littkowski
As someone mentioned to your previous post on the subject, you could try a
combination of min_extent, max_extent and trace. as far as I know,
min_extent and max_extent have to do with finding the coordinates of the
objects bounding box, which is sort of a security frame. But you really
can't avoid math when doing collision detection in povray, because it has
no built in push-button approach. There have been people who do similar
things, you might want to try searching the povray news forums through the
web interface http://www.povray.org/search/
good luck!
Post a reply to this message
|
|
|
|
"Sven Littkowski" <wrt### [at] yahoocom> schreef in bericht
news:web.4218c0d378fbdd6c96ad883b0@news.povray.org...
> Hello everyone,
>
> assuming I placed by random values (rotation and location) a random-amount
> of objects into a scene, how can i prevent these objects sometimes placed
> INTO each other?
>
> How can I establish something like a "security frame" around each object
and
> prevent any other object to be inside that frame?
>
> Thank you in advance,
>
The code below comes from an example file by Christoph Hormann (I think in
POV-Ray's scene files: about trace), somewhat changed by me for my latest
use of it.
The term Spacing is - I believe - what you are looking for. If you make it
at least equal to the largest diameter of your object(s), then there will be
no collision... Not sure about this, but it seems to work that way in my
scenes.
Thomas
//------------ starting code -------------------
#declare Spacing = 0.5;
#declare PosX = -20;
#while (PosX < 20)
#declare PosZ = -20;
#while (PosZ < 20)
// trace function
#declare Norm = <0, 0, 0>;
#declare Start = <PosX+(rand(Seed)-0.5)*Spacing,
UpperBound+Isotrans.y+Isoscale.y+1, PosZ+(rand(Seed)-0.5)*Spacing>;
#declare Pos = trace (
Island01, // object to test
Start, // starting point
-y, // direction
Norm ); // normal
#if (Norm.x != 0 | Norm.y != 0 | Norm.z != 0) // if intersection is
found, normal differs from 0
#if ((vdot(Norm, y)>0.3) & (Pos.y > 9.3) & (Pos.y < 10.5)) //
criteria for placing trees: not too steep and not too high/low
object {
TREE
scale RRand(0.5, 2.0, Seed)
rotate RRand(0, 360, Seed2)*y
//Reorient_Trans (y, Norm)
translate Pos
}
#end
#end
#declare PosZ=PosZ+Spacing;
#end
#declare PosX=PosX+Spacing;
#end
//---------------- ending code ---------------------------
Post a reply to this message
|
|