Sample points Roughly Uniformly on the surface of an ellipsoid, 2D or 3D
Source:R/from_ellipsoid_rellipsoid.R
rellipsoid.Rd
Sample points Roughly Uniformly on the surface of an ellipsoid, 2D or 3D
Usage
rellipsoid(n, axes = c(1, 1, 1), center, noise.sd = 0, R = NULL, pieces = 1000)
Arguments
- axes
vector giving the semi-axis lengths
- center
center vector, c(x,y) or c(x,y,z)
- noise.sd
noise sd, 0=no noise
- R
rotation matrix
- pieces
Number of pieces to divide the surface into. See details.
Details
Sampling is done by first sampling uniformly on the surface of a sphere and then transforming with the ellipsoid axes. Corrections:
* 2D: The sampling weights are set to piecewise linear approximation of the ellipse surface integral, the resolution of which is controlled by 'pieces'. * 3D: No weighting at the moment, so very biased for elongated ellipsoids.
Additional nD Gaussian noise can be added by setting `noise.sd`>0.