{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f88c95dc",
   "metadata": {},
   "source": [
    "# `geomSpoke()`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e0c1ea2b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"U3UIVB\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
       "       if(!window.letsPlotCallQueue) {\n",
       "           window.letsPlotCallQueue = [];\n",
       "       }; \n",
       "       window.letsPlotCall = function(f) {\n",
       "           window.letsPlotCallQueue.push(f);\n",
       "       };\n",
       "       (function() {\n",
       "           var script = document.createElement(\"script\");\n",
       "           script.type = \"text/javascript\";\n",
       "           script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.2.0/js-package/distr/lets-plot.min.js\";\n",
       "           script.onload = function() {\n",
       "               window.letsPlotCall = function(f) {f();};\n",
       "               window.letsPlotCallQueue.forEach(function(f) {f();});\n",
       "               window.letsPlotCallQueue = [];\n",
       "               \n",
       "               \n",
       "           };\n",
       "           script.onerror = function(event) {\n",
       "               window.letsPlotCall = function(f) {};\n",
       "               window.letsPlotCallQueue = [];\n",
       "               var div = document.createElement(\"div\");\n",
       "               div.style.color = 'darkred';\n",
       "               div.textContent = 'Error loading Lets-Plot JS';\n",
       "               document.getElementById(\"U3UIVB\").appendChild(div);\n",
       "           };\n",
       "           var e = document.getElementById(\"U3UIVB\");\n",
       "           e.appendChild(script);\n",
       "       })();\n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%useLatestDescriptors\n",
    "%use lets-plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "fa88b440",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Lets-Plot Kotlin API v.4.6.0. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.2.0."
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "LetsPlot.getInfo()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "contrary-baltimore",
   "metadata": {},
   "outputs": [],
   "source": [
    "fun linspace(start: Double, stop: Double, num: Int): DoubleArray {\n",
    "    return DoubleArray(num) { i -> start + i * (stop - start) / (num - 1) }\n",
    "}\n",
    "\n",
    "fun meshgrid(x: DoubleArray, y: DoubleArray): Pair<DoubleArray, DoubleArray> {\n",
    "    val X = DoubleArray(x.size * y.size) { i -> x[i % x.size] }\n",
    "    val Y = DoubleArray(x.size * y.size) { i -> y[i / x.size] }\n",
    "    return Pair(X, Y)\n",
    "}\n",
    "  \n",
    "fun gradient(Z: DoubleArray, d: Double, n: Int): Pair<DoubleArray, DoubleArray> {\n",
    "    val matrix = Z.toList().chunked(n)\n",
    "    val dY = mutableListOf<Double>()\n",
    "    val dX = mutableListOf<Double>()\n",
    "    for (i in 0 until n) {\n",
    "        for (j in 0 until n) {\n",
    "            val y = if (i > 0) (matrix[i][j] - matrix[i - 1][j]) / d else 0.0\n",
    "            val x = if (j > 0) (matrix[i][j] - matrix[i][j - 1]) / d else 0.0\n",
    "            dY += y\n",
    "            dX += x\n",
    "        }\n",
    "    }\n",
    "    return Pair(dY.toDoubleArray(), dX.toDoubleArray())\n",
    "}\n",
    "\n",
    "fun getData(n: Int, a: Double, b: Double, f: (DoubleArray, DoubleArray) -> DoubleArray): Map<String, Any> {\n",
    "    val d = (b - a) / (n - 1)\n",
    "    \n",
    "    val xrange = linspace(a, b, n)\n",
    "    val yrange = linspace(a, b, n)\n",
    "    \n",
    "    val (x, y) = meshgrid(xrange, yrange)\n",
    "    val z = f(x, y)\n",
    "\n",
    "    val (dY, dX) = gradient(z, d, n)\n",
    "    val r = DoubleArray(dX.size) { index -> sqrt(dX[index].pow(2) + dY[index].pow(2)) }\n",
    "    val rMax = r.max()\n",
    "    val radius = DoubleArray(r.size) { index -> r[index] / rMax * d }\n",
    "    val angle = DoubleArray(dY.size) { index -> atan2(dY[index], dX[index]) }\n",
    "    \n",
    "    return mapOf(\n",
    "        \"x\" to x, \n",
    "        \"y\" to y, \n",
    "        \"z\" to z, \n",
    "        \"radius\" to radius, \n",
    "        \"angle\" to angle\n",
    "    )\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "likely-samba",
   "metadata": {},
   "outputs": [],
   "source": [
    "val data = getData(n = 21, a = -2*PI, b = 2*PI) { xArray, yArray ->\n",
    "    DoubleArray(xArray.size) { index -> sin(xArray[index]) + cos(yArray[index]) }\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "absent-blame",
   "metadata": {},
   "outputs": [],
   "source": [
    "val p = letsPlot(data) { x = \"x\"; y = \"y\"  } + \n",
    "    coordFixed() + themeVoid() +\n",
    "    scaleViridis(listOf(\"fill\", \"color\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "54a0a66d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"z2YdnT\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "\"x\":\"x\",\n",
       "\"y\":\"y\"\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"fixed\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"data\":{\n",
       "\"x\":[-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586],\n",
       "\"y\":[-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586],\n",
       "\"z\":[1.0000000000000002,1.5877852522924734,1.9510565162951536,1.9510565162951536,1.587785252292473,0.9999999999999999,0.41221474770752675,0.04894348370484636,0.04894348370484647,0.41221474770752686,1.0,1.5877852522924725,1.9510565162951536,1.9510565162951536,1.5877852522924734,1.0000000000000002,0.412214747707527,0.04894348370484647,0.04894348370484636,0.41221474770752664,0.9999999999999998,0.8090169943749476,1.3968022466674208,1.760073510670101,1.7600735106701009,1.3968022466674204,0.8090169943749472,0.2212317420824741,-0.1420395219202063,-0.1420395219202062,0.2212317420824742,0.8090169943749473,1.3968022466674197,1.7600735106701009,1.760073510670101,1.3968022466674206,0.8090169943749475,0.22123174208247431,-0.1420395219202062,-0.1420395219202063,0.22123174208247398,0.8090169943749471,0.30901699437494745,0.8968022466674206,1.2600735106701009,1.2600735106701006,0.8968022466674203,0.3090169943749471,-0.278768257917526,-0.6420395219202064,-0.6420395219202063,-0.2787682579175259,0.30901699437494723,0.8968022466674196,1.2600735106701006,1.2600735106701009,0.8968022466674205,0.30901699437494734,-0.2787682579175258,-0.6420395219202063,-0.6420395219202064,-0.27876825791752613,0.309016994374947,-0.30901699437494734,0.2787682579175258,0.6420395219202061,0.642039521920206,0.27876825791752546,-0.3090169943749477,-0.8968022466674208,-1.260073510670101,-1.260073510670101,-0.8968022466674207,-0.30901699437494756,0.2787682579175248,0.642039521920206,0.6420395219202061,0.2787682579175257,-0.30901699437494745,-0.8968022466674206,-1.260073510670101,-1.260073510670101,-0.8968022466674209,-0.3090169943749478,-0.8090169943749473,-0.2212317420824742,0.14203952192020608,0.14203952192020597,-0.22123174208247454,-0.8090169943749477,-1.3968022466674208,-1.760073510670101,-1.760073510670101,-1.3968022466674208,-0.8090169943749476,-0.2212317420824752,0.14203952192020597,0.14203952192020608,-0.22123174208247431,-0.8090169943749475,-1.3968022466674206,-1.760073510670101,-1.760073510670101,-1.3968022466674208,-0.8090169943749478,-0.9999999999999998,-0.41221474770752664,-0.04894348370484636,-0.04894348370484647,-0.412214747707527,-1.0000000000000002,-1.5877852522924734,-1.9510565162951536,-1.9510565162951536,-1.5877852522924731,-1.0,-0.41221474770752764,-0.04894348370484647,-0.04894348370484636,-0.41221474770752675,-0.9999999999999999,-1.587785252292473,-1.9510565162951536,-1.9510565162951536,-1.5877852522924734,-1.0000000000000002,-0.8090169943749471,-0.22123174208247398,0.1420395219202063,0.1420395219202062,-0.22123174208247431,-0.8090169943749475,-1.3968022466674206,-1.760073510670101,-1.7600735106701009,-1.3968022466674204,-0.8090169943749473,-0.22123174208247498,0.1420395219202062,0.1420395219202063,-0.2212317420824741,-0.8090169943749472,-1.3968022466674204,-1.7600735106701009,-1.760073510670101,-1.3968022466674208,-0.8090169943749476,-0.3090169943749471,0.278768257917526,0.6420395219202063,0.6420395219202062,0.2787682579175257,-0.30901699437494745,-0.8968022466674206,-1.260073510670101,-1.2600735106701009,-0.8968022466674205,-0.30901699437494734,0.278768257917525,0.6420395219202062,0.6420395219202063,0.2787682579175259,-0.30901699437494723,-0.8968022466674204,-1.2600735106701009,-1.260073510670101,-0.8968022466674207,-0.30901699437494756,0.3090169943749477,0.8968022466674208,1.260073510670101,1.260073510670101,0.8968022466674205,0.30901699437494734,-0.2787682579175258,-0.6420395219202062,-0.6420395219202061,-0.2787682579175257,0.30901699437494745,0.8968022466674198,1.260073510670101,1.260073510670101,0.8968022466674207,0.30901699437494756,-0.2787682579175256,-0.6420395219202061,-0.6420395219202062,-0.2787682579175259,0.30901699437494723,0.8090169943749477,1.3968022466674208,1.760073510670101,1.760073510670101,1.3968022466674204,0.8090169943749473,0.2212317420824742,-0.1420395219202062,-0.14203952192020608,0.22123174208247431,0.8090169943749475,1.39680224666742,1.760073510670101,1.760073510670101,1.3968022466674208,0.8090169943749476,0.22123174208247443,-0.14203952192020608,-0.1420395219202062,0.2212317420824741,0.8090169943749472,1.0000000000000002,1.5877852522924734,1.9510565162951536,1.9510565162951536,1.587785252292473,0.9999999999999999,0.41221474770752675,0.04894348370484636,0.04894348370484647,0.41221474770752686,1.0,1.5877852522924725,1.9510565162951536,1.9510565162951536,1.5877852522924734,1.0000000000000002,0.412214747707527,0.04894348370484647,0.04894348370484636,0.41221474770752664,0.9999999999999998,0.8090169943749482,1.3968022466674213,1.7600735106701015,1.7600735106701015,1.396802246667421,0.8090169943749479,0.22123174208247476,-0.14203952192020564,-0.14203952192020552,0.22123174208247487,0.809016994374948,1.3968022466674204,1.7600735106701015,1.7600735106701015,1.3968022466674213,0.8090169943749481,0.22123174208247498,-0.14203952192020552,-0.14203952192020564,0.22123174208247465,0.8090169943749478,0.3090169943749477,0.8968022466674208,1.260073510670101,1.260073510670101,0.8968022466674205,0.30901699437494734,-0.2787682579175258,-0.6420395219202062,-0.6420395219202061,-0.2787682579175257,0.30901699437494745,0.8968022466674198,1.260073510670101,1.260073510670101,0.8968022466674207,0.30901699437494756,-0.2787682579175256,-0.6420395219202061,-0.6420395219202062,-0.2787682579175259,0.30901699437494723,-0.3090169943749471,0.278768257917526,0.6420395219202063,0.6420395219202062,0.2787682579175257,-0.30901699437494745,-0.8968022466674206,-1.260073510670101,-1.2600735106701009,-0.8968022466674205,-0.30901699437494734,0.278768257917525,0.6420395219202062,0.6420395219202063,0.2787682579175259,-0.30901699437494723,-0.8968022466674204,-1.2600735106701009,-1.260073510670101,-0.8968022466674207,-0.30901699437494756,-0.8090169943749471,-0.22123174208247398,0.1420395219202063,0.1420395219202062,-0.22123174208247431,-0.8090169943749475,-1.3968022466674206,-1.760073510670101,-1.7600735106701009,-1.3968022466674204,-0.8090169943749473,-0.22123174208247498,0.1420395219202062,0.1420395219202063,-0.2212317420824741,-0.8090169943749472,-1.3968022466674204,-1.7600735106701009,-1.760073510670101,-1.3968022466674208,-0.8090169943749476,-0.9999999999999998,-0.41221474770752664,-0.04894348370484636,-0.04894348370484647,-0.412214747707527,-1.0000000000000002,-1.5877852522924734,-1.9510565162951536,-1.9510565162951536,-1.5877852522924731,-1.0,-0.41221474770752764,-0.04894348370484647,-0.04894348370484636,-0.41221474770752675,-0.9999999999999999,-1.587785252292473,-1.9510565162951536,-1.9510565162951536,-1.5877852522924734,-1.0000000000000002,-0.8090169943749473,-0.2212317420824742,0.14203952192020608,0.14203952192020597,-0.22123174208247454,-0.8090169943749477,-1.3968022466674208,-1.760073510670101,-1.760073510670101,-1.3968022466674208,-0.8090169943749476,-0.2212317420824752,0.14203952192020597,0.14203952192020608,-0.22123174208247431,-0.8090169943749475,-1.3968022466674206,-1.760073510670101,-1.760073510670101,-1.3968022466674208,-0.8090169943749478,-0.30901699437494734,0.2787682579175258,0.6420395219202061,0.642039521920206,0.27876825791752546,-0.3090169943749477,-0.8968022466674208,-1.260073510670101,-1.260073510670101,-0.8968022466674207,-0.30901699437494756,0.2787682579175248,0.642039521920206,0.6420395219202061,0.2787682579175257,-0.30901699437494745,-0.8968022466674206,-1.260073510670101,-1.260073510670101,-0.8968022466674209,-0.3090169943749478,0.30901699437494745,0.8968022466674206,1.2600735106701009,1.2600735106701006,0.8968022466674203,0.3090169943749471,-0.278768257917526,-0.6420395219202064,-0.6420395219202063,-0.2787682579175259,0.30901699437494723,0.8968022466674196,1.2600735106701006,1.2600735106701009,0.8968022466674205,0.30901699437494734,-0.2787682579175258,-0.6420395219202063,-0.6420395219202064,-0.27876825791752613,0.309016994374947,0.8090169943749476,1.3968022466674208,1.760073510670101,1.7600735106701009,1.3968022466674204,0.8090169943749472,0.2212317420824741,-0.1420395219202063,-0.1420395219202062,0.2212317420824742,0.8090169943749473,1.3968022466674197,1.7600735106701009,1.760073510670101,1.3968022466674206,0.8090169943749475,0.22123174208247431,-0.1420395219202062,-0.1420395219202063,0.22123174208247398,0.8090169943749471,1.0000000000000002,1.5877852522924734,1.9510565162951536,1.9510565162951536,1.587785252292473,0.9999999999999999,0.41221474770752675,0.04894348370484636,0.04894348370484647,0.41221474770752686,1.0,1.5877852522924725,1.9510565162951536,1.9510565162951536,1.5877852522924734,1.0000000000000002,0.412214747707527,0.04894348370484647,0.04894348370484636,0.41221474770752664,0.9999999999999998]\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_cmap\"\n",
       "},{\n",
       "\"aesthetic\":\"color\",\n",
       "\"scale_mapper_kind\":\"color_cmap\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"fill\":\"z\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"tile\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "}\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"z2YdnT\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p + geomBin2D(stat = Stat.identity) { fill = \"z\" }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "twenty-watershed",
   "metadata": {},
   "source": [
    "#### 1. Use `geomSpoke()` to Indicate the Direction and Distance (or Speed)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "58ae9962",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"rtlfpW\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "\"x\":\"x\",\n",
       "\"y\":\"y\"\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"fixed\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"data\":{\n",
       "\"x\":[-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586,-6.283185307179586,-5.654866776461628,-5.026548245743669,-4.39822971502571,-3.7699111843077517,-3.141592653589793,-2.5132741228718345,-1.8849555921538759,-1.2566370614359172,-0.6283185307179586,0.0,0.6283185307179577,1.2566370614359172,1.8849555921538759,2.5132741228718345,3.141592653589793,3.7699111843077517,4.39822971502571,5.026548245743669,5.654866776461628,6.283185307179586],\n",
       "\"y\":[-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-6.283185307179586,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.654866776461628,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-5.026548245743669,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-4.39822971502571,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.7699111843077517,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-3.141592653589793,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-2.5132741228718345,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.8849555921538759,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-1.2566370614359172,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,-0.6283185307179586,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,0.6283185307179577,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.2566370614359172,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,1.8849555921538759,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,2.5132741228718345,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,3.7699111843077517,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,4.39822971502571,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.026548245743669,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,5.654866776461628,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586,6.283185307179586],\n",
       "\"angle\":[0.0,0.0,0.0,0.0,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,0.0,0.0,0.0,0.0,0.0,0.0,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,3.141592653589793,0.0,0.0,-1.5707963267948966,-0.31415926535897926,-0.4840199694179893,-1.570796326794898,-2.657572684171804,-2.827433388230814,-2.827433388230814,-2.6575726841718037,-1.5707963267948961,-0.4840199694179893,-0.3141592653589794,-0.31415926535898,-0.4840199694179887,-1.5707963267948954,-2.6575726841718037,-2.827433388230814,-2.827433388230814,-2.6575726841718037,-1.5707963267948972,-0.48401996941798947,-0.3141592653589794,-1.5707963267948966,-0.7048717707030306,-0.9424777960769385,-1.5707963267948972,-2.199114857512855,-2.4367208828867626,-2.4367208828867626,-2.199114857512855,-1.5707963267948963,-0.942477796076938,-0.7048717707030305,-0.7048717707030312,-0.9424777960769375,-1.5707963267948961,-2.199114857512855,-2.4367208828867626,-2.4367208828867626,-2.199114857512855,-1.570796326794897,-0.9424777960769383,-0.7048717707030305,-1.5707963267948966,-0.8104785342840821,-1.0394066751345434,-1.570796326794897,-2.1021859784552506,-2.331114119305711,-2.331114119305711,-2.10218597845525,-1.5707963267948966,-1.0394066751345432,-0.8104785342840821,-0.8104785342840828,-1.039406675134542,-1.5707963267948963,-2.10218597845525,-2.331114119305711,-2.331114119305711,-2.1021859784552506,-1.5707963267948966,-1.0394066751345434,-0.8104785342840821,-1.5707963267948966,-0.7048717707030305,-0.9424777960769383,-1.570796326794897,-2.199114857512855,-2.4367208828867626,-2.4367208828867626,-2.199114857512855,-1.5707963267948966,-0.9424777960769383,-0.7048717707030303,-0.7048717707030312,-0.942477796076937,-1.5707963267948963,-2.199114857512855,-2.4367208828867626,-2.4367208828867626,-2.199114857512855,-1.5707963267948966,-0.942477796076938,-0.7048717707030305,-1.5707963267948966,-0.31415926535897915,-0.484019969417989,-1.5707963267948972,-2.6575726841718046,-2.827433388230814,-2.827433388230814,-2.6575726841718037,-1.5707963267948966,-0.4840199694179886,-0.31415926535897915,-0.31415926535897953,-0.48401996941798797,-1.5707963267948961,-2.6575726841718046,-2.8274333882308142,-2.8274333882308142,-2.6575726841718046,-1.5707963267948966,-0.4840199694179893,-0.31415926535897915,1.5707963267948966,0.3141592653589794,0.48401996941798947,1.5707963267948972,2.6575726841718037,2.827433388230814,2.827433388230814,2.657572684171804,1.5707963267948954,0.48401996941798947,0.3141592653589795,0.31415926535897987,0.4840199694179884,1.5707963267948961,2.6575726841718037,2.827433388230814,2.827433388230814,2.6575726841718037,1.570796326794898,0.4840199694179893,0.31415926535897937,1.5707963267948966,0.7048717707030305,0.9424777960769383,1.570796326794897,2.199114857512855,2.4367208828867626,2.4367208828867626,2.199114857512855,1.5707963267948961,0.9424777960769379,0.7048717707030305,0.7048717707030312,0.942477796076937,1.5707963267948963,2.199114857512855,2.4367208828867626,2.4367208828867626,2.199114857512855,1.5707963267948972,0.942477796076938,0.7048717707030305,1.5707963267948966,0.8104785342840821,1.0394066751345434,1.5707963267948966,2.1021859784552506,2.331114119305711,2.331114119305711,2.10218597845525,1.5707963267948963,1.0394066751345432,0.8104785342840821,0.8104785342840828,1.0394066751345423,1.5707963267948966,2.10218597845525,2.331114119305711,2.331114119305711,2.1021859784552506,1.570796326794897,1.0394066751345434,0.8104785342840821,1.5707963267948966,0.7048717707030305,0.9424777960769383,1.5707963267948966,2.1991148575128556,2.4367208828867626,2.4367208828867626,2.199114857512855,1.5707963267948963,0.942477796076938,0.7048717707030305,0.7048717707030311,0.942477796076937,1.5707963267948966,2.199114857512855,2.436720882886763,2.4367208828867626,2.199114857512855,1.570796326794897,0.9424777960769383,0.7048717707030305,1.5707963267948966,0.3141592653589793,0.4840199694179893,1.5707963267948966,2.6575726841718046,2.827433388230814,2.827433388230814,2.657572684171804,1.5707963267948961,0.48401996941798914,0.3141592653589793,0.3141592653589796,0.48401996941798825,1.5707963267948966,2.6575726841718037,2.827433388230814,2.827433388230814,2.657572684171804,1.5707963267948972,0.4840199694179893,0.3141592653589793,-1.5707963267948966,-0.31415926535897865,-0.48401996941798825,-1.5707963267948966,-2.6575726841718055,-2.8274333882308147,-2.8274333882308147,-2.6575726841718055,-1.5707963267948961,-0.4840199694179879,-0.3141592653589784,-0.314159265358979,-0.4840199694179873,-1.5707963267948966,-2.657572684171805,-2.8274333882308147,-2.8274333882308147,-2.6575726841718055,-1.5707963267948972,-0.4840199694179881,-0.3141592653589784,-1.5707963267948966,-0.704871770703031,-0.9424777960769386,-1.5707963267948966,-2.199114857512855,-2.436720882886762,-2.436720882886762,-2.1991148575128547,-1.5707963267948963,-0.9424777960769386,-0.7048717707030311,-0.7048717707030316,-0.9424777960769374,-1.5707963267948966,-2.1991148575128547,-2.436720882886762,-2.436720882886762,-2.1991148575128547,-1.570796326794897,-0.9424777960769387,-0.7048717707030311,-1.5707963267948966,-0.8104785342840821,-1.0394066751345434,-1.570796326794897,-2.1021859784552506,-2.331114119305711,-2.331114119305711,-2.10218597845525,-1.5707963267948963,-1.0394066751345432,-0.8104785342840821,-0.8104785342840828,-1.0394066751345423,-1.5707963267948963,-2.10218597845525,-2.331114119305711,-2.331114119305711,-2.1021859784552506,-1.570796326794897,-1.0394066751345432,-0.8104785342840821,-1.5707963267948966,-0.7048717707030305,-0.9424777960769383,-1.570796326794897,-2.199114857512855,-2.4367208828867626,-2.4367208828867626,-2.199114857512855,-1.5707963267948961,-0.9424777960769378,-0.7048717707030305,-0.7048717707030312,-0.942477796076937,-1.5707963267948963,-2.199114857512855,-2.4367208828867626,-2.4367208828867626,-2.199114857512855,-1.5707963267948972,-0.9424777960769383,-0.7048717707030303,-1.5707963267948966,-0.3141592653589794,-0.48401996941798947,-1.5707963267948972,-2.6575726841718037,-2.827433388230814,-2.827433388230814,-2.6575726841718037,-1.5707963267948966,-0.48401996941798947,-0.3141592653589794,-0.31415926535897987,-0.4840199694179884,-1.5707963267948961,-2.6575726841718037,-2.827433388230814,-2.827433388230814,-2.657572684171804,-1.5707963267948966,-0.4840199694179893,-0.3141592653589794,1.5707963267948966,0.31415926535897915,0.484019969417989,1.5707963267948972,2.6575726841718046,2.827433388230814,2.827433388230814,2.6575726841718037,1.5707963267948966,0.4840199694179888,0.31415926535897903,0.31415926535897953,0.48401996941798797,1.5707963267948961,2.6575726841718046,2.8274333882308142,2.8274333882308142,2.657572684171804,1.5707963267948966,0.4840199694179893,0.3141592653589792,1.5707963267948966,0.7048717707030305,0.9424777960769383,1.570796326794897,2.199114857512855,2.4367208828867626,2.4367208828867626,2.199114857512855,1.5707963267948966,0.942477796076938,0.7048717707030305,0.7048717707030312,0.942477796076937,1.5707963267948963,2.199114857512855,2.4367208828867626,2.4367208828867626,2.199114857512855,1.5707963267948966,0.9424777960769382,0.7048717707030305,1.5707963267948966,0.8104785342840821,1.0394066751345434,1.570796326794897,2.10218597845525,2.331114119305711,2.331114119305711,2.1021859784552506,1.5707963267948963,1.0394066751345432,0.8104785342840821,0.8104785342840828,1.0394066751345423,1.5707963267948963,2.10218597845525,2.331114119305711,2.331114119305711,2.1021859784552506,1.570796326794897,1.0394066751345434,0.8104785342840821,1.5707963267948966,0.7048717707030306,0.9424777960769385,1.5707963267948972,2.199114857512855,2.4367208828867626,2.4367208828867626,2.199114857512855,1.5707963267948963,0.942477796076938,0.7048717707030305,0.7048717707030312,0.9424777960769373,1.5707963267948961,2.199114857512855,2.4367208828867626,2.4367208828867626,2.199114857512855,1.570796326794897,0.9424777960769383,0.7048717707030305,1.5707963267948966,0.3141592653589793,0.4840199694179893,1.5707963267948966,2.6575726841718046,2.827433388230814,2.827433388230814,2.6575726841718037,1.5707963267948961,0.4840199694179893,0.3141592653589794,0.3141592653589799,0.4840199694179887,1.5707963267948966,2.6575726841718037,2.827433388230814,2.827433388230814,2.6575726841718037,1.5707963267948972,0.48401996941798947,0.3141592653589794],\n",
       "\"z\":[1.0000000000000002,1.5877852522924734,1.9510565162951536,1.9510565162951536,1.587785252292473,0.9999999999999999,0.41221474770752675,0.04894348370484636,0.04894348370484647,0.41221474770752686,1.0,1.5877852522924725,1.9510565162951536,1.9510565162951536,1.5877852522924734,1.0000000000000002,0.412214747707527,0.04894348370484647,0.04894348370484636,0.41221474770752664,0.9999999999999998,0.8090169943749476,1.3968022466674208,1.760073510670101,1.7600735106701009,1.3968022466674204,0.8090169943749472,0.2212317420824741,-0.1420395219202063,-0.1420395219202062,0.2212317420824742,0.8090169943749473,1.3968022466674197,1.7600735106701009,1.760073510670101,1.3968022466674206,0.8090169943749475,0.22123174208247431,-0.1420395219202062,-0.1420395219202063,0.22123174208247398,0.8090169943749471,0.30901699437494745,0.8968022466674206,1.2600735106701009,1.2600735106701006,0.8968022466674203,0.3090169943749471,-0.278768257917526,-0.6420395219202064,-0.6420395219202063,-0.2787682579175259,0.30901699437494723,0.8968022466674196,1.2600735106701006,1.2600735106701009,0.8968022466674205,0.30901699437494734,-0.2787682579175258,-0.6420395219202063,-0.6420395219202064,-0.27876825791752613,0.309016994374947,-0.30901699437494734,0.2787682579175258,0.6420395219202061,0.642039521920206,0.27876825791752546,-0.3090169943749477,-0.8968022466674208,-1.260073510670101,-1.260073510670101,-0.8968022466674207,-0.30901699437494756,0.2787682579175248,0.642039521920206,0.6420395219202061,0.2787682579175257,-0.30901699437494745,-0.8968022466674206,-1.260073510670101,-1.260073510670101,-0.8968022466674209,-0.3090169943749478,-0.8090169943749473,-0.2212317420824742,0.14203952192020608,0.14203952192020597,-0.22123174208247454,-0.8090169943749477,-1.3968022466674208,-1.760073510670101,-1.760073510670101,-1.3968022466674208,-0.8090169943749476,-0.2212317420824752,0.14203952192020597,0.14203952192020608,-0.22123174208247431,-0.8090169943749475,-1.3968022466674206,-1.760073510670101,-1.760073510670101,-1.3968022466674208,-0.8090169943749478,-0.9999999999999998,-0.41221474770752664,-0.04894348370484636,-0.04894348370484647,-0.412214747707527,-1.0000000000000002,-1.5877852522924734,-1.9510565162951536,-1.9510565162951536,-1.5877852522924731,-1.0,-0.41221474770752764,-0.04894348370484647,-0.04894348370484636,-0.41221474770752675,-0.9999999999999999,-1.587785252292473,-1.9510565162951536,-1.9510565162951536,-1.5877852522924734,-1.0000000000000002,-0.8090169943749471,-0.22123174208247398,0.1420395219202063,0.1420395219202062,-0.22123174208247431,-0.8090169943749475,-1.3968022466674206,-1.760073510670101,-1.7600735106701009,-1.3968022466674204,-0.8090169943749473,-0.22123174208247498,0.1420395219202062,0.1420395219202063,-0.2212317420824741,-0.8090169943749472,-1.3968022466674204,-1.7600735106701009,-1.760073510670101,-1.3968022466674208,-0.8090169943749476,-0.3090169943749471,0.278768257917526,0.6420395219202063,0.6420395219202062,0.2787682579175257,-0.30901699437494745,-0.8968022466674206,-1.260073510670101,-1.2600735106701009,-0.8968022466674205,-0.30901699437494734,0.278768257917525,0.6420395219202062,0.6420395219202063,0.2787682579175259,-0.30901699437494723,-0.8968022466674204,-1.2600735106701009,-1.260073510670101,-0.8968022466674207,-0.30901699437494756,0.3090169943749477,0.8968022466674208,1.260073510670101,1.260073510670101,0.8968022466674205,0.30901699437494734,-0.2787682579175258,-0.6420395219202062,-0.6420395219202061,-0.2787682579175257,0.30901699437494745,0.8968022466674198,1.260073510670101,1.260073510670101,0.8968022466674207,0.30901699437494756,-0.2787682579175256,-0.6420395219202061,-0.6420395219202062,-0.2787682579175259,0.30901699437494723,0.8090169943749477,1.3968022466674208,1.760073510670101,1.760073510670101,1.3968022466674204,0.8090169943749473,0.2212317420824742,-0.1420395219202062,-0.14203952192020608,0.22123174208247431,0.8090169943749475,1.39680224666742,1.760073510670101,1.760073510670101,1.3968022466674208,0.8090169943749476,0.22123174208247443,-0.14203952192020608,-0.1420395219202062,0.2212317420824741,0.8090169943749472,1.0000000000000002,1.5877852522924734,1.9510565162951536,1.9510565162951536,1.587785252292473,0.9999999999999999,0.41221474770752675,0.04894348370484636,0.04894348370484647,0.41221474770752686,1.0,1.5877852522924725,1.9510565162951536,1.9510565162951536,1.5877852522924734,1.0000000000000002,0.412214747707527,0.04894348370484647,0.04894348370484636,0.41221474770752664,0.9999999999999998,0.8090169943749482,1.3968022466674213,1.7600735106701015,1.7600735106701015,1.396802246667421,0.8090169943749479,0.22123174208247476,-0.14203952192020564,-0.14203952192020552,0.22123174208247487,0.809016994374948,1.3968022466674204,1.7600735106701015,1.7600735106701015,1.3968022466674213,0.8090169943749481,0.22123174208247498,-0.14203952192020552,-0.14203952192020564,0.22123174208247465,0.8090169943749478,0.3090169943749477,0.8968022466674208,1.260073510670101,1.260073510670101,0.8968022466674205,0.30901699437494734,-0.2787682579175258,-0.6420395219202062,-0.6420395219202061,-0.2787682579175257,0.30901699437494745,0.8968022466674198,1.260073510670101,1.260073510670101,0.8968022466674207,0.30901699437494756,-0.2787682579175256,-0.6420395219202061,-0.6420395219202062,-0.2787682579175259,0.30901699437494723,-0.3090169943749471,0.278768257917526,0.6420395219202063,0.6420395219202062,0.2787682579175257,-0.30901699437494745,-0.8968022466674206,-1.260073510670101,-1.2600735106701009,-0.8968022466674205,-0.30901699437494734,0.278768257917525,0.6420395219202062,0.6420395219202063,0.2787682579175259,-0.30901699437494723,-0.8968022466674204,-1.2600735106701009,-1.260073510670101,-0.8968022466674207,-0.30901699437494756,-0.8090169943749471,-0.22123174208247398,0.1420395219202063,0.1420395219202062,-0.22123174208247431,-0.8090169943749475,-1.3968022466674206,-1.760073510670101,-1.7600735106701009,-1.3968022466674204,-0.8090169943749473,-0.22123174208247498,0.1420395219202062,0.1420395219202063,-0.2212317420824741,-0.8090169943749472,-1.3968022466674204,-1.7600735106701009,-1.760073510670101,-1.3968022466674208,-0.8090169943749476,-0.9999999999999998,-0.41221474770752664,-0.04894348370484636,-0.04894348370484647,-0.412214747707527,-1.0000000000000002,-1.5877852522924734,-1.9510565162951536,-1.9510565162951536,-1.5877852522924731,-1.0,-0.41221474770752764,-0.04894348370484647,-0.04894348370484636,-0.41221474770752675,-0.9999999999999999,-1.587785252292473,-1.9510565162951536,-1.9510565162951536,-1.5877852522924734,-1.0000000000000002,-0.8090169943749473,-0.2212317420824742,0.14203952192020608,0.14203952192020597,-0.22123174208247454,-0.8090169943749477,-1.3968022466674208,-1.760073510670101,-1.760073510670101,-1.3968022466674208,-0.8090169943749476,-0.2212317420824752,0.14203952192020597,0.14203952192020608,-0.22123174208247431,-0.8090169943749475,-1.3968022466674206,-1.760073510670101,-1.760073510670101,-1.3968022466674208,-0.8090169943749478,-0.30901699437494734,0.2787682579175258,0.6420395219202061,0.642039521920206,0.27876825791752546,-0.3090169943749477,-0.8968022466674208,-1.260073510670101,-1.260073510670101,-0.8968022466674207,-0.30901699437494756,0.2787682579175248,0.642039521920206,0.6420395219202061,0.2787682579175257,-0.30901699437494745,-0.8968022466674206,-1.260073510670101,-1.260073510670101,-0.8968022466674209,-0.3090169943749478,0.30901699437494745,0.8968022466674206,1.2600735106701009,1.2600735106701006,0.8968022466674203,0.3090169943749471,-0.278768257917526,-0.6420395219202064,-0.6420395219202063,-0.2787682579175259,0.30901699437494723,0.8968022466674196,1.2600735106701006,1.2600735106701009,0.8968022466674205,0.30901699437494734,-0.2787682579175258,-0.6420395219202063,-0.6420395219202064,-0.27876825791752613,0.309016994374947,0.8090169943749476,1.3968022466674208,1.760073510670101,1.7600735106701009,1.3968022466674204,0.8090169943749472,0.2212317420824741,-0.1420395219202063,-0.1420395219202062,0.2212317420824742,0.8090169943749473,1.3968022466674197,1.7600735106701009,1.760073510670101,1.3968022466674206,0.8090169943749475,0.22123174208247431,-0.1420395219202062,-0.1420395219202063,0.22123174208247398,0.8090169943749471,1.0000000000000002,1.5877852522924734,1.9510565162951536,1.9510565162951536,1.587785252292473,0.9999999999999999,0.41221474770752675,0.04894348370484636,0.04894348370484647,0.41221474770752686,1.0,1.5877852522924725,1.9510565162951536,1.9510565162951536,1.5877852522924734,1.0000000000000002,0.412214747707527,0.04894348370484647,0.04894348370484636,0.41221474770752664,0.9999999999999998],\n",
       "\"radius\":[0.0,0.43300681988666767,0.26761293205046444,0.0,0.2676129320504647,0.43300681988666767,0.43300681988666767,0.2676129320504645,8.17873771726907E-17,0.2676129320504645,0.43300681988666767,0.4330068198866672,0.26761293205046505,0.0,0.26761293205046444,0.43300681988666767,0.4330068198866678,0.26761293205046455,8.17873771726907E-17,0.26761293205046444,0.43300681988666767,0.1406924443843529,0.45529031394837444,0.3023425959197458,0.140692444384353,0.30234259591974594,0.4552903139483744,0.4552903139483744,0.3023425959197459,0.1406924443843529,0.3023425959197459,0.4552903139483744,0.4552903139483739,0.30234259591974644,0.14069244438435283,0.302342595919746,0.4552903139483744,0.4552903139483744,0.302342595919746,0.1406924443843529,0.3023425959197458,0.4552903139483744,0.3683376013585401,0.5684782270614487,0.45529031394837444,0.3683376013585402,0.4552903139483744,0.5684782270614485,0.5684782270614485,0.4552903139483744,0.3683376013585401,0.4552903139483744,0.5684782270614485,0.568478227061448,0.4552903139483747,0.3683376013585402,0.4552903139483744,0.5684782270614485,0.5684782270614485,0.45529031394837444,0.3683376013585401,0.4552903139483743,0.5684782270614485,0.4552903139483743,0.6283185307179586,0.5281154716308316,0.4552903139483742,0.5281154716308317,0.6283185307179586,0.6283185307179586,0.5281154716308315,0.4552903139483743,0.5281154716308317,0.6283185307179586,0.6283185307179582,0.528115471630832,0.4552903139483743,0.5281154716308317,0.6283185307179586,0.6283185307179586,0.5281154716308317,0.4552903139483742,0.5281154716308316,0.6283185307179586,0.36833760135854005,0.5684782270614485,0.4552903139483743,0.36833760135854005,0.4552903139483744,0.5684782270614485,0.5684782270614485,0.4552903139483743,0.36833760135854005,0.4552903139483743,0.5684782270614487,0.568478227061448,0.4552903139483747,0.36833760135854005,0.4552903139483744,0.5684782270614485,0.5684782270614485,0.4552903139483744,0.36833760135854005,0.4552903139483742,0.5684782270614485,0.14069244438435274,0.4552903139483743,0.30234259591974577,0.14069244438435274,0.3023425959197459,0.45529031394837444,0.4552903139483744,0.3023425959197458,0.14069244438435283,0.3023425959197459,0.4552903139483743,0.45529031394837377,0.3023425959197464,0.14069244438435274,0.3023425959197458,0.4552903139483743,0.4552903139483742,0.3023425959197461,0.14069244438435283,0.3023425959197458,0.4552903139483743,0.1406924443843529,0.4552903139483744,0.3023425959197458,0.1406924443843529,0.302342595919746,0.4552903139483744,0.4552903139483744,0.30234259591974594,0.140692444384353,0.302342595919746,0.4552903139483743,0.4552903139483738,0.3023425959197464,0.1406924443843529,0.3023425959197459,0.4552903139483744,0.4552903139483744,0.302342595919746,0.14069244438435283,0.3023425959197458,0.4552903139483745,0.36833760135854005,0.5684782270614485,0.4552903139483743,0.36833760135854005,0.4552903139483744,0.5684782270614485,0.5684782270614485,0.4552903139483744,0.36833760135854005,0.4552903139483743,0.5684782270614485,0.568478227061448,0.4552903139483747,0.36833760135854005,0.4552903139483744,0.5684782270614485,0.5684782270614485,0.4552903139483744,0.36833760135854005,0.4552903139483744,0.5684782270614485,0.4552903139483743,0.6283185307179586,0.5281154716308316,0.4552903139483744,0.5281154716308317,0.6283185307179586,0.6283185307179586,0.5281154716308317,0.4552903139483743,0.5281154716308317,0.6283185307179586,0.6283185307179582,0.5281154716308321,0.4552903139483743,0.5281154716308317,0.6283185307179586,0.6283185307179586,0.5281154716308317,0.4552903139483744,0.5281154716308316,0.6283185307179586,0.36833760135854005,0.5684782270614485,0.4552903139483743,0.36833760135854005,0.45529031394837444,0.5684782270614485,0.5684782270614485,0.4552903139483744,0.36833760135854005,0.4552903139483744,0.5684782270614485,0.5684782270614482,0.4552903139483747,0.36833760135854005,0.4552903139483743,0.5684782270614487,0.5684782270614485,0.4552903139483744,0.36833760135854005,0.4552903139483743,0.5684782270614485,0.14069244438435283,0.4552903139483744,0.3023425959197458,0.14069244438435283,0.3023425959197461,0.4552903139483743,0.4552903139483744,0.3023425959197459,0.14069244438435283,0.3023425959197459,0.4552903139483744,0.45529031394837394,0.3023425959197464,0.14069244438435283,0.3023425959197458,0.4552903139483744,0.45529031394837444,0.30234259591974594,0.14069244438435283,0.3023425959197458,0.4552903139483744,0.1406924443843524,0.45529031394837416,0.30234259591974566,0.1406924443843525,0.3023425959197457,0.4552903139483742,0.4552903139483742,0.30234259591974566,0.1406924443843524,0.30234259591974566,0.4552903139483742,0.45529031394837377,0.30234259591974627,0.1406924443843525,0.30234259591974566,0.4552903139483742,0.4552903139483742,0.3023425959197457,0.1406924443843524,0.3023425959197456,0.4552903139483742,0.3683376013585405,0.5684782270614487,0.4552903139483745,0.3683376013585403,0.45529031394837477,0.5684782270614488,0.5684782270614488,0.4552903139483747,0.3683376013585405,0.4552903139483747,0.5684782270614488,0.5684782270614482,0.45529031394837494,0.3683376013585403,0.4552903139483747,0.5684782270614488,0.5684782270614488,0.4552903139483747,0.3683376013585405,0.45529031394837466,0.5684782270614488,0.4552903139483743,0.6283185307179586,0.5281154716308316,0.4552903139483744,0.5281154716308317,0.6283185307179586,0.6283185307179586,0.5281154716308317,0.4552903139483743,0.5281154716308317,0.6283185307179586,0.6283185307179582,0.5281154716308321,0.4552903139483743,0.5281154716308317,0.6283185307179586,0.6283185307179586,0.5281154716308317,0.4552903139483744,0.5281154716308317,0.6283185307179586,0.36833760135854005,0.5684782270614485,0.4552903139483743,0.36833760135854005,0.4552903139483744,0.5684782270614485,0.5684782270614485,0.4552903139483744,0.36833760135854005,0.4552903139483743,0.5684782270614485,0.568478227061448,0.4552903139483747,0.36833760135854005,0.4552903139483744,0.5684782270614485,0.5684782270614485,0.4552903139483744,0.36833760135854005,0.4552903139483743,0.5684782270614487,0.1406924443843529,0.4552903139483744,0.3023425959197458,0.1406924443843529,0.302342595919746,0.4552903139483745,0.4552903139483744,0.3023425959197458,0.140692444384353,0.302342595919746,0.4552903139483744,0.4552903139483738,0.3023425959197464,0.1406924443843529,0.3023425959197459,0.4552903139483744,0.4552903139483743,0.30234259591974616,0.14069244438435283,0.3023425959197458,0.4552903139483744,0.14069244438435274,0.4552903139483743,0.30234259591974577,0.14069244438435274,0.3023425959197459,0.4552903139483744,0.4552903139483744,0.3023425959197458,0.14069244438435283,0.3023425959197457,0.45529031394837444,0.45529031394837377,0.3023425959197464,0.14069244438435274,0.3023425959197458,0.4552903139483743,0.4552903139483743,0.30234259591974594,0.14069244438435283,0.3023425959197458,0.4552903139483743,0.36833760135854005,0.5684782270614485,0.4552903139483743,0.36833760135854005,0.4552903139483744,0.5684782270614485,0.5684782270614485,0.4552903139483743,0.36833760135854005,0.4552903139483744,0.5684782270614485,0.568478227061448,0.4552903139483747,0.36833760135854005,0.4552903139483744,0.5684782270614485,0.5684782270614485,0.4552903139483744,0.36833760135854005,0.45529031394837416,0.5684782270614485,0.4552903139483743,0.6283185307179586,0.5281154716308316,0.4552903139483742,0.5281154716308317,0.6283185307179586,0.6283185307179586,0.5281154716308316,0.4552903139483743,0.5281154716308317,0.6283185307179586,0.6283185307179582,0.5281154716308318,0.4552903139483743,0.5281154716308317,0.6283185307179586,0.6283185307179586,0.5281154716308317,0.4552903139483742,0.5281154716308316,0.6283185307179586,0.3683376013585401,0.5684782270614487,0.45529031394837444,0.3683376013585402,0.45529031394837444,0.5684782270614485,0.5684782270614485,0.4552903139483744,0.3683376013585401,0.4552903139483744,0.5684782270614485,0.568478227061448,0.4552903139483749,0.3683376013585402,0.45529031394837444,0.5684782270614485,0.5684782270614485,0.45529031394837444,0.3683376013585401,0.4552903139483743,0.5684782270614485,0.1406924443843529,0.4552903139483744,0.3023425959197458,0.140692444384353,0.3023425959197461,0.4552903139483743,0.4552903139483744,0.3023425959197459,0.1406924443843529,0.3023425959197459,0.4552903139483744,0.45529031394837394,0.30234259591974644,0.14069244438435283,0.3023425959197459,0.4552903139483744,0.4552903139483745,0.302342595919746,0.1406924443843529,0.3023425959197458,0.4552903139483744]\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_cmap\"\n",
       "},{\n",
       "\"aesthetic\":\"color\",\n",
       "\"scale_mapper_kind\":\"color_cmap\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"size\":1.5,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"point\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"mapping\":{\n",
       "\"angle\":\"angle\",\n",
       "\"radius\":\"radius\",\n",
       "\"color\":\"z\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"spoke\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "}\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"rtlfpW\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p + geomPoint(size = 1.5) + geomSpoke { angle = \"angle\"; radius = \"radius\"; color = \"z\" }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6d4a96a5",
   "metadata": {},
   "source": [
    "#### 2. Parameter `pivot`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "c1e815fa",
   "metadata": {},
   "outputs": [],
   "source": [
    "fun getPlot(pivot: String): org.jetbrains.letsPlot.intern.Plot {\n",
    "    val a = -3.0\n",
    "    val b = 3.0 \n",
    "    val r = 0.75\n",
    "    val pivotData = getData(\n",
    "        n = 4, \n",
    "        a = a,\n",
    "        b = b\n",
    "    ) { xArray, yArray -> DoubleArray(xArray.size) { index -> xArray[index].pow(2) + yArray[index].pow(2) } }\n",
    "    val title = \"pivot=${pivot}\" + (\" (default)\".takeIf { pivot == \"tail\" } ?: \"\")\n",
    "    return ggplot(pivotData) { x = \"x\"; y = \"y\" } +\n",
    "        geomPoint() +\n",
    "        geomSpoke(radius = r, pivot = pivot) { angle = \"angle\" } +\n",
    "        coordFixed() +\n",
    "        xlim(a - r to b + r) + ylim(a - r to b + r) +\n",
    "        ggtitle(title) +\n",
    "        themeVoid() + theme(plotTitle = elementText(hjust = 0.5))\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "3ea5cdc0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"QTiSRj\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"layout\":{\n",
       "\"name\":\"grid\",\n",
       "\"ncol\":3,\n",
       "\"nrow\":1,\n",
       "\"fit\":true,\n",
       "\"align\":false\n",
       "},\n",
       "\"figures\":[{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"pivot=tail (default)\"\n",
       "},\n",
       "\"mapping\":{\n",
       "\"x\":\"x\",\n",
       "\"y\":\"y\"\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"fixed\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"data\":{\n",
       "\"x\":[-3.0,-1.0,1.0,3.0,-3.0,-1.0,1.0,3.0,-3.0,-1.0,1.0,3.0,-3.0,-1.0,1.0,3.0],\n",
       "\"angle\":[0.0,3.141592653589793,0.0,0.0,-1.5707963267948966,-2.356194490192345,-1.5707963267948966,-0.7853981633974483,0.0,3.141592653589793,0.0,0.0,1.5707963267948966,2.356194490192345,1.5707963267948966,0.7853981633974483],\n",
       "\"y\":[-3.0,-3.0,-3.0,-3.0,-1.0,-1.0,-1.0,-1.0,1.0,1.0,1.0,1.0,3.0,3.0,3.0,3.0]\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"x\",\n",
       "\"limits\":[-3.75,3.75]\n",
       "},{\n",
       "\"aesthetic\":\"y\",\n",
       "\"limits\":[-3.75,3.75]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"point\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"mapping\":{\n",
       "\"angle\":\"angle\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"pivot\":\"tail\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"spoke\",\n",
       "\"radius\":0.75,\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"plot_title\":{\n",
       "\"hjust\":0.5,\n",
       "\"blank\":false\n",
       "}\n",
       "}\n",
       "},{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"pivot=mid\"\n",
       "},\n",
       "\"mapping\":{\n",
       "\"x\":\"x\",\n",
       "\"y\":\"y\"\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"fixed\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"data\":{\n",
       "\"x\":[-3.0,-1.0,1.0,3.0,-3.0,-1.0,1.0,3.0,-3.0,-1.0,1.0,3.0,-3.0,-1.0,1.0,3.0],\n",
       "\"y\":[-3.0,-3.0,-3.0,-3.0,-1.0,-1.0,-1.0,-1.0,1.0,1.0,1.0,1.0,3.0,3.0,3.0,3.0],\n",
       "\"angle\":[0.0,3.141592653589793,0.0,0.0,-1.5707963267948966,-2.356194490192345,-1.5707963267948966,-0.7853981633974483,0.0,3.141592653589793,0.0,0.0,1.5707963267948966,2.356194490192345,1.5707963267948966,0.7853981633974483]\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"x\",\n",
       "\"limits\":[-3.75,3.75]\n",
       "},{\n",
       "\"aesthetic\":\"y\",\n",
       "\"limits\":[-3.75,3.75]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"point\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"mapping\":{\n",
       "\"angle\":\"angle\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"pivot\":\"mid\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"spoke\",\n",
       "\"radius\":0.75,\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"plot_title\":{\n",
       "\"hjust\":0.5,\n",
       "\"blank\":false\n",
       "}\n",
       "}\n",
       "},{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"pivot=tip\"\n",
       "},\n",
       "\"mapping\":{\n",
       "\"x\":\"x\",\n",
       "\"y\":\"y\"\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"fixed\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"data\":{\n",
       "\"x\":[-3.0,-1.0,1.0,3.0,-3.0,-1.0,1.0,3.0,-3.0,-1.0,1.0,3.0,-3.0,-1.0,1.0,3.0],\n",
       "\"y\":[-3.0,-3.0,-3.0,-3.0,-1.0,-1.0,-1.0,-1.0,1.0,1.0,1.0,1.0,3.0,3.0,3.0,3.0],\n",
       "\"angle\":[0.0,3.141592653589793,0.0,0.0,-1.5707963267948966,-2.356194490192345,-1.5707963267948966,-0.7853981633974483,0.0,3.141592653589793,0.0,0.0,1.5707963267948966,2.356194490192345,1.5707963267948966,0.7853981633974483]\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"x\",\n",
       "\"limits\":[-3.75,3.75]\n",
       "},{\n",
       "\"aesthetic\":\"y\",\n",
       "\"limits\":[-3.75,3.75]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"point\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"mapping\":{\n",
       "\"angle\":\"angle\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"pivot\":\"tip\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"spoke\",\n",
       "\"radius\":0.75,\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"plot_title\":{\n",
       "\"hjust\":0.5,\n",
       "\"blank\":false\n",
       "}\n",
       "}\n",
       "}],\n",
       "\"kind\":\"subplots\"\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"QTiSRj\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gggrid(\n",
    "    listOf(getPlot(\"tail\"), getPlot(\"mid\"), getPlot(\"tip\")),\n",
    "    ncol=3\n",
    ")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Kotlin",
   "language": "kotlin",
   "name": "kotlin"
  },
  "language_info": {
   "codemirror_mode": "text/x-kotlin",
   "file_extension": ".kt",
   "mimetype": "text/x-kotlin",
   "name": "kotlin",
   "nbconvert_exporter": "",
   "pygments_lexer": "kotlin",
   "version": "1.8.20"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}