Subdivide the unit ball or sphere into approximately equal simplices in arbitrary dimenions.

1 2 3 4 5 | ```
UnitSphere(n, k, method = "dyadic", p = 2, positive.only = FALSE)
UnitSphereEdgewise(n, k, p, positive.only)
UnitSphereDyadic(n, k, start = "diamond", p, positive.only)
UnitBall( n, k, method="dyadic", p=2, positive.only=FALSE )
LpNorm(x, p)
``` |

`n` |
Dimension of the space; the unit sphere is an (n-1) dimensional manifold |

`k` |
Number of subdivisions |

`method` |
"dyadic" or "edgewise": the former recursively subdivides the sphere to get a more uniform grid; the latter uses a faster method using one edgewise subdivision. |

`p` |
Power used in the l^p norm; p=2 is the Euclidean norm |

`positive.only` |
TRUE means restrict to the positive orthant; FALSE gives the full ball |

`start` |
starting shape: "diamond" or "icosahedron" |

`x` |
Matrix of points in n-dimensions; each column is a point in R^n |

`UnitSphere`

computes a hyperspherical triangle approximation to the unit sphere.
It calls either `UnitSphereDyadic`

or `UnitSphereEdgewise`

based on 'method'. Both work by subdividing the first octant, and then rotating that
subdivision around to other octants. This is important for some uses of these functions; it
guarantees that all vertices of a simplex are in a single octant.
Note that 'k' has a different meaning for the different methods. When
method="dyadic", k specifies the number of dyadic subdivisions. When method="edgewise",
k specifies the number of subdivisions as in `UnitSimplex`

, which is then
projected outward to the unit sphere. So when n=2, a dyadic subdivision with k=2 will
result in 16 edges, whereas an edgewise subdivions with k=2 results in 8 edges.

`UnitBall`

computes an approximate simplicial approximation to the unit ball. Specifically,
it generates cones with one vertex at the origin and the other vertices on the surface
of the unit sphere; these later vertices are from `UnitSphere`

. If k is large, these cones
will be very narrow/thin.

an object of class "mvmesh" as described in `mvmesh`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ```
UnitSphere( n=2, k=2, method="edgewise", positive.only=TRUE )
UnitSphere( n=2, k=2, method="edgewise" )
UnitSphere( n=3, k=2, method="edgewise", positive.only=TRUE )
UnitSphere( n=3, k=2, method="edgewise" )
UnitBall( n=2, k=2, method="edgewise", positive.only=TRUE )
UnitBall( n=2, k=2, method="edgewise" )
UnitSphere( n=3, k=2, method="dyadic", positive.only=TRUE )
UnitSphere( n=3, k=2, method="dyadic" )
UnitBall( n=3, k=2, method="dyadic", positive.only=TRUE )
UnitBall( n=3, k=2, method="dyadic" )
UnitSphere( n=3, k=2 )
UnitBall( n=3, k=2 )
x <- c(3,-1,2)
LpNorm( x, p=2 )
## Not run:
plot( UnitSphere( n=3, k=2 ), show.label=TRUE )
plot( UnitBall( n=3, k=2 ) )
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.