Skip to content

igl.triangle

Python API reference for igl.triangle.

cdt

cdt(V: float64[m, n], E: int64[m, n], flags: str = '-c') -> tuple[float64[m, n], int64[m, n], int64[m, n], int64[m]]

Constrained Delaunay triangulation of the convex hull of 2D points and segments.

Preprocesses input to remove duplicates before calling triangle. Unlike triangulate(), this returns an adjusted edge list on the output.

Parameters

  • V — #V by 2 list of 2D vertex positions
  • E — #E by 2 list of constraint edge indices into V
  • flags — triangle option string; should contain "-c" unless segments already enclose all points (default: "-c")

Returns

  • tuple (WV, WF, WE, J): - WV #WV by 2 background mesh vertex positions - WF #WF by 3 background mesh triangle indices into WV - WE #WE by 2 constraint edge indices into WV (may be smaller than E if degenerate constraints were removed) - J #V list of indices into WF/WE for each original vertex in V

refine

refine(V: float64[m, n], E: int64[m, n], F: int64[m, n], flags: str = 'q') -> tuple[float64[m, n], int64[m, n]]

Refine an existing 2D triangulation.

Parameters

  • V — #V by 2 list of 2D vertex positions
  • E — #E by 2 list of segment indices (constraint edges)
  • F — #F by 3 list of triangle indices
  • flags — triangle option string (default: "q" for quality refinement)

Returns

  • tuple (V2, F2): - V2 #V2 by 2 refined vertex positions - F2 #F2 by 3 refined triangle indices

scaf_precompute

scaf_precompute(V: float64[m, n], F: int32[m, n], V_init: float64[m, n], scaf_energy: 'igl::MappingEnergyType', b: int32[m], bc: float64[m, n], soft_p: float, data: SCAFData) -> None

Compute necessary information to start using SCAF

Parameters

  • V — #V by 3 list of mesh vertex positions
  • F — #F by 3/3 list of mesh faces (triangles/tets)
  • V_init — #V by 3 list of initial mesh vertex positions
  • data — resulting precomputed data
  • slim_energy — Energy type to minimize
  • b — list of boundary indices into V (soft constraint)
  • bc — #b by dim list of boundary conditions (soft constraint)
  • soft_p — Soft penalty factor (can be zero)

scaf_solve

scaf_solve(iter_num: int, data: SCAFData) -> float64[m, n]

Run iter_num iterations of SCAF, with precomputed data

Parameters

  • data — precomputed data
  • iter_num — number of iterations to run

Returns

  • resulting V_o (in SLIMData): #V by dim list of mesh vertex positions

scaf_system

scaf_system(s: SCAFData) -> tuple[scipy.sparse.csc_matrix[float], float64[m]]

Set up the SCAF system L * uv = rhs, without solving it.

Parameters

  • s: — igl::SCAFData. Will be modified by energy and Jacobian computation.
  • L: — m by m matrix
  • rhs: — m by 1 vector with m = dim * (#V_mesh + #V_scaf - #V_frame)

triangulate

triangulate(V: float64[m, n], E: int64[m, n] = Ellipsis, H: float64[m, n] = Ellipsis, VM: int64[m] = Ellipsis, EM: int64[m] = Ellipsis, flags: str = '') -> tuple[float64[m, n], int64[m, n], int64[m], int64[m, n], int64[m]]

Triangulate the interior of a polygon using the triangle library.

Parameters

  • V — #V by 2 list of 2D vertex positions
  • E — #E by 2 list of vertex ids forming unoriented edges of the boundary of the polygon
  • H — #H by 2 coordinates of points contained inside holes of the polygon
  • VM — #V list of markers for input vertices
  • EM — #E list of markers for input edges
  • flags — string of options pass to triangle (see triangle documentation)
  • V2 — #V2 by 2 coordinates of the vertives of the generated triangulation
  • F2 — #F2 by 3 list of indices forming the faces of the generated triangulation
  • VM2 — #V2 list of markers for output vertices
  • E2 — #E2 by 2 list of output edges
  • EM2 — #E2 list of markers for output edges

SCAFData