Maths.PseudoRandom
Central utilities for creating random engines and random collections.
Methods
CirclesOnDiscFibonacci
#Create a circle packing on the interior of a disc.
CirclesOnDiscStacked
#Create a circle packing on the interior of a disc.
CirclesOnSphericalPoints
#Place circles on point coordinates assumed to lie on a sphere with origin at (0,0,0).
Returns: Array of non-intersecting circles.
CreateRandomEngine
#Create a new instance of a specific generator.
Returns: Non-threadsafe random number generator.
DilatePointsWithinBox
#Dilates the specified array of 3D points outward from a given origin so that all points remain within the defined box dimensions, and retains only the specified number of points closest to the origin after dilation.
public static void DilatePointsWithinBox()
points,
A reference to an array of Point3d structures representing the points to be dilated. The array is modified in place to contain only the closest points after dilation.
count,
The number of points to retain after dilation. Must be less than or equal to the length of the points array.
length,
An Interval that defines the allowable range for the x-coordinates of the box within which the points will be dilated.
width,
An Interval that defines the allowable range for the y-coordinates of the box within which the points will be dilated.
height,
An Interval that defines the allowable range for the z-coordinates of the box within which the points will be dilated.
origin
The origin point from which the dilation is performed. Points are scaled outward from this location.
Remarks: If the number of points in the array is less than or equal to the specified count, the method does not modify the array. The order of points in the resulting array may differ from the original order.
DilatePointsWithinCircle
#Spatially inflate an array of points until all but N are outside a circle.
DilatePointsWithinCircle
#Spatially inflate an array of points until all but N are outside a circle.
DilatePointsWithinRectangle
#Spatially inflate an array of points until all but N are outside an axis aligned rectangle.
public static void DilatePointsWithinRectangle()
points,
Points to scale.
count,
Number of points to retain.
width,
Width of axis aligned rectangle.
height,
Height of axis aligned rectangle.
origin
Scaling origin point. If the origin does not lie within the rectangle, the results cannot be trusted.
DilatePointsWithinRectangle
#Spatially inflate an array of points until all but N are outside an axis aligned rectangle.
DilatePointsWithinRectangle
#Spatially inflate an array of points until all but N are outside an axis aligned rectangle.
public static void DilatePointsWithinRectangle()
points,
Points to scale.
count,
Number of points to retain.
width,
Width of axis aligned rectangle.
height,
Height of axis aligned rectangle.
origin
Scaling origin point. If the origin does not lie within the rectangle, the results cannot be trusted.
DilatePointsWithinSphere
#Dilates a specified number of points within a defined spherical region, scaling their positions relative to a center point.
public static void DilatePointsWithinSphere()
points,
An array of Point3d structures representing the points to be dilated. The method modifies this array to contain only the dilated points.
count,
The number of points to retain after dilation. Must be less than or equal to the length of the points array.
centre,
The center point of the sphere around which the dilation occurs.
radius
The radius of the sphere within which points will be dilated. Must be a positive value.
Remarks: The method performs a partial sort to efficiently determine which points are closest to the center before applying the dilation. It modifies the input array to contain only the dilated points.
FibonacciHalfSphere
#Generates the coordinates of a Fibonacci point sampling on the upper half of the unit sphere.
FibonacciUnitDisc
#Generates the coordinates of a Fibonacci point sampling on the unit disc.
FibonacciUnitSphere
#Generates the coordinates of a Fibonacci point sampling on the unit sphere.
FibonacciUnitSquare
#Generates the coordinates of a Fibonacci point sampling on the unit square.
FormatEngineAlgorithm
#Create a human-centric string which describes a certain random algorithm.
ParseEngineAlgorithm
#Try and parse a random engine by name.
Poisson2D
#Create a two-dimensional Poisson sampling with a variable separation radius. This algorithm relies on slow spatial lookup of neighbouring coordinates since no assumptions can be made regarding the minimum allowed spacing across the entire field. As a result this method probably will not yield the same distribution as the Poisson2D method which takes a constant radius value.
public static Point2d[] Poisson2D()
engine,
Random engine.
setup,
Properties for poisson distribution.
density
Minimum allowed distance between samples. This function will be sampled and obeyed locally. It is entirely possible that a point pair exists in the final distribution closer together than one of the points local radius constraint.
Returns: An array of two-dimensional coordinates within the (min, max) region.
Poisson2D
#Create a two-dimensional Poisson sampling with a constant separation radius.
Returns: An array of two-dimensional coordinates within the (min, max) region, no two of which are closer than the specified radius.
Populate1D
#Randomly populate a one-dimensional interval. This method works by randomly dividing the longest remaining interval into two until a fixed number of values has been found.
Returns: An array of numbers between min and max.
RandomIntegers
#Generate an enumeration of random, non-negative integers.
Returns: Infinite collection of random integers.
RandomIntegers
#Generate an enumeration of random, non-negative integers.
Returns: Infinite collection of random integers.
RandomIntegers
#Generate an enumeration of random, non-negative integers.
Returns: Infinite collection of random integers.
RandomIntegers
#Generate an enumeration of random, non-negative integers.
Returns: Infinite collection of random integers.
RandomNumbers
#Generate an enumeration of random, non-negative integers.
Returns: Infinite collection of random integers.
RandomNumbers
#Generate an enumeration of random, non-negative integers.
Returns: Infinite collection of random integers.
RandomNumbers
#Generate an enumeration of random, non-negative integers.
Returns: Infinite collection of random integers.
RandomNumbers
#Generate an enumeration of random, non-negative integers.
Returns: Infinite collection of random integers.
VanDerCorputUnitCube
#Create a Van Der Corput distribution within the unit cube.
VanDerCorputUnitSquare
#Generates the coordinates of a van der Corput Quasi random point set on the unit square. The distances between adjacent points are more similar than using a strict pseudo-random distribution, not quite as good as a Poisson distribution but very fast. The x coordinates increase steadily from zero to (n-1)/n, whereas the associated y coordinates are spread out using a quasi-mote-carlo pattern.