magnet.generate.delaunay_tria#
- magnet.generate.delaunay_tria(output_path: str, bounds: tuple[int, int] = (10, 400))#
Generate a mesh of random triangles.
Generates a mesh of the unit square made of random triangles using Delaunay triangulation.
- Parameters:
output_path (str) – File path where the mesh will be saved.
bounds (tuple[float, float], optional) – Bounds of the uniform distribution from which the number of internal points of the mesh is sampled (default is (10, 400)).
- Returns:
adjacency (sparse.csr_matrix of np.uint8) – Adjacency matrix describing the mesh.
centroids (np.ndarray of float) – Centroid coordinates of each cell of the mesh.
areas (np.ndarray of float) – Areas of the cells.
Notes
Internal points are sampled uniformly, while points on the edges are equispaced.