sampleOnMesh: Sampling on a mesh

View source: R/sampling.R

sampleOnMeshR Documentation

Sampling on a mesh

Description

Uniformly samples points on a mesh.

Usage

sampleOnMesh(n, mesh)

Arguments

n

number of simulations, a positive integer

mesh

either a list containing (at least) two fields vertices (numeric matrix with three columns) and faces (integer matrix or list of integer vectors), otherwise a rgl mesh (i.e. a mesh3d object)

Value

The simulated points on a matrix with three columns.

Examples

library(MeshesOperations)
library(rgl)
mesh <- torusMesh(R = 4, r = 2)
sims <- sampleOnMesh(200, mesh)
open3d(windowRect = c(50, 50, 562, 562))
view3d(0, 0, zoom = 0.75)
shade3d(mesh, color = "yellow")
points3d(sims, size = 5)

stla/MeshesOperations documentation built on Oct. 23, 2022, 8:23 a.m.