# voronoisphere.m

Voronoi tessellation on a sphere.

## Syntax

```    [vertices,indices,polygons,sangles]=voronoisphere(xyz,res)
```

## Arguments

```    xyz      - (3 x n) array, coordinates of n distinct vectors
in R^3; these will be normalised

res      - polygon edges longer than this resolution will
have extra points added so that spherical plots
look neat (optional, default is pi/180)
```

## Outputs

```    vertices - (3 x m) array, coordinates of the vertices of the
Voronoi tessellation

indices  - (n x 1) cell array, j-th element contains the in-
dices of the Voronoi cell vertices that corres-
pond to xyz(:,j). Vertices are oriented counter-
clockwise when looking from outside.

polygons - (n x 1) cell array, j-th element contains the dis-
cretised spherical polygonal coordinates of the
vertices of the j-th Voronoi cell.

sangles  - (n x 1) array, solid angles of each Voronoi cell
```

## Examples

The output of fundamentals/quadratures/grid_diagrams.m file in the Spinach example set is given below. The solid lines are edges of Voronoi polyhedra computed using this function.
{"ft_lang_label":"__label__en","ft_lang_prob":0.706908,"math_prob":0.8790787,"size":1118,"snap":"2021-31-2021-39","text_gpt3_token_len":280,"char_repetition_ratio":0.14003591,"word_repetition_ratio":0.09580839,"special_character_ratio":0.21824686,"punctuation_ratio":0.125,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9957662,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-09-21T05:43:15Z\",\"WARC-Record-ID\":\"<urn:uuid:f6c4dfb5-a554-4941-8cfb-656d28d7113d>\",\"Content-Length\":\"15582\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:5cce2b8c-30fb-4856-b272-f723597f0406>\",\"WARC-Concurrent-To\":\"<urn:uuid:46220266-e892-4b7b-8025-9b1779182488>\",\"WARC-IP-Address\":\"83.170.108.1\",\"WARC-Target-URI\":\"https://spindynamics.org/wiki/index.php?title=Voronoisphere.m&printable=yes\",\"WARC-Payload-Digest\":\"sha1:QO2E45SZUCGKWDGTEKC6JORZFIYWGE5N\",\"WARC-Block-Digest\":\"sha1:SBD7EWHKZRX7KTVDJ5GFUQAZ42PI73ZY\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-39/CC-MAIN-2021-39_segments_1631780057158.19_warc_CC-MAIN-20210921041059-20210921071059-00677.warc.gz\"}"}