# UnitSphere: Define a mesh on a unit ball in n-dimensions In mvmesh: Multivariate Meshes and Histograms in Arbitrary Dimensions

## Description

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

## Usage

 ```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) ```

## Arguments

 `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

## Details

`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 orthant, and then rotating that subdivision around to other orthants. This is important for some uses of these functions; it guarantees that all vertices of a simplex are in a single orthant. 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.

## Value

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

## Examples

 ``` 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) ```

mvmesh documentation built on Sept. 17, 2017, 1:04 a.m.