Skip to content

Commit 0aa8c23

Browse files
authored
Merge pull request #786 from compas-dev/static-api
Switch to static API
2 parents 71dc6c9 + da80d48 commit 0aa8c23

File tree

38 files changed

+1889
-2254
lines changed

38 files changed

+1889
-2254
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
## Unreleased
1010

1111
### Added
12+
1213
* Added `divide_polyline`, `divide_polyline_by_length`, `Polyline.split_at_corners` and `Polyline.tangent_at_point_on_polyline`.
1314
* Added the magic method `__str__` to `compas.geoemetry.Transformation`.
1415
* Added `redraw` flag to the `compas_rhino` methods `delete_object`, `delete_objects` and `purge_objects`.
1516
* Added the `__eq__` method for `compas.geometry.Circle` and `compas.geometry.Line`.
17+
* Added support for Pylance through static API definitions.
1618

1719
### Changed
1820

setup.cfg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,4 @@ line_length = 180
3333
known_first_party = compas
3434
default_section = THIRDPARTY
3535
forced_separate = test_compas
36-
not_skip = __init__.py
37-
skip = migrations
36+
skip = migrations, __init__.py

src/compas/datastructures/__init__.py

Lines changed: 202 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,206 @@
126126
127127
128128
"""
129-
130129
from __future__ import absolute_import
131-
132-
133-
from .datastructure import * # noqa: F401 E402 F403
134-
135-
from .network import * # noqa: F401 E402 F403
136-
from .mesh import * # noqa: F401 E402 F403
137-
from .volmesh import * # noqa: F401 E402 F403
138-
139-
140-
__all__ = [name for name in dir() if not name.startswith('_')]
130+
import compas
131+
132+
from .datastructure import Datastructure
133+
from .network import (
134+
Graph,
135+
Network,
136+
network_join_edges,
137+
network_polylines,
138+
network_split_edge,
139+
network_is_connected,
140+
network_complement,
141+
network_find_cycles,
142+
network_disconnected_nodes,
143+
network_disconnected_edges,
144+
network_explode,
145+
network_is_crossed,
146+
network_count_crossings,
147+
network_find_crossings,
148+
network_is_xy,
149+
network_is_planar,
150+
network_is_planar_embedding,
151+
network_embed_in_plane,
152+
network_embed_in_plane_proxy,
153+
network_smooth_centroid,
154+
network_transform,
155+
network_transformed,
156+
network_shortest_path
157+
)
158+
from .mesh import (
159+
HalfEdge,
160+
Mesh,
161+
trimesh_collapse_edge,
162+
mesh_add_vertex_to_face_edge,
163+
mesh_insert_vertex_on_edge,
164+
mesh_merge_faces,
165+
trimesh_split_edge,
166+
mesh_substitute_vertex_in_faces,
167+
trimesh_swap_edge,
168+
mesh_unweld_vertices,
169+
mesh_unweld_edges,
170+
mesh_conway_dual,
171+
mesh_conway_join,
172+
mesh_conway_ambo,
173+
mesh_conway_kis,
174+
mesh_conway_needle,
175+
mesh_conway_zip,
176+
mesh_conway_truncate,
177+
mesh_conway_ortho,
178+
mesh_conway_expand,
179+
mesh_conway_gyro,
180+
mesh_conway_snub,
181+
mesh_conway_meta,
182+
mesh_conway_bevel,
183+
trimesh_mean_curvature,
184+
trimesh_gaussian_curvature,
185+
mesh_disconnected_vertices,
186+
mesh_disconnected_faces,
187+
mesh_explode,
188+
trimesh_face_circle,
189+
mesh_weld,
190+
meshes_join,
191+
meshes_join_and_weld,
192+
mesh_offset,
193+
mesh_thicken,
194+
mesh_flatness,
195+
mesh_planarize_faces,
196+
trimesh_remesh
197+
)
198+
from .volmesh import (
199+
VolMesh,
200+
volmesh_bounding_box,
201+
volmesh_transform,
202+
volmesh_transformed
203+
)
204+
205+
if not compas.IPY:
206+
from .network import (
207+
network_adjacency_matrix,
208+
network_degree_matrix,
209+
network_connectivity_matrix,
210+
network_laplacian_matrix,
211+
)
212+
from .mesh import (
213+
mesh_adjacency_matrix,
214+
mesh_connectivity_matrix,
215+
mesh_degree_matrix,
216+
mesh_face_matrix,
217+
mesh_laplacian_matrix,
218+
trimesh_cotangent_laplacian_matrix,
219+
trimesh_vertexarea_matrix,
220+
mesh_oriented_bounding_box_numpy,
221+
mesh_oriented_bounding_box_xy_numpy,
222+
mesh_isolines_numpy,
223+
mesh_contours_numpy,
224+
trimesh_descent,
225+
mesh_geodesic_distances_numpy,
226+
trimesh_smooth_laplacian_cotangent,
227+
trimesh_pull_points_numpy,
228+
mesh_transform_numpy,
229+
mesh_transformed_numpy,
230+
trimesh_samplepoints_numpy,
231+
)
232+
233+
__all__ = [
234+
'Datastructure',
235+
# Networks
236+
'Graph',
237+
'Network',
238+
'network_join_edges',
239+
'network_polylines',
240+
'network_split_edge',
241+
'network_is_connected',
242+
'network_complement',
243+
'network_find_cycles',
244+
'network_disconnected_nodes',
245+
'network_disconnected_edges',
246+
'network_explode',
247+
'network_is_crossed',
248+
'network_count_crossings',
249+
'network_find_crossings',
250+
'network_is_xy',
251+
'network_is_planar',
252+
'network_is_planar_embedding',
253+
'network_embed_in_plane',
254+
'network_embed_in_plane_proxy',
255+
'network_smooth_centroid',
256+
'network_transform',
257+
'network_transformed',
258+
'network_shortest_path',
259+
# Meshes
260+
'HalfEdge',
261+
'Mesh',
262+
'trimesh_collapse_edge',
263+
'mesh_add_vertex_to_face_edge',
264+
'mesh_insert_vertex_on_edge',
265+
'mesh_merge_faces',
266+
'trimesh_split_edge',
267+
'mesh_substitute_vertex_in_faces',
268+
'trimesh_swap_edge',
269+
'mesh_unweld_vertices',
270+
'mesh_unweld_edges',
271+
'mesh_conway_dual',
272+
'mesh_conway_join',
273+
'mesh_conway_ambo',
274+
'mesh_conway_kis',
275+
'mesh_conway_needle',
276+
'mesh_conway_zip',
277+
'mesh_conway_truncate',
278+
'mesh_conway_ortho',
279+
'mesh_conway_expand',
280+
'mesh_conway_gyro',
281+
'mesh_conway_snub',
282+
'mesh_conway_meta',
283+
'mesh_conway_bevel',
284+
'trimesh_mean_curvature',
285+
'trimesh_gaussian_curvature',
286+
'mesh_disconnected_vertices',
287+
'mesh_disconnected_faces',
288+
'mesh_explode',
289+
'trimesh_face_circle',
290+
'mesh_weld',
291+
'meshes_join',
292+
'meshes_join_and_weld',
293+
'mesh_offset',
294+
'mesh_thicken',
295+
'mesh_flatness',
296+
'mesh_planarize_faces',
297+
'trimesh_remesh',
298+
# Volumetric Meshes
299+
'VolMesh',
300+
'volmesh_bounding_box',
301+
'volmesh_transform',
302+
'volmesh_transformed',
303+
]
304+
305+
if not compas.IPY:
306+
__all__ += [
307+
# Networks
308+
'network_adjacency_matrix',
309+
'network_degree_matrix',
310+
'network_connectivity_matrix',
311+
'network_laplacian_matrix',
312+
# Meshes
313+
'mesh_adjacency_matrix',
314+
'mesh_connectivity_matrix',
315+
'mesh_degree_matrix',
316+
'mesh_face_matrix',
317+
'mesh_laplacian_matrix',
318+
'trimesh_cotangent_laplacian_matrix',
319+
'trimesh_vertexarea_matrix',
320+
'mesh_oriented_bounding_box_numpy',
321+
'mesh_oriented_bounding_box_xy_numpy',
322+
'mesh_isolines_numpy',
323+
'mesh_contours_numpy',
324+
'trimesh_descent',
325+
'mesh_geodesic_distances_numpy',
326+
'trimesh_smooth_laplacian_cotangent',
327+
'trimesh_pull_points_numpy',
328+
'mesh_transform_numpy',
329+
'mesh_transformed_numpy',
330+
'trimesh_samplepoints_numpy',
331+
]

src/compas/datastructures/mesh/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from compas import IPY
66

77
from .core import * # noqa: F401 F403
8-
from ._mesh import * # noqa: F401 F403
98

109
from .bbox import * # noqa: F401 F403
1110
from .combinatorics import * # noqa: F401 F403
@@ -37,5 +36,7 @@
3736
from .transformations_numpy import * # noqa: F401 F403
3837
from .trimesh_samplepoints_numpy import * # noqa: F401 F403
3938

39+
from ._mesh import * # noqa: F401 F403
40+
4041

4142
__all__ = [name for name in dir() if not name.startswith('_')]

src/compas/datastructures/mesh/_mesh.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,7 @@ class Mesh(BaseMesh):
3737
3838
"""
3939

40-
def bounding_box(self):
41-
"""Compute the axis-aligned bounding box of the mesh.
42-
43-
Returns
44-
-------
45-
box: tuple of 8 points.
46-
The corners of the bounding box.
47-
The first 4 points are the corners of the bottom face, in counter clockwise direction wrt the positive Z-axis.
48-
The last 4 points are the corners of the top face, in counter clockwise direction wrt the positive Z-axis.
49-
50-
"""
51-
return mesh_bounding_box(self)
52-
40+
bounding_box = mesh_bounding_box
5341
bounding_box_xy = mesh_bounding_box_xy
5442
collapse_edge = mesh_collapse_edge
5543
connected_components = mesh_connected_components

0 commit comments

Comments
 (0)