entente.cgal_search module¶
cgal_search provides spatial search for vertices and faces. This is implemented atop CGAL’s axis-aligned-bounding-box search tree.
CGAL is a heavy dependency and therefore is optional. Before using this module, you must install CGAL and its Python bindings (which take quite some time to build).
On Mac OS:
brew install cgal swig
pip install cgal-bindings
# wait approximately one year
Note: The AABB tree is in the GPLv3-licensed portion of CGAL
-
entente.cgal_search.
create_aabb_tree
(mesh)[source]¶ Create a CGAL AABB tree from the given mesh.
Reports suggest trees may rely on some shared internal storage in CGAL, so to be conservative, finish using one before creating another.
See also
Returns: A CGAL AABB tree. Return type: CGAL.CGAL_AABB_tree
-
entente.cgal_search.
faces_nearest_to_points
(mesh, query_points, ret_points=False)[source]¶ Find the triangular faces on a mesh which are nearest to the given query points.
Parameters: - query_points (np.arraylike) – The points to query, with shape kx3
- ret_points (bool) – When True, return both the indices of the nearest faces and the closest points to the query points, which are not necessarily vertices. When False, return only the face indices.
Returns: face indices as kx1 np.ndarray, or when ret_points is True, a tuple also including the coordinates of the closest points as kx3 np.ndarray.
Return type: object