Skip to content

Commit ffdb25e

Browse files
committed
docstrings
1 parent c84d510 commit ffdb25e

File tree

8 files changed

+107
-60
lines changed

8 files changed

+107
-60
lines changed

src/compas_cgal/__init__.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,8 @@
55
66
.. currentmodule:: compas_cgal
77
8-
Classes
9-
=======
10-
11-
.. autosummary::
12-
:toctree: generated/
13-
:nosignatures:
14-
15-
trimesh.TriMesh
16-
17-
Functions
18-
=========
19-
208
Booleans
21-
--------
9+
========
2210
2311
.. autosummary::
2412
:toctree: generated/
@@ -29,7 +17,7 @@
2917
booleans.boolean_intersection
3018
3119
Intersections
32-
-------------
20+
=============
3321
3422
.. autosummary::
3523
:toctree: generated/
@@ -38,7 +26,7 @@
3826
intersections.intersection_mesh_mesh
3927
4028
Measure
41-
-------
29+
=======
4230
4331
.. autosummary::
4432
:toctree: generated/
@@ -47,7 +35,7 @@
4735
measure.volume
4836
4937
Meshing
50-
-------
38+
=======
5139
5240
.. autosummary::
5341
:toctree: generated/
@@ -56,7 +44,7 @@
5644
meshing.remesh
5745
5846
Slicer
59-
------
47+
======
6048
6149
.. autosummary::
6250
:toctree: generated/
@@ -65,7 +53,7 @@
6553
slicer.slice_mesh
6654
6755
Subdivision
68-
-----------
56+
===========
6957
7058
.. autosummary::
7159
:toctree: generated/
@@ -74,7 +62,7 @@
7462
subdivision.catmull_clark
7563
7664
Triangulation
77-
-------------
65+
=============
7866
7967
.. autosummary::
8068
:toctree: generated/

src/compas_cgal/booleans.py

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ def _boolean(A, B, operation):
88
99
Parameters
1010
----------
11-
A : tuple of vertices and faces
11+
A : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
1212
Mesh A.
13-
B : tuple of vertices and faces
13+
B : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
1414
Mesh B.
15-
operation : {'union', 'difference', 'intersection'}
15+
operation : Literal['union', 'difference', 'intersection']
1616
The type of boolean operation.
1717
1818
Returns
1919
-------
20-
list
21-
The vertices of the boolean mesh,
22-
and the faces of the boolean mesh,
23-
as a list of two numpy arrays.
20+
(V, 3) np.array[float]
21+
The vertices of the boolean mesh.
22+
(F, 3) np.array[int]
23+
The faces of the boolean mesh.
2424
2525
Raises
2626
------
@@ -49,14 +49,71 @@ def _boolean(A, B, operation):
4949

5050
@plugin(category='booleans', pluggable_name='boolean_union_mesh_mesh')
5151
def boolean_union(A, B):
52+
"""Boolean union of two meshes.
53+
54+
Parameters
55+
----------
56+
A : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
57+
Mesh A.
58+
B : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
59+
Mesh B.
60+
operation : Literal['union', 'difference', 'intersection']
61+
The type of boolean operation.
62+
63+
Returns
64+
-------
65+
(V, 3) np.array[float]
66+
The vertices of the boolean mesh.
67+
(F, 3) np.array[int]
68+
The faces of the boolean mesh.
69+
70+
"""
5271
return _boolean(A, B, 'union')
5372

5473

5574
@plugin(category='booleans', pluggable_name='boolean_difference_mesh_mesh')
5675
def boolean_difference(A, B):
76+
"""Boolean difference of two meshes.
77+
78+
Parameters
79+
----------
80+
A : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
81+
Mesh A.
82+
B : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
83+
Mesh B.
84+
operation : Literal['union', 'difference', 'intersection']
85+
The type of boolean operation.
86+
87+
Returns
88+
-------
89+
(V, 3) np.array[float]
90+
The vertices of the boolean mesh.
91+
(F, 3) np.array[int]
92+
The faces of the boolean mesh.
93+
94+
"""
5795
return _boolean(A, B, 'difference')
5896

5997

6098
@plugin(category='booleans', pluggable_name='boolean_intersection_mesh_mesh')
6199
def boolean_intersection(A, B):
100+
"""Boolean intersection of two meshes.
101+
102+
Parameters
103+
----------
104+
A : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
105+
Mesh A.
106+
B : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
107+
Mesh B.
108+
operation : Literal['union', 'difference', 'intersection']
109+
The type of boolean operation.
110+
111+
Returns
112+
-------
113+
(V, 3) np.array[float]
114+
The vertices of the boolean mesh.
115+
(F, 3) np.array[int]
116+
The faces of the boolean mesh.
117+
118+
"""
62119
return _boolean(A, B, 'intersection')

src/compas_cgal/intersections.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ def intersection_mesh_mesh(A, B):
99
1010
Parameters
1111
----------
12-
A : tuple of vertices and faces
12+
A : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
1313
Mesh A.
14-
B : tuple of vertices and faces
14+
B : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
1515
Mesh B.
1616
1717
Returns
1818
-------
19-
list of arrays of points
20-
The intersection polylines as arrays of points.
19+
list[np.array[np.array[float]]]
20+
A list of intersection polylines, with each polyline an array of points.
2121
2222
"""
2323
VA, FA = A

src/compas_cgal/measure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def volume(mesh):
99
1010
Parameters
1111
----------
12-
mesh : tuple of vertices and faces
12+
mesh : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
1313
The mesh.
1414
1515
Returns

src/compas_cgal/meshing.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@ def remesh(mesh, target_edge_length, number_of_iterations=10, do_project=True):
99
1010
Parameters
1111
----------
12-
mesh : tuple of vertices and faces
12+
mesh : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
1313
The mesh to remesh.
1414
target_edge_length : float
1515
The target edge length.
1616
number_of_iterations : int, optional
1717
Number of remeshing iterations.
18-
Default is ``10``.
1918
do_project : bool, optional
20-
Reproject vertices onto the input surface when they are created or displaced.
21-
Default is ``True``.
19+
If True, reproject vertices onto the input surface when they are created or displaced.
2220
2321
Returns
2422
-------
25-
list
26-
The vertices and faces of the new mesh.
23+
(V, 3) np.array[float]
24+
The vertices of the remeshed mesh.
25+
(F, 3) np.array[int]
26+
The faces of the remeshed mesh.
2727
2828
Notes
2929
-----
3030
This remeshing function only constrains the edges on the boundary of the mesh.
31-
To protect specific features or edges, please use :func:`remesh_constrained`.
31+
Protecting specific features or edges is not implemented yet.
3232
3333
"""
3434
V, F = mesh

src/compas_cgal/slicer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ def slice_mesh(mesh, planes):
99
1010
Parameters
1111
----------
12-
mesh : tuple of vertices and faces
12+
mesh : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
1313
The mesh to slice.
14-
planes : list of (point, normal) tuples or compas.geometry.Plane
14+
planes : list[[point, normal] | :class:`compas.geometry.Plane`]
1515
The slicing planes.
1616
1717
Returns
1818
-------
19-
list of arrays
20-
The points defining the slice polylines.
19+
list[np.array[np.array[float]]]
20+
A list of slice polylines, with each polyline an array of points.
2121
2222
"""
2323
vertices, faces = mesh

src/compas_cgal/subdivision.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ def catmull_clark(mesh, k=1):
77
88
Parameters
99
----------
10-
mesh : tuple of vertices and faces
10+
mesh : tuple[sequence[[float, float, float] | :class:`compas.geometry.Point`], sequence[[int, int, int]]]
1111
The mesh to remesh.
1212
k : int, optional
1313
The number of subdivision steps.
1414
1515
Returns
1616
-------
17-
list
18-
The vertices and faces of the subdivided mesh.
17+
(V, 3) np.array[float]
18+
The vertices of the subdivided mesh.
19+
(F, 4) np.array[int]
20+
The faces of the subdivided mesh.
1921
2022
"""
2123
V, F = mesh

src/compas_cgal/triangulation.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,19 @@ def conforming_delaunay_triangulation(boundary, points=None, holes=None, curves=
7777
----------
7878
boundary : :class:`compas.geometry.Polygon`
7979
The boundary of the triangulation.
80-
points : list of :class:`compas.geometry.Point`, optional
80+
points : list[:class:`compas.geometry.Point`], optional
8181
Additional internal points.
82-
holes : list of :class:`compas.geometry.Polygon`, optional
82+
holes : list[:class:`compas.geometry.Polygon`], optional
8383
Internal boundary polygons.
84-
curves : list of :class:`compas.geometry.Polyline`, optional
84+
curves : list[:class:`compas.geometry.Polyline`], optional
8585
Internal constraint curves.
8686
8787
Returns
8888
-------
89-
list
90-
The vertices and faces of the triangulation.
91-
92-
Notes
93-
-----
94-
...
89+
(V, 3) np.array[float]
90+
The vertices of the triangulation.
91+
(F, 3) np.array[int]
92+
The faces of the triangulation.
9593
9694
"""
9795
boundary = np.asarray(boundary, dtype=np.float64)
@@ -113,17 +111,17 @@ def conforming_delaunay_triangulation(boundary, points=None, holes=None, curves=
113111

114112

115113
def refined_delaunay_mesh(boundary, points=None, holes=None, curves=None, maxlength=None, is_optimized=False):
116-
"""Construct a refined Delaunay mesh [1]_.
114+
"""Construct a refined Delaunay mesh.
117115
118116
Parameters
119117
----------
120118
boundary : :class:`compas.geometry.Polygon`
121119
The boundary of the triangulation.
122-
points : list of :class:`compas.geometry.Point`, optional
120+
points : list[:class:`compas.geometry.Point`], optional
123121
Additional internal points.
124-
holes : list of :class:`compas.geometry.Polygon`, optional
122+
holes : list[:class:`compas.geometry.Polygon`], optional
125123
Internal boundary polygons.
126-
curves : list of :class:`compas.geometry.Polyline`, optional
124+
curves : list[:class:`compas.geometry.Polyline`], optional
127125
Internal constraint curves.
128126
maxlength : float, optional
129127
The maximum length of the triangle edges.
@@ -132,8 +130,10 @@ def refined_delaunay_mesh(boundary, points=None, holes=None, curves=None, maxlen
132130
133131
Returns
134132
-------
135-
list
136-
The vertices and faces of the triangulation.
133+
(V, 3) np.array[float]
134+
The vertices of the triangulation.
135+
(F, 3) np.array[int]
136+
The faces of the triangulation.
137137
138138
References
139139
----------

0 commit comments

Comments
 (0)