polytopax.convex_hull

polytopax.convex_hull(points: Array, algorithm: str = 'approximate', **kwargs) Array[source]

Compute convex hull of a set of points.

This is the main unified interface for convex hull computation. It supports multiple algorithms and provides a consistent API.

Parameters:
  • points – Input points array with shape (…, n_points, dimension)

  • algorithm – Algorithm to use: - “approximate”: Differentiable approximate hull (default) - “quickhull”: Exact Quickhull algorithm (Phase 2) - “graham_scan”: 2D Graham scan algorithm (Phase 2)

  • **kwargs – Algorithm-specific parameters passed to the underlying function

Returns:

Array of convex hull vertices

Example

>>> import jax.numpy as jnp
>>> points = jnp.array([[0, 0], [1, 0], [0, 1], [1, 1]])
>>> hull_vertices = convex_hull(points, algorithm="approximate")
>>> print(hull_vertices.shape)  # (n_hull_vertices, 2)
Algorithm-specific parameters:
For algorithm=”approximate”:
  • n_directions (int): Number of sampling directions (default: 100)

  • method (str): Sampling method (“uniform”, “icosphere”, “adaptive”)

  • temperature (float): Softmax temperature for differentiability

  • random_key (Array): JAX random key