swissroll | R Documentation |
Generates points for a Swiss roll graph. The function maps points from the square [0,1]^2
into the Swiss roll using the specified transformations.
swissroll(N = 500, seed = NULL, a = 1, b = 4)
N |
Number of points drawn (numeric). |
seed |
Optionally specify a RNG seed for reproducible experiments (numeric). |
a , b |
Shape parameters (numeric). |
Given points (x,y)
within the unit square [0,1]^2
, the Swiss roll transformation is achieved using:
Sx = \pi \sqrt{(b^2 - a^2) x + a^2}
and
Sy = \frac{\pi^2 (b^2 - a^2) y}{2}
.
The transformed (x,y)
coordinates are then projected into 3D space to produce the characteristic rolled shape.
N x 3 array for 3d points.
adjacency_mat
## Not run:
pts <- swissroll(N=500, seed=0, a=1, b=4)
plot3D::scatter3D(pts[,1], pts[,2], pts[,3], colvar=NULL, col="red")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.