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

coplanar

C++ reference

coplanar(V: float64[m, n]) -> bool

Test whether all points lie on the same plane.

Parameters

  • V — #V by 3 list of 3D vertex positions

Returns

  • true if all points are coplanar

delaunay_triangulation

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

Compute the Delaunay triangulation of a 2D point set using CGAL.

Parameters

  • V — #V by 2 list of 2D vertex positions

Returns

  • F #F by 3 triangle indices into V

extract_cells

C++ reference

extract_cells(V: float64[m, n], F: int64[m, n]) -> tuple[int, int64[m, n]]

Extract connected 3D cells partitioned by a triangle mesh.

Parameters

  • V — #V by 3 array of vertices
  • F — #F by 3 array of triangle indices

Returns

  • tuple (num_cells, cells): - num_cells number of cells (cell 0 is the infinite outer cell) - cells #F by 2 array of cell indices; cells[i,0] is the cell on the positive side of face i, cells[i,1] is on the negative side

fast_winding_number

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

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

outer_hull

C++ reference

outer_hull(V: float64[m, n], F: int64[m, n]) -> tuple[float64[m, n], int64[m, n], int64[m], bool[m]]

Compute the outer hull of a piecewise-constant winding number mesh.

Parameters

  • V — #V by 3 list of vertex positions
  • F — #F by 3 list of triangle indices into V

Returns

  • tuple (HV, HF, J, flip): - HV #HV by 3 output vertex positions - HF #HF by 3 output triangle indices into HV - J #HF list of indices into F (birth faces) - flip #HF list of bools, true if facet was flipped

peel_outer_hull_layers

C++ reference

peel_outer_hull_layers(V: float64[m, n], F: int64[m, n]) -> tuple[int64[m], bool[m], int]

Successively peel outer hull layers from a mesh, useful for boolean operations.

Parameters

  • V — #V by 3 list of vertex positions
  • F — #F by 3 list of triangle indices into V

Returns

  • tuple (I, flip, num_peels): - I #F list of which peel layer each facet belongs to - flip #F list of bools, true if facet orientation was flipped during peeling - num_peels number of peel layers

peel_winding_number_layers

C++ reference

peel_winding_number_layers(V: float64[m, n], F: int64[m, n]) -> tuple[int64[m], int]

Peel winding number layers from a mesh.

Parameters

  • V — #V by 3 list of vertex positions
  • F — #F by 3 list of triangle indices into V

Returns

  • tuple (W, num_layers): - W #V list of integer winding numbers per vertex - num_layers number of winding number layers

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