Random generators for lots of different geometric types, intended for use in tests. 10 meters is
(arbitrarily) used as the basic scale for generated values, so for example the point3d generator
will generate points where each coordinate value is in the range -10 meters to +10 meters.
This is only to have values be roughly the same scale (which helps to ensure that random tests
actually do trigger things like intersections between objects) but do not rely on geometry being
strictly contained within the -10...+10 meter bounds. For example, the circle2d generator will
create circles where the center point is within those bounds, and the radius is up to 10 meters,
meaning that the circle may well extend to larger or smaller coordinate values.
Most of the higher-level generators in this module are built pretty directly from lower-level
generators - for example the axis3d generator is implemented as:
axis3d : Generator (Axis3d Meters coordinates)
axis3d =
Random.map2 Axis3d.through point3d direction3dGenerate a value between -10 and +10 to use for scaling geometry. (Note that this includes 0.)
Generate a random length between -10 meters and +10 meters.
Generate a random length between 0 and 10 meters.
Generate a random angle between -360 and +360 degrees.
Generate a random unitless quantity between -10 and +10.
Generate a random unitless interval with endpoints between -10 and +10.
Generate a random 2D direction.
Generate a random 3D direction.
Generate a random 2D vector with components in the range -10 to +10 meters.
Generate a random 3D vector with components in the range -10 to +10 meters.
Generate a random 2D point with components in the range -10 to +10 meters.
Generate a random 3D point with components in the range -10 to +10 meters.
The polygon2d generator is a bit special. Since randomly generating vertices and then
connecting them would almost always result in useless self-intersecting polygons, this instead
generates polygons of a few different types that are non-self-intersecting by construction:
All the polygons will be roughly centered on the origin.
Generate a list of 0 to 32 elements, using the given generator for items.
Generate a parameter value between 0 and 1.