|
|
I am fining myself in a position where I think I have some code that can
be used, but I need to "see" it, but the place I plan to use it has
restrictions, where I can't test it "in world". So, I figured I might be
able to test it in POVRay, but to see if its working as espected, I need
to test it against conditions like those its going to be running.
Conditions:
1. I don't control what the "land" looks like.
2. Land is 255x255 units in size, with its corner at 0,0.
3. Water may exist, which could be below, or above the land. This
effectively works like a simple plane, where everything below it is
water, and above isn't.
4. The land may be hundreds of units above the water, or below it.
Code:
1. Picks a random main_radius between 20->40, non-integer.
2. Picks an X,Y point that are rand(seed) * (255 - (radius * 2)) + Radius.
3. Determines where the land height and water height is.
4. Sets the "ground" at which ever is higher (i.e., if the land dips
below water here, then the water becomes the land).
5. Defines a range in which to set the Z coordinate, based on the
"normal" ground level, and the "current" level:
posz = Z position considered the "average" land height.
if ground <= posz
{
base = (posz - gnd) + 150
}
else
{
base = 20
}
6. Now that we have a center point, set a "default type", 'main_type =
int(rand(seed) * 6)'. For use in POVRay, this would mean setting this
"group" to one of six colors.
7. POVRay - Draw a sphere here, over the land, showing the location and
limits of where this thing is going to end up.
8. Generate 7 new points, with radii of 1 + rand(seed) * (main_radius /
5), within this sphere, whose distances are 'sqrt((x1-x2)^2 + (y1-y2)^2
+ (z1-z2)^2) > radius1 + radius2 + 1', first adjusting any "below" the
"ground" level to = ground level, and throwing out any that overlap, and
retesting a new one, if they do overlap. Set each ones type (color) as
'int(rand(seed) * 6) * (rand(seed) < 0.012) + main_type * (rand(seed) >=
0.012)'. This means a 1.2% change of the type being different for the
specific items in a group, and about an 0.1% change that something
"different" will come up, or a .02% change of it still picking the same
type, I think..
9. POVRay - Draw spheres of the correct color, for each of these points
and radii.
10. Generate 1->3 other random points, like above, but with a 7th
color/type, and a fixed radium of 0.5. These shouldn't overlap either.
11. Make up to 2 more "groups", using rules 1 through 11, checking that
each main sphere is at least 5 units away from the prior one, so groups
do not overlap either.
The result of this, assuming my code is right, should be several
bubbles, containing clusters of other spheres, resting on, or over, the
land mass, and water.
The virtual world I plan to use the raw data from this code in has
limits of the number of things I can "make", the distance I can have an
object "appear" from the script holder, *and* limitations on even if I
could find a place to test it, assuming the other limitations where not
in place. The final result will generate just the raw data, and send
that to a device the character holds, when they enter the area, which
can then detect when they are near on of these sphere, and produce an
appropriate display in the item, based on how close, and what the type is.
So, I figure if I could use like "trace" on a randomly made landscape,
and on a plane placed on it, I could run tests runs, using the code, to
make sure that actually does what its supposed to. Problem is, I only
fiddle now and then with POVRay, so I have **no** clue how to make a
randomly created landscape, or use trace, or use trace from "two"
different objects (assuming that is even plausible), to get my "this is
where the ground is) value, and thus compute the rest of it...
I have working code to make the coordinates (though in writing this, I
think I already see a bug), and its trivial to generate spheres at those
location, so its just the landscape + trace stuff I have no damn clue
about... :p
--
void main () {
if version = "Vista" {
call slow_by_half();
call DRM_everything();
}
call functional_code();
}
else
call crash_windows();
}
<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models,
3D Content, and 3D Software at DAZ3D!</A>
Post a reply to this message
|
|