Random Point Utilities
These tools are used to help random point generation.
- txpipe.randoms.randoms.random_points_in_quadrilateral(p1, p2, p3, p4, n)[source]
Generate random points uniformly distributed in a quadrilateral.
The points can be in any number of dimensions. If two of them co-incide so you are actually specifying a triangle it will still work.
As long as you specify the vertices consistently either clockwise or anti-clockwise is okay.
- Parameters:
p1 (1D array) – Vector pointing to the first vertex
p2 (1D array) – Vector pointing to the second vertex
p3 (1D array) – Vector pointing to the third vertex
p4 (1D array) – Vector pointing to the fourth vertex
n (int) – Number of points to generate
- Returns:
p – n * ndim array of points in the quadrilateral
- Return type:
array
- txpipe.randoms.randoms.random_points_in_triangle(p1, p2, p3, n)[source]
Generate random points uniformly distributed in a triangle.
The points can be in any number of dimensions.
- Parameters:
p1 (1D array) – Vector pointing to the first vertex
p2 (1D array) – Vector pointing to the second vertex
p3 (1D array) – Vector pointing to the third vertex
n (int) – Number of points to generate
- Returns:
p – n * ndim array of points in the triangle
- Return type:
array