# \[GIF\] Loxo (Voronoi cells of stereographically projected loxodrome points)

**URL:** <https://community.wolfram.com/t/gif-loxo-voronoi-cells-of-stereographically-projected-loxodrome-points/12016>\
**Category:** Staff Picks\
**Tags:** computational-arts, geometry, graphics-and-visualization, interface-construction, staff-pick\
**Created:** [February 26, 2018, 1:06am UTC](https://community.wolfram.com/t/gif-loxo-voronoi-cells-of-stereographically-projected-loxodrome-points/12016 "2018-02-26T01:06:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![claytonshonkwiler](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/claytonshonkwiler/32/24940_2.png) [@claytonshonkwiler](https://community.wolfram.com/u/claytonshonkwiler)\
**Post date:** [February 26, 2018, 1:06am UTC](https://community.wolfram.com/t/gif-loxo-voronoi-cells-of-stereographically-projected-loxodrome-points/12016/1 "2018-02-26T01:06:46Z")

</div>

![loxo4c.gif](https://global.discourse-cdn.com/wolfram/original/3X/5/a/5a0502f2cea320edfba0181de5e02cb73d910fbb.gif)

**Loxo**

This is very similar to the idea in [_Caught_](https://wolfram.discourse.group/t/11975/1) ; here I’m generating a bunch of points on 10 different (congruent) loxodromes on the sphere, rotating the sphere, stereographically projecting the points to the plane, then forming the Voronoi cells of the resulting point set. The idea comes from [Vincent Pantaloni’s misinterpretation of what was going on in _Caught_](https://twitter.com/panlepan/status/964842164927811585); he thought I was using loxodromes, which I wasn’t but seemed like a cool idea.

Anyway, to create the animation, first we need the stereographic projection function:

```
Stereo[p_] := p[[;; -2]]/(1 - p[[-1]])

```

Next, we need the points on 10 loxodromes:

```
pts = With[{n = 10},
   Flatten[
    Table[
     1/Sqrt[1 + t^2] {Cos[t + ? + #], Sin[t + ? + #], -t} &[RandomVariate[NormalDistribution[0, .0001]]],
     {?, 0., 2 ? - 2 ?/n, 2 ?/n}, {t, -60., 
      60, .2}],
    1]
   ];

```

The `RandomVariate[]` business is superfluous mathematically, but helps prevent `VoronoiMesh[]` from failing. Here’s a visualization of those points on the sphere:

 ![Untitled-43.png](https://global.discourse-cdn.com/wolfram/original/3X/b/9/b924d329a0b9d285698fa01e751a805dfb1e3db5.png)

And then, finally, we can put the animation together:

```
With[{cols = RGBColor /@ {"#DA0463", "#283149"}},
 Manipulate[
  VoronoiMesh[
   Stereo[RotationMatrix[?, {1., 0, 0}].#] & /@ pts,
   {{-4.1, 4.1}, {-4.1, 4.1}},
   PlotTheme -> "Lines", PlotRange -> 4, ImageSize -> 540, Background -> cols[[-1]], 
   MeshCellStyle -> {{1, All} -> Directive[Thickness[.005], cols[[1]]]}],
  {?, 0, ?}
  ]
 ]

```

---

<div class="post-metadata">

**Author:** ![wolframcommunity](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wolframcommunity/32/8335_2.png) [@wolframcommunity](https://community.wolfram.com/u/wolframcommunity)\
**Post date:** [March 1, 2018, 6:04pm UTC](https://community.wolfram.com/t/gif-loxo-voronoi-cells-of-stereographically-projected-loxodrome-points/12016/2 "2018-03-01T18:04:08Z")

</div>

![2015-11-02_10-07-11.png](https://global.discourse-cdn.com/wolfram/original/3X/5/0/50e59c9ead62f729e7130d3ea1482555a75602b6.png)

- Congratulations! This post is now a [Staff Pick](http://community.wolfram.com/content?curTag=staff+picks) as distinguished by a badge on [your profile](http://community.wolfram.com/web/claytonshonkwiler)! Thank you, keep it coming!

---

<div class="post-metadata">

**Author:** ![ramoh87](https://avatars.discourse-cdn.com/v4/letter/r/f19dbf/32.png) [@ramoh87](https://community.wolfram.com/u/ramoh87)\
**Post date:** [March 1, 2018, 7:18pm UTC](https://community.wolfram.com/t/gif-loxo-voronoi-cells-of-stereographically-projected-loxodrome-points/12016/3 "2018-03-01T19:18:51Z")

</div>

This is so cool, thanks for the great work.  
Can you tell me which Mathematica version did you write this code ?  
I tried to used Mathematica 9 but it seems it doesn’t recognize `VoronioMesh` and `MeshCellStyle` function

---

<div class="post-metadata">

**Author:** ![claytonshonkwiler](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/claytonshonkwiler/32/24940_2.png) [@claytonshonkwiler](https://community.wolfram.com/u/claytonshonkwiler)\
**Post date:** [March 1, 2018, 7:59pm UTC](https://community.wolfram.com/t/gif-loxo-voronoi-cells-of-stereographically-projected-loxodrome-points/12016/4 "2018-03-01T19:59:35Z")

</div>

I’m on Mathematica 11, and it looks like `VoronoiMesh` and `MeshCellStyle` were both introduced in Mathematica 10.
