{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The spherical Voronoi diagram algorithm proceeds as follows. The Convex Hull of the input points (generators) is calculated, and is equivalent to their Delaunay triangulation on the surface of the sphere "
            },
            {
              "__type": "CitationReference",
              "__tag": 4063,
              "label": "Caroli"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". The Convex Hull neighbour information is then used to order the Voronoi region vertices around each generator. The latter approach is substantially less sensitive to floating point issues than angle-based methods of Voronoi region vertex sorting."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Empirical assessment of spherical Voronoi algorithm performance suggests quadratic time complexity (loglinear is optimal, but algorithms are more challenging to implement)."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "",
              "annotation": "ValueError",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If there are duplicates in "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "points"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". If the provided "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "radius"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is not consistent with "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "points"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "calculate_areas",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Calculates the areas of the Voronoi regions. For 2D point sets, the regions are circular arcs. The sum of the areas is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "2 * pi * radius"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". For 3D point sets, the regions are spherical polygons. The sum of the areas is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "4 * pi * radius**2"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Voronoi diagrams on the surface of a sphere."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "points",
              "annotation": "double array of shape (npoints, ndim)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "the points in "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "ndim",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " dimensions to generate the Voronoi diagram from"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "radius",
              "annotation": "double",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "radius of the sphere"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "center",
              "annotation": "double array of shape (ndim,)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "center of the sphere"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "vertices",
              "annotation": "double array of shape (nvertices, ndim)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Voronoi vertices corresponding to points"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "regions",
              "annotation": "list of list of integers of shape (npoints, _ )",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "the n-th entry is a list consisting of the indices of the vertices belonging to the n-th point in points"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "points",
              "annotation": "ndarray of floats, shape (npoints, ndim)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Coordinates of points from which to construct a spherical Voronoi diagram."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "radius",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Radius of the sphere (Default: 1)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "center",
              "annotation": "ndarray of floats, shape (ndim,)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Center of sphere (Default: origin)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "threshold",
              "annotation": "float",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Threshold for detecting duplicate points and mismatches between points and sphere parameters. (Default: 1e-06)"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 0.18.0"
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/spatial/_spherical_voronoi.py",
  "item_line": 36,
  "item_type": "class",
  "aliases": [
    "scipy.spatial.SphericalVoronoi"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "Do some imports and take some points on a cube:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy.spatial import SphericalVoronoi, geometric_slerp\nfrom mpl_toolkits.mplot3d import proj3d\npoints = np.array([[0, 0, 1], [0, 0, -1], [1, 0, 0],\n                   [0, 1, 0], [0, -1, 0], [-1, 0, 0], ])\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nCalculate the spherical Voronoi diagram:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "radius = 1\ncenter = np.array([0, 0, 0])\nsv = SphericalVoronoi(points, radius, center)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nGenerate plot:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "sv.sort_vertices_of_regions()\nt_vals = np.linspace(0, 1, 2000)\nfig = plt.figure()\nax = fig.add_subplot(111, projection='3d')\nu = np.linspace(0, 2 * np.pi, 100)\nv = np.linspace(0, np.pi, 100)\nx = np.outer(np.cos(u), np.sin(v))\ny = np.outer(np.sin(u), np.sin(v))\nz = np.outer(np.ones(np.size(u)), np.cos(v))\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.plot_surface(x, y, z, color='y', alpha=0.1)\nax.scatter(points[:, 0], points[:, 1], points[:, 2], c='b')\nax.scatter(sv.vertices[:, 0], sv.vertices[:, 1], sv.vertices[:, 2],\n                   c='g')\nfor region in sv.regions:\n   n = len(region)\n   for i in range(n):\n       start = sv.vertices[region][i]\n       end = sv.vertices[region][(i + 1) % n]\n       result = geometric_slerp(start, end, t_vals)\n       ax.plot(result[..., 0],\n               result[..., 1],\n               result[..., 2],\n               c='k')\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.azim = 10\nax.elev = 40\n_ = ax.set_xticks([])\n_ = ax.set_yticks([])\n_ = ax.set_zticks([])\nfig.set_size_inches(4, 4)\nplt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "1.17.1",
          "kind": "assets",
          "path": "fig-2317a6cca0ed708e.png"
        }
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "Voronoi",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.spatial._qhull:Voronoi"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Conventional Voronoi diagrams in N dimensions."
            }
          ]
        }
      ],
      "type": null
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "points",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "radius",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "1"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "center",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "threshold",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "1e-06"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "SphericalVoronoi"
  },
  "references": [
    ".. [Caroli] Caroli et al. Robust and Efficient Delaunay triangulations of",
    "            points on or close to a sphere. Research Report RR-7004, 2009.",
    "",
    ".. [VanOosterom] Van Oosterom and Strackee. The solid angle of a plane",
    "                 triangle. IEEE Transactions on Biomedical Engineering,",
    "                 2, 1983, pp 125--126."
  ],
  "qa": "scipy.spatial._spherical_voronoi:SphericalVoronoi",
  "arbitrary": [],
  "local_refs": [
    "calculate_areas",
    "center",
    "points",
    "radius",
    "regions",
    "threshold",
    "vertices"
  ]
}