diff --git a/src/compas_libigl/boundaries/__init__.py b/src/compas_libigl/boundaries/__init__.py index 68552cd..d096e41 100644 --- a/src/compas_libigl/boundaries/__init__.py +++ b/src/compas_libigl/boundaries/__init__.py @@ -21,11 +21,13 @@ def trimesh_boundaries(M): Examples -------- - >>> import compas_libigl as igl + >>> import compas + >>> import compas_libigl >>> from compas.datastructures import Mesh - >>> mesh = Mesh.from_off(igl.get('tubemesh.off')) + >>> mesh = Mesh.from_off(compas.get('tubemesh.off')) >>> mesh.quads_to_triangles() - >>> boundaries = igl.trimesh_boundaries(mesh) + >>> M = mesh.to_vertices_and_faces() + >>> boundaries = compas_libigl.trimesh_boundaries(M) >>> len(boundaries) == 1 True """ diff --git a/src/compas_libigl/curvature/__init__.py b/src/compas_libigl/curvature/__init__.py index 1b3d2e3..812ad6b 100644 --- a/src/compas_libigl/curvature/__init__.py +++ b/src/compas_libigl/curvature/__init__.py @@ -19,11 +19,13 @@ def trimesh_gaussian_curvature(M): Examples -------- - >>> import compas_libigl as igl + >>> import compas + >>> import compas_libigl >>> from compas.datastructures import Mesh - >>> mesh = Mesh.from_off(igl.get('tubemesh.off')) + >>> mesh = Mesh.from_off(compas.get('tubemesh.off')) >>> mesh.quads_to_triangles() - >>> curvature = igl.trimesh_curvature(mesh) + >>> M = mesh.to_vertices_and_faces() + >>> curvature = compas_libigl.trimesh_gaussian_curvature(M) """ V, F = M V = np.asarray(V, dtype=np.float64) diff --git a/src/compas_libigl/geodistance/__init__.py b/src/compas_libigl/geodistance/__init__.py index d9f9ea2..d3218c1 100644 --- a/src/compas_libigl/geodistance/__init__.py +++ b/src/compas_libigl/geodistance/__init__.py @@ -31,6 +31,7 @@ def trimesh_geodistance(M, source, method="exact"): Examples -------- >>> + """ V, F = M V = np.asarray(V, dtype=np.float64) diff --git a/src/compas_libigl/intersections/__init__.py b/src/compas_libigl/intersections/__init__.py index 7ab3c26..acc11aa 100644 --- a/src/compas_libigl/intersections/__init__.py +++ b/src/compas_libigl/intersections/__init__.py @@ -30,18 +30,21 @@ def intersection_ray_mesh(ray, M): Examples -------- - >>> import compas_libigl as igl + >>> import compas + >>> import compas_libigl >>> from compas.datastructures import Mesh - >>> mesh = Mesh.from_off(igl.get('tubemesh.off')) + >>> mesh = Mesh.from_off(compas.get('tubemesh.off')) >>> mesh.quads_to_triangles() + >>> M = mesh.to_vertices_and_faces() >>> centroid = mesh.centroid() >>> ray = [centroid[0], centroid[1], 0], [0, 0, 1.0] - >>> hits = igl.intersection_ray_mesh(ray, mesh) + >>> hits = compas_libigl.intersection_ray_mesh(ray, M) >>> len(hits) == 1 True To compute the actual intersection point, do + >>> from compas.geometry import add_vectors, scale_vector >>> point = add_vectors(ray[0], scale_vector(ray[1], hits[0][3])) """ diff --git a/src/compas_libigl/isolines/__init__.py b/src/compas_libigl/isolines/__init__.py index 4f19ba6..cea8664 100644 --- a/src/compas_libigl/isolines/__init__.py +++ b/src/compas_libigl/isolines/__init__.py @@ -28,12 +28,14 @@ def trimesh_isolines(M, S, N=50): Examples -------- - >>> import compas_libigl as igl + >>> import compas + >>> import compas_libigl >>> from compas.datastructures import Mesh - >>> mesh = Mesh.from_off(igl.get('tubemesh.off')) + >>> mesh = Mesh.from_off(compas.get('tubemesh.off')) >>> mesh.quads_to_triangles() + >>> M = mesh.to_vertices_and_faces() >>> scalars = mesh.vertices_attribute('z') - >>> vertices, edges = igl.trimesh_isolines(mesh, scalars, 50) + >>> vertices, edges = compas_libigl.trimesh_isolines(M, scalars, 50) To convert the vertices and edges to sets of isolines, use :func:`groupsort_isolines` diff --git a/src/compas_libigl/massmatrix/__init__.py b/src/compas_libigl/massmatrix/__init__.py index c781f75..fb509e6 100644 --- a/src/compas_libigl/massmatrix/__init__.py +++ b/src/compas_libigl/massmatrix/__init__.py @@ -21,11 +21,14 @@ def trimesh_massmatrix(M): Examples -------- - >>> import compas_libigl as igl + >>> import compas + >>> import compas_libigl >>> from compas.datastructures import Mesh - >>> mesh = Mesh.from_off(igl.get('tubemesh.off')) + >>> mesh = Mesh.from_off(compas.get('tubemesh.off')) >>> mesh.quads_to_triangles() - >>> mass = igl.trimesh_massmatrix(mesh) + >>> M = mesh.to_vertices_and_faces() + >>> mass = compas_libigl.trimesh_massmatrix(M) + """ V, F = M V = np.asarray(V, dtype=np.float64) diff --git a/src/compas_libigl/meshing/__init__.py b/src/compas_libigl/meshing/__init__.py index c363995..887fd4f 100644 --- a/src/compas_libigl/meshing/__init__.py +++ b/src/compas_libigl/meshing/__init__.py @@ -26,8 +26,6 @@ def trimesh_remesh_along_isoline(mesh, scalarfield, scalar): Examples -------- - >>> import compas_libigl as igl - >>> from compas.datastructures import Mesh >>> """ diff --git a/src/compas_libigl/parametrisation/__init__.py b/src/compas_libigl/parametrisation/__init__.py index 74d50d1..8e33b51 100644 --- a/src/compas_libigl/parametrisation/__init__.py +++ b/src/compas_libigl/parametrisation/__init__.py @@ -26,7 +26,8 @@ def trimesh_harmonic(M): >>> mesh = Mesh.from_off(igl.get('camelhead.off')) >>> mesh_uv = mesh.copy() >>> mesh_uv.vertices_attribute('z', 0) - >>> uv = igl.trimesh_harmonic(mesh) + >>> M = mesh.to_vertices_and_faces() + >>> uv = igl.trimesh_harmonic(M) >>> for key in mesh.vertices(): ... mesh_uv.vertex_attributes(key, 'xy', uv[key]) ... @@ -65,7 +66,8 @@ def trimesh_lscm(M): >>> mesh = Mesh.from_off(igl.get('camelhead.off')) >>> mesh_uv = mesh.copy() >>> mesh_uv.vertices_attribute('z', 0) - >>> uv = igl.trimesh_lscm(mesh) + >>> M = mesh.to_vertices_and_faces() + >>> uv = igl.trimesh_lscm(M) >>> for key in mesh.vertices(): ... mesh_uv.vertex_attributes(key, 'xy', uv[key]) ...