generate_base_points#
- generate_base_points(num_points, domain_size, reflect=True)[source]#
Generates a set of randomly distributed points in rectilinear coordinates for use in spatial tessellations
The points can be distributed in spherical, cylindrical, or rectilinear domains, as well as 2D and 3D (disks and squares)
- Parameters:
num_points (scalar) – The number of base points that lie within the domain
domain_size (list or array) –
Controls the size and shape of the domain, as follows:
shape
result
[x, y, z]
A 3D cubic domain of dimension x, y and z, with points in the range [0:x, 0:y, 0:z]
[x, y, 0]
A 2D square domain of size x by y, with points in the range [0:x, 0:y, 0:0]
[r, z]
A 3D cylindrical domain of radius r and height z, with points in the range [-r:r, -r:r, 0:z]
[r, 0]
A 2D circular domain of radius r, with points in the range [-r:r, -r:r, 0:0]
[r]
A 3D spherical domain of radius r, with points in the range [-r:r, -r:r, -r:r]
reflect (bool) – If
True
, the base points are generated as specified then reflected about each face of the domain. This essentially tricks the tessellation functions into creating smooth faces at the boundaries once these excess points are trimmed. Note that the surface is not perfectly smooth for the curved faces.f (float) – The fraction of points which should be reflected. The default is 1 which reflects all the points in the domain, but this can lead to a lot of unnecessary points, so setting to 0.1 or 0.2 helps speed, but risks that the tessellation may not have smooth faces if not enough points are reflected.
Notes
To convert between coordinate systems see
cart2sph
andcart2cyl