hpp-fcl

3.0.2.c1 · active · verified Thu Apr 16

hpp-fcl is a Python binding for the Flexible Collision Library (FCL), a C++ library for performing collision and distance queries between 3D geometric models. It provides efficient algorithms for checking interference between various primitive shapes and complex meshes. The current version, 3.0.2.c1, is built against FCL v0.7/v0.8 and is actively maintained with a focus on stable releases tied to underlying FCL versions.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create two simple sphere objects, position them using `Transform3f`, and then perform both collision and distance checks using the `hppfcl.collide` and `hppfcl.distance` functions.

import hppfcl
from hppfcl import CollisionRequest, CollisionResult, DistanceRequest, DistanceResult

# Create two spheres
s1 = hppfcl.Sphere(1.0)
s2 = hppfcl.Sphere(1.0)

# Create an identity transform for s1
tf1 = hppfcl.Transform3f()

# Create a transform for s2 (translated by 2.0 along X-axis)
tf2 = hppfcl.Transform3f()
tf2.setTranslation(hppfcl.Vector3(2.0, 0.0, 0.0))

# Perform collision check
req = CollisionRequest()
res = CollisionResult()
ret = hppfcl.collide(s1, tf1, s2, tf2, req, res)

print(f"Collision result: {res.isCollision()}")

# Perform distance check
dreq = DistanceRequest()
dres = DistanceResult()
ret = hppfcl.distance(s1, tf1, s2, tf2, dreq, dres)

print(f"Minimum distance: {dres.min_distance}")

view raw JSON →