|
|
Op 02/03/2021 om 23:30 schreef Bald Eagle:
> After playing with greeble placement on a sphere, I realized that there were no
> macros in rand.inc for generating random points on the surface of things like
> cubes, tori, cylinders and cones, etc.
>
>
> I've written a few, and am picking away at the remaining ideas on my list, but
> would like to assemble a reasonably complete collection before publishing for
> overall critical review and testing. (contributions welcome)
>
> As always, most everything is a rough draft that is a proof of concept, and
> everything including the name is up for revision.
> Some are just basic task macros that are used in the actual random distribution
> macros.
>
> What I have so far is:
>
> MakePerpendicularVector (v0) - basically just the alternate version of
> VPerp_To_Vector (v0) with a different name to differentiate it.
>
> Rand_Integer (Min, Max, RandSeed)
> // Returns an integer from Min to Max, inclusive [Min ... Max]
>
> Array_Of_Integers (Min, Max)
> // Creates an array of integers from Min to Max inclusive [Min ... Max]
>
> Rand_Element_In_Array (Array, Dim, RandSeed)
> // Returns a random element of a dimension of an array
>
> VRand_In_Rectangle (V_Plane, S_Width, S_Height, S_RandSeed)
> // Returns a random point in a rectangle lying in the specified plane
>
> VRand_ON_Box (RandSeed)
> // Returns a random point on an origin-centered unit box
>
> VRand_ON_Circle (RandSeed)
> // Returns a random point on an origin-centered unit circle (radius = 1)
>
> VRand_ON_Cone (Height, radA, radB, RandSeed)
> // Returns a random point on a cone (or cylinder)
>
> VRand_In_Cone (Height, radA, radB, RandSeed)
> // Returns a random point IN a cone (or cylinder)
>
> VRand_ON_Parametric (UVstart, UVend, fnX, fnY, fnZ, RandSeed)
> // Returns a random point on a parametric surface
> This will probably be general purpose, with calls to it for generating
> points on a torus, etc
>
>
> I'm using the #if (input_file_name = "RandomDistributions.inc") trick to set up
> a test scene (no #camera - only using the default), and every macro will have a
> companion test macro to demonstrate that it works, and provide a working syntax
> and code/usage example.
> So VRand_ON_Parametric (UVstart, UVend, fnX, fnY, fnZ, RandSeed) will have a
> VRand_ON_Parametric_TEST () macro to go along with it.
>
> Remaining ideas slated for development are:
> VRand_ON_SOR ()
> VRand_ON_Lathe ()
> VRand_ON_Prism ()
> VRand_In_Polygon () Not sure "vrand in object" will work - will inside() tests
> work with planar objects?
> VRand_ON_BicubicPatch ()
> VRand_ON_Isosurface ()
>
> Folks are welcome to beat me to the punch, or write their own versions to
> compare approaches, efficiency, flexibility, speed, etc.
>
> Other areas of future interest:
>
> Prism <x,z> syntax infuriates me, and so I'd like to write a tidy macro to use
> <x,y,z> coordinates, probably from an array, and maybe another macro to take the
> <x,z> part of a prism and create an array of proper <x, y, z> coordinates.
>
> Is it somehow possible (in SDL) to divine how many arguments an extant function
> requires? That would be useful. We have dimension_size for arrays...
>
> clipka noted the shortcomings of HSV, and I was wondering if some of the people
> who play with color spaces and interpolation might come up with something along
> the lines of: https://www.alanzucconi.com/2017/07/15/improving-the-rainbow-2/
>
I am quite a heavy user of VRand_In_Obj() myself, and except for
VRand_On_Sphere there are no other "ON" (flat) distributions available
where objects are concerned. I wonder if your list of "ON" objects
cannot be reduced by one single VRand_On_Obj() macro? At least where 3d
objects are concerned? 2d objects are another kettle of fish I presume
and it is certainly not out of iddleness that you mention them separately.
I have used trace() combined with a VRand_ to put things'on' a given
object, of whatever form, but your solution(s) would be more interesting
indeed.
Usefull are also any gaussian distributions 'in' or 'out' of a surface
or object. I have a couple of examples I need to dig up....(added here)
maybe you can use them...
--
Thomas
Post a reply to this message
Attachments:
Download 'distributiont scenes.zip' (1283 KB)
|
|