|
![](/i/fill.gif) |
Hello,
I trying to place objects on the slope of a height_field. From the
documentation I was able to figure out how to get the "Y" direction problem
solved by using the trace command to place the objects, but now another
issue has cropped up. Some of the objects are partically covered (see
attached image). I'm wondering if if vrotate (A,B) A being the camera
location, and B.z or B.x is would fix this. I'm having a problem figuring
how to intergrate that into what I've already done. Pointers appreciated
better than an actual solution as I'll end up understanding it better.
Thanks Jim
----
#macro PlaceDBs (Target, Location, Object)
#local Dither = 1;
#while (Dither)
#local DFactor = 1 * rand(Rand);
#if (DFactor >= 0.75 & DFactor <= 1)
#local Dither = 0;
#end
#end
#local Norm = <0, 0, 0>;
#local Start = <0, 10, 0>;
#local Intercept = trace (Target, Start, Location-Start ,Norm);
#if (vlength(Norm) != 0)
object {Object rotate y*(360 * DFactor) scale (0.1 * DFactor) translate
Intercept}
#end
#end
// -----
#declare NumberOfObjects = 50;
#declare Collision = 0.6;
#declare ObjectBox = <-5,0,-5>;
#declare Locations = array[NumberOfObjects];
#declare Rand = seed(49+16+80+87+33+5);
#declare i = 0;
#while (i < NumberOfObjects)
#declare Locations[i] = (<rand(Rand),rand(Rand),rand(Rand)> - 0.5) *
ObjectBox;
#declare TooClose = 0;
#declare j = 0;
#while (j < i)
#if (vlength(Locations[i] - Locations[j]) < Collision)
#declare TooClose = 1;
#declare j = i;
#end
#declare j = j + 1;
#end
#if (TooClose = 0)
PlaceDBs (Terrain, Locations[i], DogBerries)
#declare i = i + 1;
#end
#end
Post a reply to this message
Attachments:
Download 'scratch.jpg' (42 KB)
Preview of image 'scratch.jpg'
![scratch.jpg](/povray.general/attachment/%3C45f54b06%40news.povray.org%3E/scratch.jpg?preview=1)
|
![](/i/fill.gif) |