random_points_on_mesh
random_points_on_mesh(V, F, n, rng=np.random.default_rng(), color='white', per_element_likelihood=None, return_indices=False)
Samples a mesh V,F according to a given distribution. Valid meshes are polylines or triangle meshes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
V |
(n_v,d) numpy array
|
vertex list of vertex positions |
required |
F |
(m,k) numpy int array
|
if k==2, interpret input as ordered polyline; if k==3 numpy int array, interpred as face index list of a triangle mesh |
required |
rng |
numpy rng, optional (default: new `np.random.default_rng()`)
|
which numpy random number generator to use |
default_rng()
|
n |
int
|
how many points to sample |
required |
color |
"Noise color" of the distribution used for sampling. Right now, only "white" is supported, which corresponds to a uniform distribution. |
'white'
|
|
per_element_likelihood |
If given, the likelihood of sampling a point from each element (does not need to be normalized). If not given, all elements are equally likely. |
None
|
|
return_indices |
bool, optional (default: False)
|
Whether to return the indices for each element along with the barycentric coordinates of the sampled points within each element |
False
|
Returns:
Name | Type | Description |
---|---|---|
x |
(n,d) numpy array
|
the n sampled points |
I |
(n,) numpy int array
|
element indices where sampled points lie (if requested) |
u |
(n,k) numpy array
|
barycentric coordinates for sampled points in I |
Examples:
TODO
Source code in src/gpytoolbox/random_points_on_mesh.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|