Implementation:Haosulab ManiSkill BoundingCylinder
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, Computational Geometry |
| Last Updated | 2026-02-15 08:00 GMT |
Overview
Concrete tool for computing the smallest axis-aligned bounding cylinder (AABC) enclosing a set of 3D points.
Description
The bounding_cylinder.py module implements an algorithm for computing the smallest enclosing circle (in 2D) and extends it to compute axis-aligned bounding cylinders for 3D point sets. The 2D algorithm is based on Welzl's algorithm as described at nayuki.io.
Core algorithm: The smallest enclosing circle is computed incrementally: 1. Points are randomly shuffled. 2. For each point, if it falls outside the current circle, a new circle is computed that includes this point. 3. The algorithm recurses with 1-point and 2-point constraints to find the minimum enclosing circle through those constraint points.
Helper functions (internal):
_compute_smallest_circle()-- Main recursive enclosing circle algorithm._compute_circle_with_point()-- Circle with one mandatory boundary point._compute_circle_with_two_points()-- Circle with two mandatory boundary points._get_circle_from_diameter()-- Circle from two diametrically opposite points._compute_circumcircle()-- Circumscribed circle of three points._point_in_circle()-- Containment test with epsilon tolerance.
Public function:
aabc(points)-- Computes the axis-aligned bounding cylinder by projecting 3D points onto the XY plane (for the enclosing circle) and taking the Z-axis min/max (for cylinder height).
Usage
Used by geometry utilities to compute bounding volumes for collision shapes, grasp planning, and object characterization.
Code Reference
Source Location
- Repository: Haosulab_ManiSkill
- File: mani_skill/utils/geometry/bounding_cylinder.py
Signature
def aabc(points: np.ndarray) -> Tuple[float, float, float, float, float]: ...
Import
from mani_skill.utils.geometry.bounding_cylinder import aabc
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| points | np.ndarray (N, 3) | Yes | 3D point cloud |
Outputs
| Name | Type | Description |
|---|---|---|
| center_x | float | X coordinate of cylinder center |
| center_y | float | Y coordinate of cylinder center |
| radius | float | Radius of the bounding cylinder |
| min_z | float | Minimum Z coordinate (bottom of cylinder) |
| max_z | float | Maximum Z coordinate (top of cylinder) |
Usage Examples
Basic Usage
import numpy as np
from mani_skill.utils.geometry.bounding_cylinder import aabc
# Compute bounding cylinder for a set of 3D points
points = np.random.randn(100, 3)
cx, cy, radius, z_min, z_max = aabc(points)
print(f"Center: ({cx}, {cy}), Radius: {radius}, Height: {z_max - z_min}")