Skip to content

igl.copyleft.cgal

Python API reference for igl.copyleft.cgal.

convex_hull

C++ reference

convex_hull(V: float64[m, n]) -> int64[m, n]

Compute the convex hull of a set of points, returning only the triangular faces of the hull.

Parameters

  • V — #V by 3 matrix of input points

Returns

  • F: #F by 3 matrix of triangle indices into V

fast_winding_number

C++ reference

fast_winding_number(P: float64[m, n], N: float64[m, n], Q: float64[m, n], expansion_order: int = 2, beta: float = 2.0) -> float64[m]

Evaluate the fast winding number for point data with adjustable accuracy.

Parameters

  • P — #P by 3 list of point locations
  • N — #P by 3 list of point normals
  • Q — #Q by 3 list of query points for the winding number
  • expansion_order — Order of the Taylor expansion (0, 1, or 2)
  • beta — Barnes-Hut style accuracy parameter (recommended: 2)

Returns

  • Vector of winding number values for each query point

intersect_other

C++ reference

intersect_other(VA: float64[m, n], FA: int64[m, n], VB: float64[m, n], FB: int64[m, n], detect_only: bool = False, first_only: bool = False, stitch_all: bool = False, slow_and_more_precise_rounding: bool = False, cutoff: int = 1000) -> tuple[int64[m, n], float64[m, n], int64[m, n], int64[m], int64[m]]

Detect intersecting faces between two triangle meshes, providing detailed output.

Parameters

  • VA — #V by 3 list of vertices for first mesh
  • FA — #F by 3 list of faces for first mesh
  • VB — #V by 3 list of vertices for second mesh
  • FB — #F by 3 list of faces for second mesh
  • detect_only — only detect intersections, do not resolve
  • first_only — only return first intersection
  • stitch_all — stitch all intersections
  • slow_and_more_precise_rounding — use slow and more precise rounding
  • cutoff — maximum number of intersections to resolve

Returns

  • Tuple containing: - success: bool indicating if the operation succeeded - IF: # intersecting face pairs - VVAB: list of intersection vertex positions - FFAB: list of triangle indices into VVAB - JAB: list of indices into [FA;FB] denoting the birth triangle - IMAB: indices stitching duplicates from intersections

intersect_with_half_space

C++ reference

intersect_with_half_space(V: float64[m, n], F: int64[m, n], p: float64[m], n: float64[m]) -> tuple[float64[m, n], int64[m, n], int64[m]]

Intersect a PWN mesh with a half-space using a point and normal.

Parameters

  • V — #V by 3 list of mesh vertex positions
  • F — #F by 3 list of triangle indices
  • p — 3D point on plane
  • n — 3D normal vector

Returns

  • Tuple containing: - success: bool, true if successful - VC: vertices of resulting mesh - FC: face indices of resulting mesh - J: birth facet indices
intersect_with_half_space(V: float64[m, n], F: int64[m, n], equ: float64[m]) -> tuple[float64[m, n], int64[m, n], int64[m]]

Intersect a PWN mesh with a half-space using the plane equation.

Parameters

  • V — #V by 3 list of mesh vertex positions
  • F — #F by 3 list of triangle indices
  • equ — Plane equation coefficients (a, b, c, d)

Returns

  • Tuple containing: - success: bool, true if successful - VC: vertices of resulting mesh - FC: face indices of resulting mesh - J: birth facet indices

mesh_boolean

C++ reference

mesh_boolean(VA: float64[m, n], FA: int64[m, n], VB: float64[m, n] = Ellipsis, FB: int64[m, n] = Ellipsis, type_str: str = Ellipsis) -> tuple[float64[m, n], int64[m, n], int64[m]]

Compute the boolean operation (union, intersection, difference, etc.) between two meshes.

Parameters

  • VA — #VA by dim matrix of mesh A vertices
  • FA — #FA by simplex_size matrix of mesh A faces
  • VB — #VB by dim matrix of mesh B vertices
  • FB — #FB by simplex_size matrix of mesh B faces
  • type_str — Type of boolean operation: “union”, “intersection”, “difference”, etc.
  • VC — #VC by dim matrix of result vertices
  • FC — #FC by simplex_size matrix of result faces
  • J — #FC list of indices indicating which input face contributed to each result face

Returns

  • Tuple containing: - VC: Result vertices - FC: Result faces - J: Face origin indices

oriented_bounding_box

C++ reference

oriented_bounding_box(P: float64[m, n]) -> float64[m, n]

Given a set of points compute the rotation transformation of them such that their axis-aligned bounding box is as small as possible.

igl::oriented_bounding_box is often faster and better

Parameters

  • P — #P by 3 list of point locations
  • R — rotation matrix

point_areas

C++ reference

point_areas(P: float64[m, n], I: int64[m, n], N: float64[m, n]) -> tuple[float64[m], float64[m, n]]

Given a 3D set of points P, each with a list of k-nearest-neighbours, estimate the geodesic voronoi area associated with each point.

The k nearest neighbours may be known from running igl::knn_octree on the output data from igl::octree. We reccomend using a k value between 15 and 20 inclusive for accurate area estimation.

N is used filter the neighbours, to ensure area estimation only occurs using neighbors that are on the same side of the surface (ie for thin sheets), as well as to solve the orientation ambiguity of the tangent plane normal.

\note This function should be implemented by pre-filtering I, rather than filtering in this function using N. In this case, the function would only take P and I as input.

Parameters

  • P — #P by 3 list of point locations
  • I — #P by k list of k-nearest-neighbor indices into P
  • N — #P by 3 list of point normals
  • A — #P list of estimated areas
  • T — #P by 3 list of tangent plane normals for each point

remesh_self_intersections

C++ reference

remesh_self_intersections(V: float64[m, n], F: int64[m, n], detect_only: bool = False, first_only: bool = False, stitch_all: bool = False, slow_and_more_precise_rounding: bool = False, cutoff: int = 1000) -> tuple[float64[m, n], int64[m, n], int64[m, n], int64[m], int64[m]]

Resolve self-intersections in a mesh, without returning unique vertex indices (IM).

Parameters

  • V — #V by 3 list of vertex positions
  • F — #F by 3 list of face indices
  • detect_only — only detect intersections, do not resolve
  • first_only — only return first intersection
  • stitch_all — stitch all intersections
  • slow_and_more_precise_rounding — use slow and more precise rounding
  • cutoff — maximum number of intersections to resolve

Returns

  • Tuple containing: - VV: remeshed vertex positions - FF: remeshed face indices - IF: intersecting face pairs - J: birth triangle indices - IM if stitch_all = true #VV list from 0 to #VV-1 elseif stitch_all = false #VV list of indices into VV of unique vertices.

trim_with_solid

C++ reference

trim_with_solid(VA: float64[m, n], FA: int64[m, n], VB: float64[m, n], FB: int64[m, n]) -> tuple[float64[m, n], int64[m, n], bool[m], int64[m]]

Trim a mesh with another solid mesh, determining which faces lie inside or outside.

Parameters

  • VA — Vertex positions of mesh A
  • FA — Triangle indices of mesh A
  • VB — Vertex positions of mesh B (solid)
  • FB — Triangle indices of mesh B
  • V — Output vertex positions
  • F — Output triangle indices
  • D — Boolean vector indicating if each face is inside B
  • J — Indices into FA showing parent triangle