diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 9cd5c8d98b1..770b5eeb010 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -12,10 +12,6 @@ replace = version="{new_version}" search = "$compas": "{current_version}" replace = "$compas": "{new_version}" -[bumpversion:file:docs/conf.py] -search = release = "{current_version}" -replace = release = "{new_version}" - [bumpversion:file:src/compas/__init__.py] search = __version__ = "{current_version}" replace = __version__ = "{new_version}" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d94bffed493..78564ace0e5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python: ['3.7', '3.8', '3.9', '3.10'] + python: ['3.8', '3.9', '3.10'] steps: - uses: compas-dev/compas-actions.build@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d11e657aa26..2cfac61a67b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,4 +30,5 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} build_ghpython_components: true gh_source: src/compas_ghpython/components - gh_target: src/compas_ghpython/components/ghuser \ No newline at end of file + gh_target: src/compas_ghpython/components/ghuser + release_name_prefix: COMPAS diff --git a/.gitignore b/.gitignore index a10d4f438f2..92e4d7aea2e 100644 --- a/.gitignore +++ b/.gitignore @@ -110,8 +110,7 @@ ENV/ dist/docs -docs/generated/ -docs/api/generated/ +generated *.3dmbak *.rhl diff --git a/AUTHORS.md b/AUTHORS.md index dfd24bbcd0b..848e678b9fe 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -2,7 +2,7 @@ ## Project Lead -- Tom Van Mele <> [@brgcode](https://github.com/brgcode), [@tomvanmele](https://github.com/tomvanmele) +- Tom Van Mele <> [@brgcode](https://github.com/brgcode), [@tomvanmele](https://github.com/tomvanmele) ## Main Developers diff --git a/CHANGELOG.md b/CHANGELOG.md index 17d83da1004..28b269e1157 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,20 +10,154 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * Added `create_id` to `compas_ghpython.utilities`. (moved from `compas_fab`) +* Added new predicates in `predicates_2` for points and polygons (XY) : `polygon_to_polygon_relationship_xy`, `point_to_polygon_relationship_xy`, `is_intersection_polygon_polygon_xy` * Added representation for features in `compas.datastructures.Part`. - -### Changed - +* Added `split` and `split_by_length` to `compas.geometry.Polyline`. +* Added `compas.rpc.XFunc`. +* Added `compas.data.Data.validate_jsonstring`. +* Added `compas.data.Data.validate_jsondata`. +* Added `compas.data.Data.JSONSCHEMA`. +* Added `compas.data.json_validate`. +* Added `compas.datastructures.Graph.JSONSCHEMA`. +* Added `compas.datastructures.Graph.to_jsondata`. +* Added `compas.datastructures.Graph.from_jsondata`. +* Added `compas.datastructures.Halfedge.JSONSCHEMA`. +* Added `compas.datastructures.Halfface.JSONSCHEMA`. +* Added `compas.geometry.Arc.JSONSCHEMA`. +* Added `compas.geometry.Bezier.JSONSCHEMA`. +* Added `compas.geometry.Box.JSONSCHEMA`. +* Added `compas.geometry.Capsule.JSONSCHEMA`. +* Added `compas.geometry.Circle.JSONSCHEMA`. +* Added `compas.geometry.Cone.JSONSCHEMA`. +* Added `compas.geometry.Cylinder.JSONSCHEMA`. +* Added `compas.geometry.Ellipse.JSONSCHEMA`. +* Added `compas.geometry.Frame.JSONSCHEMA`. +* Added `compas.geometry.Line.JSONSCHEMA`. +* Added `compas.geometry.NurbsCurve.JSONSCHEMA`. +* Added `compas.geometry.NurbsSurface.JSONSCHEMA`. +* Added `compas.geometry.Plane.JSONSCHEMA`. +* Added `compas.geometry.Point.JSONSCHEMA`. +* Added `compas.geometry.Pointcloud.JSONSCHEMA`. +* Added `compas.geometry.Polygon.JSONSCHEMA`. +* Added `compas.geometry.Polyhedron.JSONSCHEMA`. +* Added `compas.geometry.Polyline.JSONSCHEMA`. +* Added `compas.geometry.Sphere.JSONSCHEMA`. +* Added `compas.geometry.Torus.JSONSCHEMA`. +* Added `compas.geometry.Quaternion.JSONSCHEMA`. +* Added `compas.geometry.Vector.JSONSCHEMA`. +* Added `compas.datastructures.Halfedge.halfedge_loop_vertices`. +* Added `compas.datastructures.Halfedge.halfedge_strip_faces`. +* Added `compas.datastructures.Mesh.vertex_point`. +* Added `compas.datastructures.Mesh.vertices_points`. +* Added `compas.datastructures.Mesh.set_vertex_point`. +* Added `compas.datastructures.Mesh.edge_start`. +* Added `compas.datastructures.Mesh.edge_end`. +* Added `compas.datastructures.Mesh.edge_line`. +* Added `compas.datastructures.Mesh.face_points`. +* Added `compas.datastructures.Mesh.face_polygon`. +* Added `compas.datastructures.Mesh.face_circle`. +* Added `compas.datastructures.Mesh.face_frame`. +* Added `compas.datastructures.Graph.node_index` and `compas.datastructures.Graph.index_node`. +* Added `compas.datastructures.Graph.edge_index` and `compas.datastructures.Graph.index_edge`. +* Added `compas.datastructures.Halfedge.vertex_index` and `compas.datastructures.Halfedge.index_vertex`. +* Added new predicates in `predicates_2` for points and polygons (XY) : `polygon_to_polygon_relationship_xy`, `point_to_polygon_relationship_xy`, `is_intersection_polygon_polygon_xy` + +### Changed + +* Temporarily skip testing for python 3.7 due to a bug related to MacOS 13. * Fixed bug that caused a new-line at the end of the `compas.HERE` constant in IronPython for Mac. +* Fixed unbound method usage of `.cross()` on `Plane`, `Vector` and `Frame`. * Fixed Grasshopper `draw_polylines` method to return `PolylineCurve` instead of `Polyline` because the latter shows as only points. +* Fixed bug in the `is_polygon_in_polygon_xy` that was not correctly generating all the edges of the second polygon before checking for intersections. * Fixed `area_polygon` that was, in some cases, returning a negative area. * Fixed uninstall post-process. * Fixed support for `System.Decimal` data type on json serialization. * Fixed `offset_polygon` raising a TypeError when inputing a Polygon instead of a list of Points. * Simplified `compas.datastructures.Part` for more generic usage. - -### Removed - +* Changed `GLTFMesh.from_mesh` to read texture coordinates, vertex normals and colors if available and add to `GLTFMesh` +* Fixed bug in `VolMeshArtist.draw_cells` for Rhino, Blender and Grasshopper. +* Changed edge parameter of `compas.datastructures.Halfedge.edge_faces` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.Halfedge.halfedge_face` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.Halfedge.is_edge_on_boundary` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.Halfedge.halfedge_after` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.Halfedge.halfedge_before` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.trimesh_edge_cotangent` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.trimesh_edge_cotangents` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.Mesh.edge_coordinates` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.Mesh.edge_length` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.Mesh.edge_vector` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.Mesh.edge_point` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.Mesh.edge_midpoint` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.Mesh.edge_direction` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.is_collapse_legal` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.mesh_collapse_edge` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.trimesh_collapse_edge` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.mesh_insert_vertex_on_edge` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.mesh_split_edge` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.trimesh_split_edge` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed edge parameter of `compas.datastructures.trimesh_swap_edge` to 1 edge identifier (tuple of vertices) instead of two serparate vertex identifiers. +* Changed `compas.datastructures.Mesh.vertex_laplacian` to return `compas.geometry.Vector`. +* Changed `compas.datastructures.Mesh.neighborhood_centroid` to return `compas.geometry.Point`. +* Changed `compas.datastructures.Mesh.vertex_normal` to return `compas.geometry.Vector`. +* Changed `compas.datastructures.Mesh.edge_vector` to return `compas.geometry.Vector`. +* Changed `compas.datastructures.Mesh.edge_direction` to return `compas.geometry.Vector`. +* Changed `compas.datastructures.Mesh.edge_point` to return `compas.geometry.Point`. +* Changed `compas.datastructures.Mesh.edge_midpoint` to return `compas.geometry.Point`. +* Changed `compas.datastructures.Mesh.face_normal` to return `compas.geometry.Vector`. +* Changed `compas.datastructures.Mesh.face_centroid` to return `compas.geometry.Point`. +* Changed `compas.datastructures.Mesh.face_center` to return `compas.geometry.Point`. +* Changed `compas.datastructures.Mesh.face_plane` to return `compas.geometry.Plane`. +* Changed JSON validation to Draft202012. +* Changed `compas.data.Data.to_json` to include `compact=False` parameter. +* Changed `compas.data.Data.to_jsonstring` to include `compact=False` parameter. +* Changed `compas.data.json_dump` to include `compact=False` parameter. +* Changed `compas.data.json_dumps` to include `compact=False` parameter. +* Changed `compas.data.DataEncoder` and `compas.data.DataDecoder` to support `to_jsondata` and `from_jsondata`. +* Moved all API level docstrings from the `__init__.py` to the correspoding `.rst` file in the docs. + +### Removed + +* Removed all `__all__` beyond second level package. +* Removed deprecated `compas.utilities.coercing`. +* Removed deprecated `compas.utilities.encoders`. +* Removed deprecated `compas.utilities.xfunc`. +* Removed `compas.datastructures.Halfedge.get_any_vertex`. +* Removed `compas.datastructures.Halfedge.get_any_vertices`. +* Removed `compas.datastructures.Halfedge.get_any_face`. +* Removed "schemas" folder and all contained `.json` files from `compas.data`. +* Removed `compas.data.Data.DATASCHEMA`. +* Removed `compas.data.Data.JSONSCHEMANAME`. +* Removed `compas.data.Data.jsondefinititions`. +* Removed `compas.data.Data.jsonvalidator`. +* Removed `compas.data.Data.validate_data`. +* Removed `compas.datastructures.Graph.DATASCHEMA` and `compas.datastructures.Graph.JSONSCHEMANAME`. +* Removed `compas.datastructures.Halfedge.DATASCHEMA` and `compas.datastructures.Halfedge.JSONSCHEMANAME`. +* Removed `compas.datastructures.Halfface.DATASCHEMA` and `compas.datastructures.Halfface.JSONSCHEMANAME`. +* Removed `compas.geometry.Arc.DATASCHEMA` and `compas.geometry.Arc.JSONSCHEMANAME`. +* Removed `compas.geometry.Bezier.DATASCHEMA` and `compas.geometry.Bezier.JSONSCHEMANAME`. +* Removed `compas.geometry.Box.DATASCHEMA` and `compas.geometry.Box.JSONSCHEMANAME`. +* Removed `compas.geometry.Capsule.DATASCHEMA` and `compas.geometry.Capsule.JSONSCHEMANAME`. +* Removed `compas.geometry.Circle.DATASCHEMA` and `compas.geometry.Circle.JSONSCHEMANAME`. +* Removed `compas.geometry.Cone.DATASCHEMA` and `compas.geometry.Cone.JSONSCHEMANAME`. +* Removed `compas.geometry.Cylinder.DATASCHEMA` and `compas.geometry.Cylinder.JSONSCHEMANAME`. +* Removed `compas.geometry.Ellipse.DATASCHEMA` and `compas.geometry.Ellipse.JSONSCHEMANAME`. +* Removed `compas.geometry.Frame.DATASCHEMA` and `compas.geometry.Frame.JSONSCHEMANAME`. +* Removed `compas.geometry.Line.DATASCHEMA` and `compas.geometry.Line.JSONSCHEMANAME`. +* Removed `compas.geometry.NurbsCurve.DATASCHEMA` and `compas.geometry.NurbsCurve.JSONSCHEMANAME`. +* Removed `compas.geometry.NurbsSurface.DATASCHEMA` and `compas.geometry.NurbsSurface.JSONSCHEMANAME`. +* Removed `compas.geometry.Plane.DATASCHEMA` and `compas.geometry.Plane.JSONSCHEMANAME`. +* Removed `compas.geometry.Point.DATASCHEMA` and `compas.geometry.Point.JSONSCHEMANAME`. +* Removed `compas.geometry.Pointcloud.DATASCHEMA` and `compas.geometry.Pointcloud.JSONSCHEMANAME`. +* Removed `compas.geometry.Polygon.DATASCHEMA` and `compas.geometry.Polygon.JSONSCHEMANAME`. +* Removed `compas.geometry.Polyhedron.DATASCHEMA` and `compas.geometry.Polyhedron.JSONSCHEMANAME`. +* Removed `compas.geometry.Polyline.DATASCHEMA` and `compas.geometry.Polyline.JSONSCHEMANAME`. +* Removed `compas.geometry.Sphere.DATASCHEMA` and `compas.geometry.Sphere.JSONSCHEMANAME`. +* Removed `compas.geometry.Torus.DATASCHEMA` and `compas.geometry.Torus.JSONSCHEMANAME`. +* Removed `compas.geometry.Quaternion.DATASCHEMA` and `compas.geometry.Quaternion.JSONSCHEMANAME`. +* Removed `compas.geometry.Vector.DATASCHEMA` and `compas.geometry.Vector.JSONSCHEMANAME`. +* Removed `compas.datastructures.Graph.key_index`and `compas.datastructures.Graph.index_key`. +* Removed `compas.datastructures.Graph.uv_index`and `compas.datastructures.Graph.index_uv`. +* Removed `compas.datastructures.Halfedge.key_index` and `compas.datastructures.Halfedge.index_key`. ## [1.17.5] 2023-02-16 @@ -50,9 +184,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed serialization of some trimmed shapes in `RhinoBrep`. * Freeze black version to 22.12.0. * Fixed `is_point_in_circle_xy` second argument to access the origin of the plane of the circle. - -### Removed +* Changed `compas.datastructures.Graph.data` to contain unprocessed `node` and `edge` dicts. +* Changed `compas.datastructures.Halfedge.data` to contain unprocessed `vertex`, `face`, `facedata`, and `edgedata` dicts. +* Changed `compas.datastructures.Halfface.data` to contain unprocessed `vertex`, `cell`, `edge_data`, `face_data`, and `cell_data` dicts. +* Changed `compas.geometry.Arc.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Bezier.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Box.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Capsule.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Circle.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Cone.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Cylinder.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Ellipse.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Frame.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Line.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.NurbsCurve.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.NurbsSurface.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Plane.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Pointcloud.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Polygon.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Polyhedron.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Polyline.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Sphere.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Torus.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +* Changed `compas.geometry.Quaternion.data` to contain unprocessed COMPAS geometry objects, instead of their data dicts. +### Removed ## [1.17.4] 2022-12-06 @@ -70,7 +226,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Removed Python 3.6 from build workflows as it reached end-of-life at the end of 2021. - ## [1.17.3] 2022-11-09 ### Added @@ -83,7 +238,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.17.2] 2022-11-07 ### Added @@ -94,7 +248,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.17.1] 2022-11-06 ### Added @@ -112,7 +265,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.17.0] 2022-10-07 ### Added @@ -135,12 +287,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Based all gltf data classes on `BaseGLTFDataClass` * Fixed `Color.__get___` AttributeError. -* Fixed `RhinoSurface.curvature_at` not returning a Vector, but a Rhino SurfaceCurvature class object +* Fixed `RhinoSurface.curvature_at` not returning a Vector, but a Rhino SurfaceCurvature class object * Fixed `cylinder_to_rhino` conversion to match `compas.geometry.Cylinder` location. * Changed identification of cylinder brep face to non-zero in `compas_rhino.conversions.cylinder.Cylinder`. * Changed linter to `black`. * Automatically trigger `invoke format` during `invoke release`. -* Fixed bug in `intersections.intersection_circle_circle_xy` where the Circle's Plane was accessed instead of the centre. +* Fixed bug in `intersections.intersection_circle_circle_xy` where the Circle's Plane was accessed instead of the centre. * Fixed bug in `_core.tangent` where the Circle's Plane was accessed instead of the centre. * Fixed the `test_tangent` to work with a properly defined circle * `RhinoBrep` serialization works now with surface types other than NURBS. @@ -149,10 +301,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.16.0] 2022-06-20 - ### Added * Added `Polyline.extend`, `Polyline.extended`, `Polyline.shorten`, `Polyline.shortened`. @@ -175,7 +325,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed bug in `compas.robots.Configuration`. * Rebuild part index after deserialization in `Assembly`. * Fixed bug in `compas.artists.colordict.ColorDict`. -* Change `Mesh.mesh_dual` with option of including the boundary. +* Change `Mesh.mesh_dual` with option of including the boundary. * Fixed type error in `compas_rhino.conversions.box_to_rhino`. * Moved from `autopep8` to `black` * Fixed bug in `compas.utilities.linspace` for number series with high precision start and stop values. @@ -184,7 +334,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Locked `sphinx` to 4.5. * Changed `GLTFExporter` such that generated gltfs can be viewed with webxr * Fixed source directory path in `compas_ghpython.uninstall` plugin. -* Fixed bug in`compas_ghpython.components`that ignored input list of `.ghuser` objects to uninstall. +* Fixed bug in `compas_ghpython.components`that ignored input list of `.ghuser` objects to uninstall. * Fixed conversion bug of transformed `Box` in `compas_rhino.conversions` ### Removed @@ -192,7 +342,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Removed unused `compas_rhino.objects` (moved to `compas_ui`). * Removed unused `compas_rhino.ui` (moved to `compas_ui`). - ## [1.15.1] 2022-03-28 ### Added @@ -212,7 +361,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.15.0] 2022-03-22 ### Added @@ -270,7 +418,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Removed `compas.numerical.drx`. - ## [1.14.1] 2022-02-16 ### Added @@ -286,7 +433,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.14.0] 2022-02-06 ### Added @@ -384,7 +530,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.13.2] 2021-12-11 ### Added @@ -395,7 +540,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.13.1] 2021-12-11 ### Added @@ -407,7 +551,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.13.0] 2021-12-10 ### Added @@ -443,7 +586,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Removed `compas.artists.artist.new_artist` pluggable. - ## [1.12.2] 2021-11-30 ### Added @@ -454,7 +596,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.12.1] 2021-11-29 ### Added @@ -469,7 +610,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.12.0] 2021-11-17 ### Added @@ -491,7 +631,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.11.1] 2021-11-09 ### Added @@ -503,7 +642,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.11.0] 2021-11-08 ### Added @@ -522,7 +660,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.10.0] 2021-11-04 ### Added @@ -532,7 +669,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Added pluggables for `compas.geometry.NurbsCurve.__new__`, `compas.geometry.NurbsCurve.from_parameters`, `compas.geometry.NurbsCurve.from_points`, `compas.geometry.NurbsCurve.from_interpolation`, `compas.geometry.NurbsCurve.from_step`. * Added pluggables for `compas.geometry.NurbsSurface.__new__`, `compas.geometry.NurbsSurface.from_parameters`, `compas.geometry.NurbsSurface.from_points`, `compas.geometry.NurbsSurface.from_fill`, `compas.geometry.NurbsSurface.from_step`. * Added missing implementations for abstract clear methods of `compas_rhino.artists.volmeshartist`. - * Added `compas_rhino.geometry.RhinoBox`, `compas_rhino.geometry.RhinoCircle`, `compas_rhino.geometry.RhinoCone`, `compas_rhino.geometry.RhinoCurve`, `compas_rhino.geometry.RhinoCylinder`, `compas_rhino.geometry.RhinoEllipse`, `compas_rhino.geometry.RhinoLine`, `compas_rhino.geometry.RhinoMesh`, `compas_rhino.geometry.RhinoPlane`, `compas_rhino.geometry.RhinoPoint`, `compas_rhino.geometry.RhinoPolyline`, `compas_rhino.geometry.RhinoSphere`, `compas_rhino.geometry.RhinoSurface`, `compas_rhino.geometry.RhinoVector` as wrappers for working with Rhino geometry through geometry conversions or coercion of doc objects. * Added `compas_rhino.conversions` from COMPAS geometry to Rhino geometry and vice versa, for primitives, shapes, curves, surfaces, meshes. * Added `compas_rhino.coercion` from Rhino doc objects to Rhino geometry compatible with COMPAS geometry. @@ -545,7 +681,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.9.3] 2021-11-02 ### Added @@ -557,7 +692,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.9.2] 2021-11-02 ### Added @@ -571,7 +705,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.9.1] 2021-10-22 ### Added @@ -586,7 +719,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.9.0] 2021-10-21 ### Added @@ -628,7 +760,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.8.1] 2021-09-08 ### Added @@ -637,7 +768,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.8.0] 2021-09-08 ### Added @@ -648,6 +778,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Added general plotter for geometry objects and data structures based on the artist registration mechanism. * Added support for multimesh files to OBJ reader/writer. * Added support for attaching and detaching meshes in `compas.robots.RobotModelArtist` and drawing them. +* Added `reshape` in `compas.utilities`. * Added `compas.geometry.NurbsCurve`. * Added `compas.geometry.NurbsSurface`. * Added `compas_rhino.conversions`. @@ -688,7 +819,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.7.0] 2021-06-14 ### Added @@ -778,7 +908,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.6.1] 2021-05-12 ### Added @@ -787,7 +916,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.6.0] 2021-05-12 ### Added @@ -810,7 +938,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.5.0] 2021-04-20 ### Added @@ -831,7 +958,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.4.0] 2021-04-09 ### Added @@ -853,7 +979,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.3.0] 2021-03-26 ### Added @@ -868,7 +993,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.2.1] 2021-03-19 ### Added @@ -879,7 +1003,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed API removals from 1.0.0 -> 1.2.0 - ## [1.2.0] 2021-03-18 ### Added @@ -915,7 +1038,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.1.0] 2021-02-12 ### Added @@ -942,7 +1064,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [1.0.0] 2021-01-18 ### Added @@ -958,17 +1079,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.19.3] 2020-12-17 ### Added ### Changed + * Fix bug in `compas.datastructures.Network.neighborhood`. ### Removed - ## [0.19.2] 2020-12-17 ### Added @@ -979,7 +1099,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.19.1] 2020-12-10 ### Added @@ -990,7 +1109,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.19.0] 2020-12-09 ### Added @@ -1012,7 +1130,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Removed all implementations of `draw_collection`. - ## [0.18.1] 2020-12-01 ### Added @@ -1034,7 +1151,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.18.0] 2020-11-24 ### Added @@ -1068,7 +1184,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.17.2] 2020-11-04 ### Added @@ -1082,7 +1197,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.17.1] 2020-10-28 ### Added @@ -1142,7 +1256,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.16.8] 2020-10-14 ### Added @@ -1172,7 +1285,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.16.6] 2020-09-30 ### Added @@ -1187,7 +1299,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.16.5] 2020-09-26 ### Added @@ -1204,7 +1315,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.16.4] 2020-09-24 ### Added @@ -1215,7 +1325,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.16.3] 2020-09-23 ### Added @@ -1379,7 +1488,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.15.4] 2020-03-05 ### Added @@ -1398,7 +1506,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - ## [0.15.3] 2020-02-26 ### Added diff --git a/README.md b/README.md index e97aeac3f1d..3e023d4b8f4 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,12 @@ The framework consists of a general-purpose core library, written in pure Python COMPAS has dedicated packages for working with Rhino, Grasshopper, and Blender, but it can be used in any environment that supports Python scripting. It is available on PyPI and conda-forge and can be easily installed using popular package managers on multiple platforms. +## COMPAS 2.0! + +We are working on a new major release of the framework, COMPAS 2.0! +Therefore, be aware that the current version of the repository already contains some changes that are incompatible with the version 1 releases. +The documentation of the latest stable version (COMPAS 1.17.5) [is available here](https://compas.dev/compas/1.17.5). + ## Installation The recommended way to install **COMPAS** is to use [Anaconda/conda](https://conda.io/docs/): diff --git a/docs/_images/COMPAS.png b/docs/_images/COMPAS.png index 82cdae3ffc8..18253ece03a 100644 Binary files a/docs/_images/COMPAS.png and b/docs/_images/COMPAS.png differ diff --git a/docs/_images/_COMPAS.png b/docs/_images/_COMPAS.png new file mode 100644 index 00000000000..82cdae3ffc8 Binary files /dev/null and b/docs/_images/_COMPAS.png differ diff --git a/docs/_static/compas.css b/docs/_static/compas.css new file mode 100644 index 00000000000..60586bbe6a8 --- /dev/null +++ b/docs/_static/compas.css @@ -0,0 +1,105 @@ +html { + --pst-font-size-base: 1rem; + --pst-sidebar-font-size: 0.8rem; +} + +html[data-theme="light"] { + --pst-color-primary: #0092d2; + --pst-color-info: #0092d2; + --pst-color-text-muted: #888; +} + +body { + line-height: 1.75; + font-weight: 300; +} + +.bd-header { + box-shadow: none; + border-bottom: 1px solid var(--pst-color-shadow); +} + +.bd-sidebar-primary div#rtd-footer-container { + bottom: 0 !important; + margin: 0 !important; + display: none; +} + +.bd-sidebar-primary { + width: 20%; +} + +/* .bd-content { + flex-grow: 1; + max-width: 100%; +} + +.bd-page-width { + max-width: 100%; +} + +.bd-sidebar-primary { + padding-top: 1rem; +} */ + +.bd-sidebar-primary .toctree-l3 { + font-size: 0.8rem; +} + +@media (min-width: 960px) { + /* .bd-sidebar-primary { + max-width: 20%; + } */ + /* html[data-theme="light"] .bd-sidebar-primary { + background-color: var(--pst-color-surface); + } */ +} + +/* html[data-theme="light"] .bd-header { + background-color: var(--pst-color-primary); +} + +html[data-theme="light"] .bd-header .navbar-nav .nav-link { + color: rgba(255, 255, 255, 0.5); +} + +html[data-theme="light"] .bd-header .navbar-nav > .active > .nav-link { + color: rgba(255, 255, 255, 1); +} */ + +.navbar-brand img { + height: 32px; +} + +.bd-header .navbar-brand { + margin-right: 1rem; +} + +dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) dt.field-even, +dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) dt.field-odd { + background-color: var(--pst-color-surface); + margin-bottom: 1rem; + margin-top: 1rem; +} + +/* .bd-header-announcement::after { + background-color: var(--pst-color-attention); +} */ + +.lead { + font-size: 1rem !important; + font-weight: unset; +} + +.highlight pre { + line-height: 150% !important; + /* font-size: 0.75rem; */ +} + +.bd-footer-article { + margin-top: 2rem; +} + +.bd-breadcrumbs { + margin-top: 1rem; +} diff --git a/docs/_static/images/compas.ico b/docs/_static/images/compas.ico new file mode 100644 index 00000000000..ec6b1f27be9 Binary files /dev/null and b/docs/_static/images/compas.ico differ diff --git a/docs/_static/images/compas_icon.png b/docs/_static/images/compas_icon.png new file mode 100644 index 00000000000..f112c7b3c69 Binary files /dev/null and b/docs/_static/images/compas_icon.png differ diff --git a/docs/_static/images/compas_icon_white.png b/docs/_static/images/compas_icon_white.png new file mode 100644 index 00000000000..2c905bff94e Binary files /dev/null and b/docs/_static/images/compas_icon_white.png differ diff --git a/docs/_static/images/compas_icon_white_48.png b/docs/_static/images/compas_icon_white_48.png new file mode 100644 index 00000000000..f685a045350 Binary files /dev/null and b/docs/_static/images/compas_icon_white_48.png differ diff --git a/docs/_static/images/compas_icon_white_96.png b/docs/_static/images/compas_icon_white_96.png new file mode 100644 index 00000000000..157f04c8678 Binary files /dev/null and b/docs/_static/images/compas_icon_white_96.png differ diff --git a/docs/_static/images/compas_white.ico b/docs/_static/images/compas_white.ico new file mode 100644 index 00000000000..381bd9414fc Binary files /dev/null and b/docs/_static/images/compas_white.ico differ diff --git a/docs/_static/versions.json b/docs/_static/versions.json new file mode 100644 index 00000000000..b68dd1e089c --- /dev/null +++ b/docs/_static/versions.json @@ -0,0 +1,20 @@ +[ + { + "name": "latest", + "version": "unreleased", + "url": "https://compas.dev/compas/latest/" + }, + { + "name": "v1.17.5 (stable)", + "version": "1.17.5", + "url": "https://compas.dev/compas/1.17.5/" + }, + { + "version": "1.16.0", + "url": "https://compas.dev/compas/1.16.0/" + }, + { + "version": "1.15.0", + "url": "https://compas.dev/compas/1.15.0/" + } +] \ No newline at end of file diff --git a/docs/_templates/sidebar-nav-bs.html b/docs/_templates/sidebar-nav-bs.html new file mode 100644 index 00000000000..1051dc03b11 --- /dev/null +++ b/docs/_templates/sidebar-nav-bs.html @@ -0,0 +1,5 @@ + diff --git a/docs/api/compas.artists.rst b/docs/api/compas.artists.rst deleted file mode 100644 index fcf5a7d533b..00000000000 --- a/docs/api/compas.artists.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas.artists diff --git a/docs/api/compas.colors.rst b/docs/api/compas.colors.rst deleted file mode 100644 index 813c58c29e8..00000000000 --- a/docs/api/compas.colors.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas.colors diff --git a/docs/api/compas.data.rst b/docs/api/compas.data.rst deleted file mode 100644 index cca554bae79..00000000000 --- a/docs/api/compas.data.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas.data diff --git a/docs/api/compas.datastructures.rst b/docs/api/compas.datastructures.rst deleted file mode 100644 index 07537ca483d..00000000000 --- a/docs/api/compas.datastructures.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas.datastructures diff --git a/docs/api/compas.files.rst b/docs/api/compas.files.rst deleted file mode 100644 index ef15007f811..00000000000 --- a/docs/api/compas.files.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas.files diff --git a/docs/api/compas.geometry.rst b/docs/api/compas.geometry.rst deleted file mode 100644 index be54c9cb863..00000000000 --- a/docs/api/compas.geometry.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas.geometry diff --git a/docs/api/compas.numerical.rst b/docs/api/compas.numerical.rst deleted file mode 100644 index 8d17fc972e5..00000000000 --- a/docs/api/compas.numerical.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas.numerical diff --git a/docs/api/compas.plugins.rst b/docs/api/compas.plugins.rst deleted file mode 100644 index b34efe55e24..00000000000 --- a/docs/api/compas.plugins.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas.plugins diff --git a/docs/api/compas.robots.rst b/docs/api/compas.robots.rst deleted file mode 100644 index dced68ad1aa..00000000000 --- a/docs/api/compas.robots.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas.robots diff --git a/docs/api/compas.rpc.rst b/docs/api/compas.rpc.rst deleted file mode 100644 index eafc0c1660c..00000000000 --- a/docs/api/compas.rpc.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas.rpc diff --git a/docs/api/compas.rst b/docs/api/compas.rst deleted file mode 100644 index 22ae288dfcb..00000000000 --- a/docs/api/compas.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas \ No newline at end of file diff --git a/docs/api/compas.topology.rst b/docs/api/compas.topology.rst deleted file mode 100644 index 2b92e129138..00000000000 --- a/docs/api/compas.topology.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas.topology diff --git a/docs/api/compas.utilities.rst b/docs/api/compas.utilities.rst deleted file mode 100644 index 1736b9d5d63..00000000000 --- a/docs/api/compas.utilities.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas.utilities diff --git a/docs/api/compas_blender.artists.rst b/docs/api/compas_blender.artists.rst deleted file mode 100644 index e3f3ab55bdb..00000000000 --- a/docs/api/compas_blender.artists.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_blender.artists diff --git a/docs/api/compas_blender.conversions.rst b/docs/api/compas_blender.conversions.rst deleted file mode 100644 index b90e2ac37df..00000000000 --- a/docs/api/compas_blender.conversions.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_blender.conversions diff --git a/docs/api/compas_blender.geometry.rst b/docs/api/compas_blender.geometry.rst deleted file mode 100644 index 2dad6fcda94..00000000000 --- a/docs/api/compas_blender.geometry.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_blender.geometry diff --git a/docs/api/compas_blender.rst b/docs/api/compas_blender.rst deleted file mode 100644 index 1827075057e..00000000000 --- a/docs/api/compas_blender.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_blender \ No newline at end of file diff --git a/docs/api/compas_blender.ui.rst b/docs/api/compas_blender.ui.rst deleted file mode 100644 index 83fde2b8cff..00000000000 --- a/docs/api/compas_blender.ui.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_blender.ui diff --git a/docs/api/compas_blender.utilities.rst b/docs/api/compas_blender.utilities.rst deleted file mode 100644 index 958169fa95a..00000000000 --- a/docs/api/compas_blender.utilities.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_blender.utilities diff --git a/docs/api/compas_ghpython.artists.rst b/docs/api/compas_ghpython.artists.rst deleted file mode 100644 index fce9e261f93..00000000000 --- a/docs/api/compas_ghpython.artists.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_ghpython.artists diff --git a/docs/api/compas_ghpython.rst b/docs/api/compas_ghpython.rst deleted file mode 100644 index 6dd75548788..00000000000 --- a/docs/api/compas_ghpython.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_ghpython \ No newline at end of file diff --git a/docs/api/compas_ghpython.utilities.rst b/docs/api/compas_ghpython.utilities.rst deleted file mode 100644 index 7490bae5b44..00000000000 --- a/docs/api/compas_ghpython.utilities.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_ghpython.utilities diff --git a/docs/api/compas_plotters.artists.rst b/docs/api/compas_plotters.artists.rst deleted file mode 100644 index 2adae5f190b..00000000000 --- a/docs/api/compas_plotters.artists.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_plotters.artists \ No newline at end of file diff --git a/docs/api/compas_plotters.plotter.rst b/docs/api/compas_plotters.plotter.rst deleted file mode 100644 index 23321278b6a..00000000000 --- a/docs/api/compas_plotters.plotter.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_plotters.plotter \ No newline at end of file diff --git a/docs/api/compas_plotters.rst b/docs/api/compas_plotters.rst deleted file mode 100644 index 9527fa2cfd3..00000000000 --- a/docs/api/compas_plotters.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_plotters \ No newline at end of file diff --git a/docs/api/compas_rhino.artists.rst b/docs/api/compas_rhino.artists.rst deleted file mode 100644 index 0188f237dd5..00000000000 --- a/docs/api/compas_rhino.artists.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_rhino.artists diff --git a/docs/api/compas_rhino.conduits.rst b/docs/api/compas_rhino.conduits.rst deleted file mode 100644 index 833d6799513..00000000000 --- a/docs/api/compas_rhino.conduits.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_rhino.conduits diff --git a/docs/api/compas_rhino.conversions.rst b/docs/api/compas_rhino.conversions.rst deleted file mode 100644 index cf67a04dcc7..00000000000 --- a/docs/api/compas_rhino.conversions.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_rhino.conversions diff --git a/docs/api/compas_rhino.forms.rst b/docs/api/compas_rhino.forms.rst deleted file mode 100644 index 611b6e6f696..00000000000 --- a/docs/api/compas_rhino.forms.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_rhino.forms diff --git a/docs/api/compas_rhino.geometry.rst b/docs/api/compas_rhino.geometry.rst deleted file mode 100644 index d9a9eda4ca8..00000000000 --- a/docs/api/compas_rhino.geometry.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_rhino.geometry diff --git a/docs/api/compas_rhino.rst b/docs/api/compas_rhino.rst deleted file mode 100644 index 5be8eade1a3..00000000000 --- a/docs/api/compas_rhino.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_rhino \ No newline at end of file diff --git a/docs/api/compas_rhino.utilities.rst b/docs/api/compas_rhino.utilities.rst deleted file mode 100644 index 12af88730fb..00000000000 --- a/docs/api/compas_rhino.utilities.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. automodule:: compas_rhino.utilities diff --git a/docs/changelog.rst b/docs/changelog.rst deleted file mode 100644 index 7f216f61c40..00000000000 --- a/docs/changelog.rst +++ /dev/null @@ -1,2 +0,0 @@ - -.. mdinclude:: ../CHANGELOG.md diff --git a/docs/conf.py b/docs/conf.py index 3efdfd20811..d033e7ca706 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -5,58 +5,50 @@ # # needs_sphinx = "1.0" -import sys -import os import inspect import importlib -import m2r2 - +import re import sphinx_compas_theme -from sphinx.ext.napoleon.docstring import NumpyDocstring - -sys.path.append(os.path.join(os.path.dirname(__file__), "_ext")) - -# patches - -current_m2r2_setup = m2r2.setup - - -def patched_m2r2_setup(app): - try: - return current_m2r2_setup(app) - except (AttributeError): - app.add_source_suffix(".md", "markdown") - app.add_source_parser(m2r2.M2RParser) - return dict( - version=m2r2.__version__, - parallel_read_safe=True, - parallel_write_safe=True, - ) - - -m2r2.setup = patched_m2r2_setup # -- General configuration ------------------------------------------------ project = "COMPAS" -copyright = "Block Research Group - ETH Zurich" +copyright = "COMPAS Association" author = "Tom Van Mele" -release = "1.17.5" -version = ".".join(release.split(".")[0:2]) + +def get_latest_version(): + with open("../CHANGELOG.md", "r") as file: + content = file.read() + pattern = re.compile(r"## (Unreleased|\[\d+\.\d+\.\d+\])") + versions = pattern.findall(content) + latest_version = versions[0] if versions else None + if latest_version and latest_version.startswith("[") and latest_version.endswith("]"): + latest_version = latest_version[1:-1] + return latest_version + + +latest_version = get_latest_version() +if latest_version == "Unreleased": + release = "Unreleased" + version = "latest" +else: + release = latest_version + version = ".".join(release.split(".")[0:2]) master_doc = "index" source_suffix = { ".rst": "restructuredtext", ".md": "markdown", } -templates_path = sphinx_compas_theme.get_autosummary_templates_path() +templates_path = sphinx_compas_theme.get_autosummary_templates_path() + ["_templates"] exclude_patterns = ["_build", "**.ipynb_checkpoints", "_notebooks", "**/__temp"] -pygments_style = "sphinx" -show_authors = True +# pygments_style = "sphinx" +# pygments_dark_style = "monokai" +# show_authors = True add_module_names = True -language = None +language = "en" # -- Extension configuration ------------------------------------------------ @@ -67,27 +59,40 @@ def patched_m2r2_setup(app): "sphinx.ext.doctest", "sphinx.ext.intersphinx", "sphinx.ext.mathjax", - "sphinx.ext.napoleon", - "sphinx.ext.linkcode", + # "sphinx.ext.linkcode", "sphinx.ext.extlinks", "sphinx.ext.githubpages", "sphinx.ext.coverage", - "sphinx.ext.inheritance_diagram", + # "sphinx.ext.inheritance_diagram", "sphinx.ext.graphviz", "matplotlib.sphinxext.plot_directive", - "m2r2", - # "nbsphinx", "sphinx.ext.autodoc.typehints", - "tabs", + "sphinx_design", + "sphinx_inline_tabs", + "sphinx_togglebutton", + "sphinx_remove_toctrees", + "sphinx_copybutton", + # "sphinxcontrib.bibtex", + "numpydoc", ] +# remove_from_toctrees = ["api/generated/*"] + +numpydoc_show_class_members = False +numpydoc_class_members_toctree = False +numpydoc_attributes_as_param_list = True + +# bibtex options + +# bibtex_bibfiles = ['refs.bib'] + # autodoc options autodoc_type_aliases = {} # this does not work properly yet -autodoc_typehints = "none" -autodoc_typehints_format = "short" +# autodoc_typehints = "none" +# autodoc_typehints_format = "short" autodoc_typehints_description_target = "documented" autodoc_mock_imports = [ @@ -141,66 +146,8 @@ def setup(app): # graph options -inheritance_graph_attrs = dict(rankdir="LR", resolution=150) -inheritance_node_attrs = dict(fontsize=8) - -# napoleon options - -napoleon_google_docstring = False -napoleon_numpy_docstring = True -napoleon_include_init_with_doc = False -napoleon_include_private_with_doc = False -napoleon_include_special_with_doc = True -napoleon_use_admonition_for_examples = False -napoleon_use_admonition_for_notes = False -napoleon_use_admonition_for_references = False -napoleon_use_ivar = False -napoleon_use_param = False -napoleon_use_rtype = False - - -# first, we define new methods for any new sections and add them to the class -def parse_keys_section(self, section): - return self._format_fields("Keys", self._consume_fields()) - - -NumpyDocstring._parse_keys_section = parse_keys_section - - -def parse_attributes_section(self, section): - return self._format_fields("Attributes", self._consume_fields()) - - -NumpyDocstring._parse_attributes_section = parse_attributes_section - - -def parse_class_attributes_section(self, section): - return self._format_fields("Class Attributes", self._consume_fields()) - - -NumpyDocstring._parse_class_attributes_section = parse_class_attributes_section - - -def parse_other_attributes_section(self, section): - return self._format_fields("Other Attributes", self._consume_fields()) - - -NumpyDocstring._parse_other_attributes_section = parse_other_attributes_section - - -# we now patch the parse method to guarantee that the the above methods are -# assigned to the _section dict -def patched_parse(self): - self._sections["keys"] = self._parse_keys_section - self._sections["attributes"] = self._parse_attributes_section - self._sections["class attributes"] = self._parse_class_attributes_section - self._sections["other attributes"] = self._parse_other_attributes_section - self._unpatched_parse() - - -NumpyDocstring._unpatched_parse = NumpyDocstring._parse -NumpyDocstring._parse = patched_parse - +# inheritance_graph_attrs = dict(rankdir="LR", resolution=150) +# inheritance_node_attrs = dict(fontsize=8) # plot options @@ -208,25 +155,6 @@ def patched_parse(self): plot_html_show_source_link = False plot_html_show_formats = False plot_formats = ["png"] -# plot_pre_code -# plot_basedir -# plot_rcparams -# plot_apply_rcparams -# plot_working_directory - -plot_template = """ -{{ only_html }} - - {% for img in images %} - {% set has_class = false %} - - .. figure:: {{ build_dir }}/{{ img.basename }}.{{ default_fmt }} - :class: figure-img img-fluid - - {{ caption }} - - {% endfor %} -""" # intersphinx options @@ -286,23 +214,172 @@ def linkcode_resolve(domain, info): "blender": ("https://docs.blender.org/api/2.93/%s.html", "%s"), } +# from pytorch + +from sphinx.writers import html, html5 + +# def visit_reference(self, node: Element) -> None: +# atts = {'class': 'reference'} +# if node.get('internal') or 'refuri' not in node: +# atts['class'] += ' internal' +# else: +# atts['class'] += ' external' +# if 'refuri' in node: +# atts['href'] = node['refuri'] or '#' +# if self.settings.cloak_email_addresses and atts['href'].startswith('mailto:'): +# atts['href'] = self.cloak_mailto(atts['href']) +# self.in_mailto = True +# else: +# assert 'refid' in node, \ +# 'References must have "refuri" or "refid" attribute.' +# atts['href'] = '#' + node['refid'] +# if not isinstance(node.parent, nodes.TextElement): +# assert len(node) == 1 and isinstance(node[0], nodes.image) # NoQA: PT018 +# atts['class'] += ' image-reference' +# if 'reftitle' in node: +# atts['title'] = node['reftitle'] +# if 'target' in node: +# atts['target'] = node['target'] +# self.body.append(self.starttag(node, 'a', '', **atts)) + +# if node.get('secnumber'): +# self.body.append(('%s' + self.secnumber_suffix) % +# '.'.join(map(str, node['secnumber']))) + + +def replace(Klass): + old_call = Klass.visit_reference + + def visit_reference(self, node): + if "refuri" in node: + refuri = node.get("refuri") + if "generated" in refuri: + href_anchor = refuri.split("#") + if len(href_anchor) > 1: + href = href_anchor[0] + anchor = href_anchor[1] + page = href.split("/")[-1] + parts = page.split(".") + if parts[-1] == "html": + pagename = ".".join(parts[:-1]) + if anchor == pagename: + node["refuri"] = href + return old_call(self, node) + + Klass.visit_reference = visit_reference + + +replace(html.HTMLTranslator) +replace(html5.HTML5Translator) + # -- Options for HTML output ---------------------------------------------- -html_theme = "compas" -html_theme_path = sphinx_compas_theme.get_html_theme_path() +html_theme = "pydata_sphinx_theme" +html_logo = "_static/images/compas_icon_white.png" # relative to parent of conf.py +html_title = "COMPAS docs" +html_favicon = "_static/images/compas.ico" + html_theme_options = { - "navbar_active": "compas", - "package_version": release, - "package_docs": "https://compas.dev/compas/", - "package_old_versions_txt": "https://compas.dev/compas/doc_versions.txt", + # theme structure and layout + "navbar_start": ["navbar-logo"], + "navbar_center": ["navbar-nav"], + "navbar_end": [ + "version-switcher", + # "theme-switcher", + "navbar-icon-links", + ], + "navbar_persistent": ["search-button"], + "navbar_align": "content", + "article_header_start": [ + # "breadcrumbs" + ], + "article_header_end": [], + "primary_sidebar_end": [ + # "sidebar-ethical-ads" + ], + "secondary_sidebar_items": ["page-toc", "edit-this-page", "sourcelink"], + "article_footer_items": ["prev-next.html"], + "show_prev_next": True, + # "content_footer_items": [], + "footer_start": ["copyright", "sphinx-version"], + "footer_end": ["theme-version"], + # navigation and links + "external_links": [ + # {"name": "Changelog", "url": "https://github.com/compas-dev/compas/releases"}, + {"name": "COMPAS Framework", "url": "https://compas.dev"}, + # {"name": "COMPAS Association", "url": "https://compas.dev/association"}, + ], + "header_links_before_dropdown": 5, + "icon_links": [ + { + "name": "GitHub", + "url": "https://github.com/compas-dev/compas", + "icon": "fa-brands fa-github", + "type": "fontawesome", + }, + { + "name": "Discourse", + "url": "http://forum.compas-framework.org/", + "icon": "fa-brands fa-discourse", + "type": "fontawesome", + }, + { + "name": "PyPI", + "url": "https://pypi.org/project/COMPAS/", + "icon": "fa-brands fa-python", + "type": "fontawesome", + }, + ], + # "icon_links_label": "Quick Links", + "use_edit_page_button": True, + # user interface + "announcement": "This is the WIP documentation for the pre-release of COMPAS 2.0. The documentation of COMPAS 1.17.5 is available here.", + "switcher": { + "json_url": "https://raw.githubusercontent.com/compas-dev/compas/gh-pages/versions.json", + "version_match": version, + }, + "check_switcher": False, + # content and features + # theming and style + "logo": { + "image_light": "_static/images/compas_icon_white.png", # relative to parent of conf.py + "image_dark": "_static/images/compas_icon_white.png", # relative to parent of conf.py + "text": "COMPAS docs", + }, + "favicons": [ + { + "rel": "icon", + "href": "images/compas.ico", # relative to the static path + } + ], + "navigation_depth": 3, + "show_nav_level": 1, + "show_toc_level": 2, + "pygment_light_style": "default", + "pygment_dark_style": "monokai", +} + +html_sidebars = { + "**": [ + "sidebar-nav-bs", + # "sidebar-ethical-ads", + ], } -html_context = {} -html_static_path = sphinx_compas_theme.get_html_static_path() + +html_context = { + "github_url": "https://github.com", + "github_user": "compas-dev", + "github_repo": "compas", + "github_version": "main", + "doc_path": "docs", +} + +html_static_path = ["_static"] +html_css_files = ["compas.css"] html_extra_path = [] html_last_updated_fmt = "" html_copy_source = False -html_show_sourcelink = False +html_show_sourcelink = True html_permalinks = False html_permalinks_icon = "" -html_experimental_html5_writer = False html_compact_lists = True diff --git a/docs/devguide.rst b/docs/devguide.rst deleted file mode 100644 index 41f9466f131..00000000000 --- a/docs/devguide.rst +++ /dev/null @@ -1,419 +0,0 @@ -*************** -Developer Guide -*************** - -This guide is intended for people who want to contribute -to the code, documentation, and test coverage of the core COMPAS packages: - -* :mod:`compas` -* :mod:`compas_blender` -* :mod:`compas_ghpython` -* :mod:`compas_plotters` -* :mod:`compas_rhino` - -Note, however, that the general procedure is applicable to all COMPAS package development. - - -Setup/Installation -================== - -To set up a developer environment - -1. Fork `the repository `_ and clone the fork. -2. Create a virtual environment using your tool of choice (e.g. `virtualenv`, `conda`, etc). - - .. code-block:: bash - - conda create -n compas-dev python=3.8 cython --yes - conda activate compas-dev - -3. Install development dependencies: - - .. code-block:: bash - - cd path/to/compas - pip install -r requirements-dev.txt - -4. Make sure all tests pass and the code is free of lint: - - .. code-block:: bash - - invoke lint - invoke test - -5. Create a branch for your contributions. - - .. code-block:: - - git branch title-proposed-changes - git checkout title-proposed-changes - -6. Start making changes! - - -Submitting a PR -=============== - -Once you are done making changes, you have to submit your contribution through a pull request (PR). -The procedure for submitting a PR is the following. - -1. Make sure all tests still pass, the code is free of lint, and the docstrings compile correctly: - - .. code-block:: bash - - invoke lint - invoke test - invoke docs - -2. Add yourself to ``AUTHORS.md``. -3. Summarize the changes you made in ``CHANGELOG.md``. -4. Commit your changes and push your branch to GitHub. -5. Create a `pull request `_. - - -Style guide -=========== - -Please run ``invoke format`` to auto-format your code. - -The command ``invoke lint`` runs the entire codebase through both ``black`` and ``flake8``. -As described in the `docs `_, -``flake8`` includes lint checks provided by the PyFlakes project, -PEP-0008 inspired style checks provided by the PyCodeStyle project, -and McCabe complexity checking provided by the McCabe project. - -The list of potential error codes issued by ``flake8`` are available here: -https://flake8.pycqa.org/en/latest/user/error-codes.html - -The PEP-0008 style guide is available here: -https://www.python.org/dev/peps/pep-0008/ - -Note that the maximum line length is set to 120 rather 79 in the ``setup.cfg`` of the repo. - - -Naming conventions -================== - -We (intend to) use the following naming conventions. - -1. variables, functions, methods, attributes use "snake_case": - they are written in lowercase and spaces between words are replaced by underscores. - -2. class names use (Upper) "CamelCase": - The are written in lowercase, with the first letter of each word capitalized - and spaces between words removed. - -3. module or package level variables are in uppercase - and with spaces between words replaced by underscores. - - -Quotes -====== - -Ideally, we would use the following conventions for quotes. - -1. Double quotation marks for multiline statements and docstrings. - For example, ``"""Calculate the sum of two numbers."""`` - -2. Single quotation marks for strings that are used "as variables". - For example, ``config['param'] = 1``. - -3. Double quotation marks for strings that are meant to be used as text. - For examples, ``message = "Select one or more points."`` - - -Documentation -============= - -The documentation of COMPAS is generated with Sphinx. -This means that code docstrings and general documentation pages -have to be written in RestructuredText. - -Each function, method, and class should have a docstring describing its behaviour. -We use ``sphinx.ext.napoleon`` to allow for human-readable docstrings, -and prefer Numpy-style docstring formatting rules. - -* https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html -* https://numpydoc.readthedocs.io/en/latest/format.html - -To include a new function or class in the documentation, -it should be added to the API docstring in ``__init__.py`` of the main package it belongs to. - -For example, if you add a function somewhere in the geometry package, -make sure to include it in the docstring of ``compas.geometry.__init__.py``. - - -Type hints -========== - -Type hints should be added to stub files at the public API level -of the main packages (see :ref:`code-structure`). -This allows the type hints to be written using Python 3 style -annotations while maintaining compatibility with Python 2.7 for Rhino/GH. - -For example, the type hints for ``compas.datastructures`` should be defined in -``compas.datastructures.__init__.pyi``. - - -.. _code-structure: - -Code structure -============== - -Each of the core packages is divided into subpackages that group functionality into logical components. -For example, :mod:`compas` is divided into: - -* :mod:`compas.datastructures` -* :mod:`compas.files` -* :mod:`compas.geometry` -* :mod:`compas.numerical` -* :mod:`compas.robots` -* :mod:`compas.rpc` -* :mod:`compas.topology` -* :mod:`compas.utilities` - -The API of each subpackage is documented in the docstring of its ``__init__.py`` file using basic RestructuredText. -From outside of these packages, functionality should be imported directly from the subpackage level, -regardless of the code structure underneath. - -For example, in some ``script.py``: - -.. code-block:: python - - from compas.datastructures import Mesh - from compas.datastructures import Network - - from compas.geometry import add_vectors - from compas.geometry import oriented_bounding_box_numpy - from compas.geometry import Polygon - from compas.geometry import Transformation - - from compas.numerical import pca_numpy - from compas.numerical import fd_numpy - -To allow the public API of the modules and packages contained in a subpackage to reach the subpackage level, -each module should declare the classes, functions and variables of its public API in the module's ``__all__`` variable. -Per package, the APIs of the contained module are collected in the ``__all__`` variable of the package (in the ``__init__.py``). - -.. code-block:: python - - __all__ = [_ for _ in dir() if not _.startswith('_')] - - -Dependencies -============ - -More info coming soon... - - -Testing -======= - -Although we still have a significant backlog of existing functionality -not yet covered by unit tests, at least all newly added functionality -should have a corresponding test. - -We use ``pytest`` as a testing framework. -The tests are in the ``tests`` folder at the root of the repo. - -More info coming soon... - -Grasshopper components -====================== - -Grasshopper user objects need to be built using `COMPAS Github Action componentizer `_. - -1. Apply your changes to the component source code (``src/compas_ghpython/components``). -2. Rebuild them: - - .. code-block:: bash - - invoke build-ghuser-components - -3. Install them on Rhino/Grasshopper as usual: - - .. code-block:: bash - - python -m compas_rhino.install - -The install step does not copy them, but creates a symlink to the location in which they are built, -so after the first installation, it is usually not required to reinstall them, only rebuild them (unless a new component is added). - -.. note:: - - This step requires IronPython version 2.7 to be available on the system. The default behavior is to run the command - ``ipy``. If this command is not available or is the wrong version, the optional ``ironpython`` argument will replace it, eg - ``invoke build-ghuser-components --ironpython="mono path/to/ipy.exe"``. - -.. _plugins: - -Plugins -======= - -COMPAS has an extensible architecture based on plugins that allows to -customize and extend the functionality of the core framework. - -For a plugin to work, there needs to exist a counterpart to be connected to. -This means there are two components involved: - -* :meth:`compas.plugins.pluggable` interface: the *extension point* that COMPAS defines - as the counterpart for plugins to connect to. -* :meth:`compas.plugins.plugin` implementation: a *concrete implementation* of the - ``pluggable`` interface. - -Both of these components are declared using decorators: - -.. code-block:: python - - @pluggable - def do_hard_stuff(input): - pass - - @plugin(pluggable_name='do_hard_stuff') - def do_hard_stuff_numpy(input): - # NOTE: Here use the power of numpy to do hard stuff very fast - # .. - -Once these parts are implemented, the program could simply -call the function ``do_hard_stuff`` and the appropriate plugin -implementation using ``numpy`` would be called automatically. - - -Why are plugins important? --------------------------- - -The example above is just a single code block, but the power of plugins comes -from the ability to split those two parts -the :meth:`compas.plugins.pluggable` -and the :meth:`compas.plugins.plugin`- into completely different files, folders -or even entire projects and still work the same way. - -Additionally, COMPAS is able to pick the most suitable plugin implementation -for its current execution context. For instance, one could have two implementations -of the same :meth:`compas.plugins.pluggable` definition, one using ``numpy`` and -another one using *Rhino SDK* and have the correct one automatically selected -based on where your script is executing. - - -How to make plugins discoverable? ---------------------------------- - -COMPAS plugin discovery is based on naming conventions. This is mainly due to -the need to support IronPython inside Rhino, which lacks ``setuptools`` -infrastructure. For more details, check -`these python guidelines `_. - -A COMPAS plugin needs to fulfill two conditions: - -* **Name**: The package name should be prefixed with ``compas``, eg. ``compas_cgal``. -* **Metadata**: The package should define a bit of metadata listing the modules that contain plugins. - This is done declaring a variable called ``__all_plugins__``, - eg. ``__all_plugins__ = ['compas_cgal.booleans']``. - -COMPAS automatically discovers plugins searching over all available packages in the system, -and picks up those prefixed with the ``compas`` word. -All packages are included in the search: packages installed with ``pip``, packages made -available through the ``PYTHONPATH`` / ``IRONPYTHONPATH``, local packages, etc. - -Once a package is found, the metadata in ``__all_plugins__`` is read and all modules -listed are analyzed to look for functions decorated with the :meth:`compas.plugins.plugin` -decorator. - - -Two kinds of extension points ------------------------------ - -An extension point, or *pluggable* interface can be declared as being one of two types -based on how they select which implementation to pick if there are multiple available. - -* ``selector='first_match'``: this type of extension point will pick the first plugin - implementation that satisfies the requirements. -* ``selector='collect_all'``: extension points defined with this selector will instead - collect all plugin implementations and execute them all, collecting the return - values into a list. An example of this is the Rhino install extension - point: :meth:`compas_rhino.install.installable_rhino_packages`. - - -A complete example ------------------- - -Let's explore a complete example to gain a better understanding. - - -Extension point -^^^^^^^^^^^^^^^ - -For the sake of example, we are going to assume that ``compas`` core defines -the following :meth:`compas.plugins.pluggable` interface in - -**compas/geometry/booleans/__init__.py** - -.. code-block:: python - - @pluggable(category='booleans') - def boolean_union_mesh_mesh(A, B): - pass - - -Plugin -^^^^^^ - -Now let's write a plugin that implements this interface: - -**compas_plugin_sample/__init__.py** - -.. code-block:: python - - __all_plugins__ = ['compas_plugin_sample.boolean_trimesh'] - - -**compas_plugin_sample/boolean_trimesh.py** - -.. code-block:: python - - import trimesh - - @plugin(category='booleans', requires=['trimesh']) - def boolean_union_mesh_mesh(A, B): - va, fa = A - at = trimesh.Trimesh(vertices=va, faces=fa) - - vb, fb = B - bt = trimesh.Trimesh(vertices=vb, faces=fb) - - r = at.union(bt, engine='scad') - - return r.vertices, r.faces - -Voilà! We have a trimesh-based boolean union plugin! - - -Advanced options ----------------- - -There are a few additional options that plugins can use: - -* ``requires``: List of requirements. COMPAS will filter out plugins if their - requirements list is not satisfied at runtime. This allows to have multiple implementations - of the same operation and have them selected based on different criteria. - The requirement can either be a package name string (e.g. ``requires=['scipy']``) or - a ``callable`` with a boolean return value, in which any arbitrary check can be implemented - (e.g. ``requires=[lambda: is_rhino_active()]``). -* ``tryfirst`` and ``trylast``: Plugins cannot control the exact priority they will have - but they can indicate whether to try to prioritize them or demote them as fallback using - these two boolean parameters. -* ``pluggable_name``: Usually, the name of the decorated plugin method matches that of the - pluggable interface. When that is not the case, the pluggable name can be specified via - this parameter. -* ``domain``: extension points are unambiguously identified by a URL that combines domain, - category and pluggable name. All COMPAS core plugins use the same domain, but other - packages could potentially decide to use a different domain to ensure collision-free - naming of pluggable extension points. - -While developing plugins, it is also possible to enable print output to understand what -how plugin selection works behind the scenes. To enable that, set ``DEBUG`` flag -accordingly: - -.. code-block:: python - - from compas.plugins import plugin_manager - plugin_manager.DEBUG = True diff --git a/docs/devguide/gh_components.rst b/docs/devguide/gh_components.rst new file mode 100644 index 00000000000..927c2370357 --- /dev/null +++ b/docs/devguide/gh_components.rst @@ -0,0 +1,31 @@ +********************** +Grasshopper Components +********************** + +.. warning:: + + Under construction... + +Grasshopper user objects need to be built using `COMPAS Github Action componentizer `_. + +1. Apply your changes to the component source code (``src/compas_ghpython/components``). +2. Rebuild them: + + .. code-block:: bash + + invoke build-ghuser-components + +3. Install them on Rhino/Grasshopper as usual: + + .. code-block:: bash + + python -m compas_rhino.install + +The install step does not copy them, but creates a symlink to the location in which they are built, +so after the first installation, it is usually not required to reinstall them, only rebuild them (unless a new component is added). + +.. note:: + + This step requires IronPython version 2.7 to be available on the system. The default behavior is to run the command + ``ipy``. If this command is not available or is the wrong version, the optional ``ironpython`` argument will replace it, eg + ``invoke build-ghuser-components --ironpython="mono path/to/ipy.exe"``. diff --git a/docs/devguide/index.rst b/docs/devguide/index.rst new file mode 100644 index 00000000000..59ede42454b --- /dev/null +++ b/docs/devguide/index.rst @@ -0,0 +1,12 @@ +Developer Guide +=============== + +.. toctree:: + :maxdepth: 2 + :titlesonly: + + workflow + style + gh_components + plugins + pluggables diff --git a/docs/plugins.rst b/docs/devguide/pluggables.rst similarity index 66% rename from docs/plugins.rst rename to docs/devguide/pluggables.rst index 3848b564b12..5a4593a1512 100644 --- a/docs/plugins.rst +++ b/docs/devguide/pluggables.rst @@ -1,18 +1,19 @@ -================ -Extension points -================ +========== +Pluggables +========== .. rst-class:: lead -COMPAS has an extensible architecture based on plugins that allows to +COMPAS has an extensible architecture based on pluggables and plugins that allows to customize and extend the functionality of the core framework. -Check out the developer guide for additional details. -The following *extension points* are currently defined: +Categories +========== +The following *extension points* are currently defined. -Category: ``booleans`` -^^^^^^^^^^^^^^^^^^^^^^ +``booleans`` +------------ .. currentmodule:: compas.geometry @@ -20,9 +21,8 @@ Category: ``booleans`` * :func:`boolean_difference_mesh_mesh` * :func:`boolean_intersection_mesh_mesh` - -Category: ``install`` -^^^^^^^^^^^^^^^^^^^^^ +``install`` +----------- .. currentmodule:: compas_rhino.uninstall @@ -31,8 +31,8 @@ Category: ``install`` * :func:`after_rhino_uninstall` -Category: ``intersections`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^ +``intersections`` +----------------- .. currentmodule:: compas.geometry @@ -40,16 +40,16 @@ Category: ``intersections`` * :func:`intersection_ray_mesh` -Category: ``quadmesh`` -^^^^^^^^^^^^^^^^^^^^^^ +``quadmesh`` +------------ .. currentmodule:: compas.geometry * :func:`quadmesh_planarize` -Category: ``triangulation`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^ +``triangulation`` +----------------- .. currentmodule:: compas.geometry @@ -58,8 +58,8 @@ Category: ``triangulation`` * :func:`conforming_delaunay_triangulation` -Category: ``trimesh`` -^^^^^^^^^^^^^^^^^^^^^ +``trimesh`` +----------- .. currentmodule:: compas.geometry diff --git a/docs/devguide/plugins.rst b/docs/devguide/plugins.rst new file mode 100644 index 00000000000..97b1be9ebf1 --- /dev/null +++ b/docs/devguide/plugins.rst @@ -0,0 +1,175 @@ +******* +Plugins +******* + +What are plugins? +----------------- + +COMPAS has an extensible architecture based on plugins that allows to +customize and extend the functionality of the core framework. + +For a plugin to work, there needs to exist a counterpart to be connected to. +This means there are two components involved: + +* :meth:`compas.plugins.pluggable` interface: the *extension point* that COMPAS defines + as the counterpart for plugins to connect to. +* :meth:`compas.plugins.plugin` implementation: a *concrete implementation* of the + ``pluggable`` interface. + +Both of these components are declared using decorators: + +.. code-block:: python + + @pluggable + def do_hard_stuff(input): + pass + + @plugin(pluggable_name='do_hard_stuff') + def do_hard_stuff_numpy(input): + # NOTE: Here use the power of numpy to do hard stuff very fast + # .. + +Once these parts are implemented, the program could simply +call the function ``do_hard_stuff`` and the appropriate plugin +implementation using ``numpy`` would be called automatically. + + +Why are plugins important? +-------------------------- + +The example above is just a single code block, but the power of plugins comes +from the ability to split those two parts -the :meth:`compas.plugins.pluggable` +and the :meth:`compas.plugins.plugin`- into completely different files, folders +or even entire projects and still work the same way. + +Additionally, COMPAS is able to pick the most suitable plugin implementation +for its current execution context. For instance, one could have two implementations +of the same :meth:`compas.plugins.pluggable` definition, one using ``numpy`` and +another one using *Rhino SDK* and have the correct one automatically selected +based on where your script is executing. + + +How to make plugins discoverable? +--------------------------------- + +COMPAS plugin discovery is based on naming conventions. This is mainly due to +the need to support IronPython inside Rhino, which lacks ``setuptools`` +infrastructure. For more details, check +`these python guidelines `_. + +A COMPAS plugin needs to fulfill two conditions: + +* **Name**: The package name should be prefixed with ``compas``, eg. ``compas_cgal``. +* **Metadata**: The package should define a bit of metadata listing the modules that contain plugins. + This is done declaring a variable called ``__all_plugins__``, + eg. ``__all_plugins__ = ['compas_cgal.booleans']``. + +COMPAS automatically discovers plugins searching over all available packages in the system, +and picks up those prefixed with the ``compas`` word. +All packages are included in the search: packages installed with ``pip``, packages made +available through the ``PYTHONPATH`` / ``IRONPYTHONPATH``, local packages, etc. + +Once a package is found, the metadata in ``__all_plugins__`` is read and all modules +listed are analyzed to look for functions decorated with the :meth:`compas.plugins.plugin` +decorator. + + +Two kinds of extension points +----------------------------- + +An extension point, or *pluggable* interface can be declared as being one of two types +based on how they select which implementation to pick if there are multiple available. + +* ``selector='first_match'``: this type of extension point will pick the first plugin + implementation that satisfies the requirements. +* ``selector='collect_all'``: extension points defined with this selector will instead + collect all plugin implementations and execute them all, collecting the return + values into a list. An example of this is the Rhino install extension + point: :meth:`compas_rhino.install.installable_rhino_packages`. + + +A complete example +------------------ + +Let's explore a complete example to gain a better understanding. + + +Extension point +^^^^^^^^^^^^^^^ + +For the sake of example, we are going to assume that ``compas`` core defines +the following :meth:`compas.plugins.pluggable` interface in + +**compas/geometry/booleans/__init__.py** + +.. code-block:: python + + @pluggable(category='booleans') + def boolean_union_mesh_mesh(A, B): + pass + + +Plugin +^^^^^^ + +Now let's write a plugin that implements this interface: + +**compas_plugin_sample/__init__.py** + +.. code-block:: python + + __all_plugins__ = ['compas_plugin_sample.boolean_trimesh'] + + +**compas_plugin_sample/boolean_trimesh.py** + +.. code-block:: python + + import trimesh + + @plugin(category='booleans', requires=['trimesh']) + def boolean_union_mesh_mesh(A, B): + va, fa = A + at = trimesh.Trimesh(vertices=va, faces=fa) + + vb, fb = B + bt = trimesh.Trimesh(vertices=vb, faces=fb) + + r = at.union(bt, engine='scad') + + return r.vertices, r.faces + +Voilà! We have a trimesh-based boolean union plugin! + + +Advanced options +---------------- + +There are a few additional options that plugins can use: + +* ``requires``: List of requirements. COMPAS will filter out plugins if their + requirements list is not satisfied at runtime. This allows to have multiple implementations + of the same operation and have them selected based on different criteria. + The requirement can either be a package name string (e.g. ``requires=['scipy']``) or + a ``callable`` with a boolean return value, in which any arbitrary check can be implemented + (e.g. ``requires=[lambda: is_rhino_active()]``). +* ``tryfirst`` and ``trylast``: Plugins cannot control the exact priority they will have + but they can indicate whether to try to prioritize them or demote them as fallback using + these two boolean parameters. +* ``pluggable_name``: Usually, the name of the decorated plugin method matches that of the + pluggable interface. When that is not the case, the pluggable name can be specified via + this parameter. +* ``domain``: extension points are unambiguously identified by a URL that combines domain, + category and pluggable name. All COMPAS core plugins use the same domain, but other + packages could potentially decide to use a different domain to ensure collision-free + naming of pluggable extension points. + +While developing plugins, it is also possible to enable print output to understand what +how plugin selection works behind the scenes. To enable that, set ``DEBUG`` flag +accordingly: + +.. code-block:: python + + from compas.plugins import plugin_manager + plugin_manager.DEBUG = True + diff --git a/docs/devguide/style.rst b/docs/devguide/style.rst new file mode 100644 index 00000000000..faf9a2f7d84 --- /dev/null +++ b/docs/devguide/style.rst @@ -0,0 +1,117 @@ +*********** +Style Guide +*********** + +Code formatting +=============== + +Please run ``invoke format`` to auto-format your code. + +The command ``invoke lint`` runs the entire codebase through both ``black`` and ``flake8``. +As described in the `docs `_, +``flake8`` includes lint checks provided by the PyFlakes project, +PEP-0008 inspired style checks provided by the PyCodeStyle project, +and McCabe complexity checking provided by the McCabe project. + +The list of potential error codes issued by ``flake8`` are available here: +https://flake8.pycqa.org/en/latest/user/error-codes.html + +The PEP-0008 style guide is available here: +https://www.python.org/dev/peps/pep-0008/ + +Note that the maximum line length is set to 120 rather 79 in the ``setup.cfg`` of the repo. + + +Naming conventions +================== + +We (intend to) use the following naming conventions. + +1. variables, functions, methods, attributes use "snake_case": + they are written in lowercase and spaces between words are replaced by underscores. + +2. class names use (Upper) "CamelCase": + The are written in lowercase, with the first letter of each word capitalized + and spaces between words removed. + +3. module or package level variables are in uppercase + and with spaces between words replaced by underscores. + + +Quotes +====== + +Ideally, we would use the following conventions for quotes. + +1. Double quotation marks for multiline statements and docstrings. + For example, ``"""Calculate the sum of two numbers."""`` + +2. Single quotation marks for strings that are used "as variables". + For example, ``config['param'] = 1``. + +3. Double quotation marks for strings that are meant to be used as text. + For examples, ``message = "Select one or more points."`` + + +Documentation +============= + +The documentation of COMPAS is generated with Sphinx. +This means that code docstrings and general documentation pages +have to be written in RestructuredText. + +Each function, method, and class should have a docstring describing its behaviour. +We use ``sphinx.ext.napoleon`` to allow for human-readable docstrings, +and prefer Numpy-style docstring formatting rules. + +* https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html +* https://numpydoc.readthedocs.io/en/latest/format.html + +To include a new function or class in the documentation, +it should be added to the API docstring in ``__init__.py`` of the main package it belongs to. + +For example, if you add a function somewhere in the geometry package, +make sure to include it in the docstring of ``compas.geometry.__init__.py``. + + +Type hints +========== + +.. _code-structure: + + +Code structure +============== + +Each of the core packages is divided into subpackages that group functionality into logical components. +For example, :mod:`compas` is divided into: + +* :mod:`compas.artists` +* :mod:`compas.data` +* :mod:`compas.datastructures` +* :mod:`compas.files` +* :mod:`compas.geometry` +* :mod:`compas.numerical` +* :mod:`compas.robots` +* :mod:`compas.rpc` +* :mod:`compas.topology` +* :mod:`compas.utilities` + +The API of each subpackage is documented in the docstring of its ``__init__.py`` file using basic RestructuredText. +From outside of these packages, functionality should be imported directly from the subpackage level, +regardless of the code structure underneath. + +For example, in some ``script.py``: + +.. code-block:: python + + from compas.datastructures import Mesh + from compas.datastructures import Network + + from compas.geometry import add_vectors + from compas.geometry import oriented_bounding_box_numpy + from compas.geometry import Polygon + from compas.geometry import Transformation + + from compas.numerical import pca_numpy + from compas.numerical import fd_numpy diff --git a/docs/devguide/workflow.rst b/docs/devguide/workflow.rst new file mode 100644 index 00000000000..d4e8b0c0bae --- /dev/null +++ b/docs/devguide/workflow.rst @@ -0,0 +1,58 @@ +******** +Workflow +******** + +Setup +===== + +To set up a developer environment + +1. Fork `the repository `_ and clone the fork. +2. Create a virtual environment using your tool of choice (e.g. `virtualenv`, `conda`, etc). + + .. code-block:: bash + + conda create -n compas-dev python=3.8 cython --yes + conda activate compas-dev + +3. Install development dependencies: + + .. code-block:: bash + + cd path/to/compas + pip install -r requirements-dev.txt + +4. Make sure all tests pass and the code is free of lint: + + .. code-block:: bash + + invoke lint + invoke test + +5. Create a branch for your contributions. + + .. code-block:: + + git branch title-proposed-changes + git checkout title-proposed-changes + +6. Start making changes! + +Submitting a PR +=============== + +Once you are done making changes, you have to submit your contribution through a pull request (PR). +The procedure for submitting a PR is the following. + +1. Make sure all tests still pass, the code is free of lint, and the docstrings compile correctly: + + .. code-block:: bash + + invoke lint + invoke test + invoke docs + +2. Add yourself to ``AUTHORS.md``. +3. Summarize the changes you made in ``CHANGELOG.md``. +4. Commit your changes and push your branch to GitHub. +5. Create a `pull request `_. diff --git a/docs/extensions/aec.rst b/docs/extensions/aec.rst new file mode 100644 index 00000000000..9101d07cd45 --- /dev/null +++ b/docs/extensions/aec.rst @@ -0,0 +1,53 @@ +************** +AEC Extensions +************** + +.. warning:: + + This page is still under construction. + Therefore its contents are likely to change frequently... + +.. grid:: 2 + + .. grid-item-card:: compas_fab + + Robotic fabrication package facilitating the planning and execution of robotic fabrication processes. + It provides interfaces to existing software libraries and tools available in the field of robotics (e.g. OMPL, ROS) + and makes them accessible from within the parametric design environment. + + `compas_fab `_ + + .. grid-item-card:: compas_fea(2) + + Finite Element Analysis package providing an easy-to-use modelling language for FEA problems, + and the possibility to use different backend solvers from a single problem description. + + `compas_fea(2) `_ + +.. grid:: 2 + + .. grid-item-card:: compas_ifc + + Add description... + + `compas_ifc `_ + + .. grid-item-card:: compas_slicer + + Add description... + + `compas_slicer `_ + +.. grid:: 2 + + .. grid-item-card:: compas_fofin + + Add description... + + `compas_fofin `_ + + .. grid-item-card:: compas_view2 + + Add description... + + `compas_view2 `_ diff --git a/docs/extensions/core.rst b/docs/extensions/core.rst new file mode 100644 index 00000000000..aa44bec9349 --- /dev/null +++ b/docs/extensions/core.rst @@ -0,0 +1,80 @@ +*************** +Core Extensions +*************** + +.. warning:: + + This page is still under construction. + Therefore its contents are likely to change frequently... + +The core extension packages are COMPAS-friendly Python wrappers for libraries written in other languages, or for their Python bindings. +In many cases, the functionality of the extensions is implemented as plugins for the pluggable functions of COMPAS core. +It can be therefore be used from :mod:`compas` using the pluggables, or, of course, directly from the extension packages themselves. +A list of pluggables in COMPAS core is available here: :doc:`/devguide/pluggables`. + +compas_cgal +=========== + +`compas_cgal `_ is a Python binding (generated with PyBind11) for a selection of algorithms of `CGAL, The Computational Geometry Algorithms Library `_. +Among other things, the package provides implementations for the pluggables for boolean operations, triangulation, remeshing, and mesh slicing. + +.. code-block:: python + + # this snippet should be updated... + + from compas.geometry import Box, Sphere + + A = Box(2, 2, 2) + B = Sphere(1, point=[1, 1, 1]) + + C = A + B + +compas_occ +========== + +`compas_occ `_ is a wrapper for the Python binding (:mod:`pythonocc`) of `OpenCascade `_. +and provides support for NURBS geometry and Boundary Representations (BREPs), independently of Rhino. + +.. code-block:: python + + from compas.geometry import Point, NurbsSurface + + points = [ + [Point(0, 0, 0), Point(1, 0, 0), Point(2, 0, 0), Point(3, 0, 0)], + [Point(0, 1, 0), Point(1, 1, 2), Point(2, 1, 2), Point(3, 1, 0)], + [Point(0, 2, 0), Point(1, 2, 2), Point(2, 2, 2), Point(3, 2, 0)], + [Point(0, 3, 0), Point(1, 3, 0), Point(2, 3, 0), Point(3, 3, 0)], + ] + + surface = NurbsSurface.from_points(points) + +compas_libigl +============= + +`compas_libigl `_ is a Python binding (generated with PyBind11) for a selection of algorithms of `libigl, the geometry processing library of the Interactive Geometry Lab `_. +The package supplements the `official Python binding of libigl `_, and provides functionality that is easier to use in combination with COMPAS. + +.. code-block:: python + + # add snippet... + +compas_gmsh +=========== + +`compas_gmsh `_ is a wrapper for the Python binding (:mod:`gmsh`) of `Gmsh, A three-dimensional finite element mesh generator with built-in pre- and post-processing facilities `_, +and provides high quality 3D meshing functionality for Finite Element Analysis applications. + +.. code-block:: python + + # add snippet... + +compas_triangle +=============== + +`compas_triangle `_ is a wrapper for the +`Cython implementation `_ of Jonathan Shewchuck's `Triangle `_ library, +a Two-Dimensional Quality Mesh Generator and Delaunay Triangulator. + +.. code-block:: python + + # add snippet... diff --git a/docs/extensions/index.rst b/docs/extensions/index.rst new file mode 100644 index 00000000000..cb59bf52473 --- /dev/null +++ b/docs/extensions/index.rst @@ -0,0 +1,19 @@ +********** +Extensions +********** + +COMPAS provides many extensions that supplement the functionality of the core library, +and provide access to state-of-the-art research in the fields of +geometry processing, form finding, digital fabrication, discrete element modelling, finite element analysis, and many more. + +Here, the extensions are listed that are managed by the core development team. +Extensions contributed by the community can be found at ... + +Guidelines for the development of extension packages can be found in the developer guide: [...] + +.. toctree:: + :maxdepth: 2 + :titlesonly: + + core + aec diff --git a/docs/index.rst b/docs/index.rst index 92de8449381..402ca985500 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,52 +1,89 @@ +:html_theme.sidebar_secondary.remove: + ******************************************************************************** -COMPAS Docs +COMPAS Documentation ******************************************************************************** .. rst-class:: lead -This is the documentation of the main library of COMPAS, -an open source framework for research and collaboration +This is the documentation of the core infratructure of COMPAS, +an open source framework for computational research and collaboration in Architecture, Engineering, Fabrication, and Construction. -.. figure:: /_images/COMPAS.png - :figclass: figure - :class: figure-img img-fluid +.. .. figure:: /_images/COMPAS.png +.. :figclass: figure +.. :class: figure-img img-fluid + +.. The main package of COMPAS (:mod:`compas`) defines all functionality for geometry processing, +.. data structures, topology, numerical methods, robotics, the plugin mechanism, remote procedure calls ... +.. and can be used independently of CAD systems in any environment that supports Python programming. + +.. The CAD packages (:mod:`compas_rhino`, :mod:`compas_ghpython`, :mod:`compas_blender`) +.. provide a unified framework for reading and writing CAD geometry, for visualization +.. of COMPAS geometry and data structures, and for basic user inter interaction +.. in Blender, Rhino, and Grasshopper. + +.. The package for 2D visualisation (:mod:`compas_plotters`) +.. simplifies "plotting" of COMPAS geometry objects and data structures. + +.. Sections +.. ======== + +.. The documentation is divided into the following sections. + +.. grid:: 2 + :gutter: 4 + + .. grid-item-card:: + + User Guide + ^^^^^^^^^^ + + If you want to use COMPAS for your research or in one of your projects, + this is the place to start. + + .. toctree:: + :maxdepth: 2 + :titlesonly: + + userguide/index + + + .. grid-item-card:: + + Package Reference + ^^^^^^^^^^^^^^^^^ + + The reference documentation of the core package and the CAD packages. + + .. toctree:: + :maxdepth: 2 + :titlesonly: + + reference/index -The core package of COMPAS (:mod:`compas`) defines all functionality for geometry processing, -data structures, topology, numerical methods, robotics, the plugin mechanism, remote procedure calls ... -and can be used independently of CAD systems in any environment that supports Python programming. + .. grid-item-card:: -The CAD packages (:mod:`compas_rhino`, :mod:`compas_ghpython`, :mod:`compas_blender`) -provide a unified framework for reading and writing CAD geometry, for visualization -of COMPAS geometry and data structures, and for basic user inter interaction -in Blender, Rhino, and Grasshopper. + Extensions + ^^^^^^^^^^ -The package for 2D visualisation (:mod:`compas_plotters`) -simplifies "plotting" of COMPAS geometry objects and data structures. + The core extensions to COMPAS and the AEC toolboxes manages by the compas-dev team are listed here. + .. toctree:: + :maxdepth: 2 + :titlesonly: -Table of Contents -================= + extensions/index -.. toctree:: - :maxdepth: 3 - :titlesonly: + .. grid-item-card:: - Introduction - installation - gettingstarted - tutorial - api - plugins - devguide - changelog - releases - license - citing + Developer Guide + ^^^^^^^^^^^^^^^ + If you want to contribute to COMPAS, this is the place to start. -Indices and tables -================== + .. toctree:: + :maxdepth: 2 + :titlesonly: -* :ref:`genindex` -* :ref:`search` + devguide/index diff --git a/docs/reference/compas.artists.rst b/docs/reference/compas.artists.rst new file mode 100644 index 00000000000..6dcb702a2d1 --- /dev/null +++ b/docs/reference/compas.artists.rst @@ -0,0 +1,54 @@ +******************************************************************************** +compas.artists +******************************************************************************** + +.. currentmodule:: compas.artists + +.. rst-class:: lead + +For visualization of geometry objects, robots, and data structures, COMPAS provides "artists". +Every object type is paired with a corresponding artist type that is capable of visualizing the data of the object. +This package provides base artist classes with pluggable methods +that receive an implementation from plugins defined by various visualization contexts. + + +Classes +======= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Artist + CurveArtist + RobotModelArtist + MeshArtist + NetworkArtist + PrimitiveArtist + ShapeArtist + SurfaceArtist + VolMeshArtist + + +Exceptions +========== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + DataArtistNotRegistered + NoArtistContextError + + +Pluggables +========== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + clear + redraw + register_artists + diff --git a/docs/reference/compas.colors.rst b/docs/reference/compas.colors.rst new file mode 100644 index 00000000000..78e14a16bd7 --- /dev/null +++ b/docs/reference/compas.colors.rst @@ -0,0 +1,21 @@ +******************************************************************************** +compas.colors +******************************************************************************** + +.. currentmodule:: compas.colors + +.. rst-class:: lead + +This package provides a class for working with colors in different color spaces, +and color maps for various color palettes. + + +Classes +======= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Color + ColorMap diff --git a/docs/reference/compas.data.rst b/docs/reference/compas.data.rst new file mode 100644 index 00000000000..b47d32af201 --- /dev/null +++ b/docs/reference/compas.data.rst @@ -0,0 +1,63 @@ +******************************************************************************** +compas.data +******************************************************************************** + +.. currentmodule:: compas.data + +.. rst-class:: lead + +This package provides a base data class for all COMPAS data objects such as geometry objects, robots, and data structures, +and the infrastructure for data validation, conversion, coercion, and JSON serialisation. + + +Classes +======= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Data + DataEncoder + DataDecoder + + +Functions +========= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + json_load + json_loads + json_dump + json_dumps + + +Validators +========== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + is_sequence_of_int + is_sequence_of_uint + is_sequence_of_float + is_int3 + is_float3 + is_float4x4 + is_item_iterable + validate_data + + +Exceptions +========== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + DecoderError + diff --git a/docs/reference/compas.datastructures.rst b/docs/reference/compas.datastructures.rst new file mode 100644 index 00000000000..1897bd8f179 --- /dev/null +++ b/docs/reference/compas.datastructures.rst @@ -0,0 +1,187 @@ +******************************************************************************** +compas.datastructures +******************************************************************************** + +.. currentmodule:: compas.datastructures + +.. rst-class:: lead + +This package provides functionality for working with topologically structured data. + +Classes +======= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Datastructure + Graph + HalfEdge + HalfFace + Mesh + Network + VolMesh + Assembly + Part + Feature + GeometricFeature + ParametricFeature + + +Exceptions +========== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + AssemblyError + FeatureError + + +Functions +========= + +Network +------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + network_adjacency_matrix + network_complement + network_connectivity_matrix + network_count_crossings + network_degree_matrix + network_disconnected_edges + network_disconnected_nodes + network_embed_in_plane_proxy + network_embed_in_plane + network_explode + network_find_crossings + network_find_cycles + network_is_connected + network_is_crossed + network_is_planar_embedding + network_is_planar + network_is_xy + network_join_edges + network_laplacian_matrix + network_polylines + network_shortest_path + network_smooth_centroid + network_split_edge + network_transform + network_transformed + +Mesh +---- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + mesh_add_vertex_to_face_edge + mesh_adjacency_matrix + mesh_bounding_box_xy + mesh_bounding_box + mesh_collapse_edge + mesh_connected_components + mesh_connectivity_matrix + mesh_contours_numpy + mesh_conway_ambo + mesh_conway_bevel + mesh_conway_dual + mesh_conway_expand + mesh_conway_gyro + mesh_conway_join + mesh_conway_kis + mesh_conway_meta + mesh_conway_needle + mesh_conway_ortho + mesh_conway_snub + mesh_conway_truncate + mesh_conway_zip + mesh_degree_matrix + mesh_delete_duplicate_vertices + mesh_disconnected_faces + mesh_disconnected_vertices + mesh_dual + mesh_explode + mesh_face_adjacency + mesh_face_matrix + mesh_flatness + mesh_flip_cycles + mesh_geodesic_distances_numpy + mesh_insert_vertex_on_edge + mesh_is_connected + mesh_isolines_numpy + mesh_laplacian_matrix + mesh_merge_faces + mesh_offset + mesh_oriented_bounding_box_numpy + mesh_oriented_bounding_box_xy_numpy + mesh_planarize_faces + mesh_quads_to_triangles + mesh_slice_plane + mesh_smooth_area + mesh_smooth_centerofmass + mesh_smooth_centroid + mesh_split_edge + mesh_split_face + mesh_split_strip + mesh_subdivide_catmullclark + mesh_subdivide_corner + mesh_subdivide_doosabin + mesh_subdivide_frames + mesh_subdivide_quad + mesh_subdivide_tri + mesh_subdivide + mesh_substitute_vertex_in_faces + mesh_thicken + mesh_transform + mesh_transform_numpy + mesh_transformed + mesh_transformed_numpy + mesh_unify_cycles + mesh_unweld_edges + mesh_unweld_vertices + mesh_weld + meshes_join_and_weld + meshes_join + trimesh_collapse_edge + trimesh_cotangent_laplacian_matrix + trimesh_descent + trimesh_face_circle + trimesh_gaussian_curvature + trimesh_mean_curvature + trimesh_pull_points_numpy + trimesh_remesh + trimesh_samplepoints_numpy + trimesh_smooth_laplacian_cotangent + trimesh_split_edge + trimesh_subdivide_loop + trimesh_swap_edge + trimesh_vertexarea_matrix + +VolMesh +------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + volmesh_bounding_box + volmesh_transform + volmesh_transformed + + +Assembly +-------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + diff --git a/docs/reference/compas.files.rst b/docs/reference/compas.files.rst new file mode 100644 index 00000000000..9bf93c3bec6 --- /dev/null +++ b/docs/reference/compas.files.rst @@ -0,0 +1,127 @@ +******************************************************************************** +compas.files +******************************************************************************** + +.. currentmodule:: compas.files + +.. rst-class:: lead + +This package provides classes for working with selected file formats that are capable +of storing information about 2D and 3D geometry, robots, pointclouds, ... + + +DXF +=== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + DXF + DXFReader + DXFParser + + +GLTF +==== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + GLTF + GLTFReader + GLTFParser + GLTFContent + GLTFMesh + GLTFExporter + + +LAS +=== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + LAS + LASReader + LASParser + + +OBJ +=== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + OBJ + OBJReader + OBJParser + OBJWriter + + +OFF +=== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + OFF + OFFReader + OFFWriter + + +PLY +=== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + PLY + PLYReader + PLYParser + PLYWriter + + +STL +=== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + STL + STLReader + STLParser + STLWriter + + +URDF +==== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + URDF + URDFParser + URDFElement + URDFGenericElement + + +XML +=== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + XML + XMLReader + XMLWriter + XMLElement + prettify_string diff --git a/docs/reference/compas.geometry.rst b/docs/reference/compas.geometry.rst new file mode 100644 index 00000000000..a9e0876ded1 --- /dev/null +++ b/docs/reference/compas.geometry.rst @@ -0,0 +1,543 @@ +******************************************************************************** +compas.geometry +******************************************************************************** + +.. currentmodule:: compas.geometry + +.. rst-class:: lead + +This package provides a wide range of geometry objects and geometric algorithms +independent from the geometry kernels of CAD software. + + +Primitives +========== + +Bases +----- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Geometry + Primitive + Shape + Curve + Surface + +0-dimensional +------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Vector + Quaternion + Point + Pointcloud + Plane + Frame + +1-dimensional +------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Line + Polyline + Bezier + NurbsCurve + +2-dimensional +------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Circle + Ellipse + Polygon + NurbsSurface + Arc + +3-dimensional +------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Box + Sphere + Cylinder + Cone + Capsule + Torus + Polyhedron + +Boundary Representation (Brep) +------------------------------ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Brep + BrepVertex + BrepEdge + BrepLoop + BrepFace + BrepTrim + BrepTrimIsoStatus + + BrepType + BrepOrientation + + BrepError + BrepInvalidError + BrepTrimmingError + +Transformations +=============== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Projection + Reflection + Rotation + Scale + Shear + Transformation + Translation + + +Functions +========= + +Points, Vectors, Lines, Planes, Circles +--------------------------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + angle_points + angle_points_xy + angle_vectors + angle_vectors_xy + angle_vectors_signed + angles_points + angles_points_xy + angles_vectors + angles_vectors_xy + angle_planes + centroid_points + centroid_points_xy + centroid_points_weighted + circle_from_points + circle_from_points_xy + midpoint_point_point + midpoint_point_point_xy + midpoint_line + midpoint_line_xy + tangent_points_to_circle_xy + + +Polygons & Polyhedrons +---------------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + area_polygon + area_polygon_xy + area_triangle + area_triangle_xy + centroid_polygon + centroid_polygon_xy + centroid_polygon_vertices + centroid_polygon_vertices_xy + centroid_polygon_edges + centroid_polygon_edges_xy + centroid_polyhedron + normal_polygon + normal_triangle + normal_triangle_xy + volume_polyhedron + + +Point Sets +---------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + bestfit_circle_numpy + bestfit_frame_numpy + bestfit_plane + bestfit_plane_numpy + bestfit_sphere_numpy + bounding_box + bounding_box_xy + convex_hull + convex_hull_numpy + convex_hull_xy + convex_hull_xy_numpy + icp_numpy + oabb_numpy + oriented_bounding_box_numpy + oriented_bounding_box_xy_numpy + + +Distance +-------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + closest_line_to_point + closest_point_in_cloud + closest_point_in_cloud_xy + closest_point_on_line + closest_point_on_line_xy + closest_point_on_plane + closest_point_on_polyline + closest_point_on_polyline_xy + closest_point_on_segment + closest_point_on_segment_xy + distance_line_line + distance_point_point + distance_point_point_xy + distance_point_point_sqrd + distance_point_point_sqrd_xy + distance_point_line + distance_point_line_xy + distance_point_line_sqrd + distance_point_line_sqrd_xy + distance_point_plane + distance_point_plane_signed + + +Intersections +------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + intersection_circle_circle_xy + intersection_ellipse_line_xy + intersection_line_box_xy + intersection_line_line_xy + intersection_line_line + intersection_line_plane + intersection_line_segment_xy + intersection_line_segment + intersection_line_triangle + intersection_mesh_mesh + intersection_plane_circle + intersection_plane_plane_plane + intersection_plane_plane + intersection_polyline_plane + intersection_ray_mesh + intersection_segment_plane + intersection_segment_polyline + intersection_segment_polyline_xy + intersection_segment_segment + intersection_segment_segment_xy + intersection_sphere_line + intersection_sphere_sphere + + +Interpolation +------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + barycentric_coordinates + discrete_coons_patch + tween_points + tween_points_distance + + +Offsets +------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + offset_line + offset_polyline + offset_polygon + + +Boolean operations +------------------ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + boolean_union_mesh_mesh + boolean_difference_mesh_mesh + boolean_intersection_mesh_mesh + + +Triangulation +------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + conforming_delaunay_triangulation + constrained_delaunay_triangulation + delaunay_from_points + delaunay_from_points_numpy + delaunay_triangulation + voronoi_from_points_numpy + + +Triangle meshes +--------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + trimesh_gaussian_curvature + trimesh_geodistance + trimesh_harmonic + trimesh_isolines + trimesh_lscm + trimesh_mean_curvature + trimesh_massmatrix + trimesh_principal_curvature + trimesh_remesh + trimesh_remesh_constrained + trimesh_remesh_along_isoline + trimesh_slice + + +Quad meshes +----------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + quadmesh_planarize + + +Predicates +---------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + is_ccw_xy + is_colinear + is_colinear_line_line + is_colinear_xy + is_coplanar + is_intersection_line_line + is_intersection_line_line_xy + is_intersection_line_plane + is_intersection_line_triangle + is_intersection_plane_plane + is_intersection_segment_plane + is_intersection_segment_segment + is_intersection_segment_segment_xy + is_point_behind_plane + is_point_infront_plane + is_point_in_circle + is_point_in_circle_xy + is_point_in_convex_polygon_xy + is_point_in_halfspace + is_point_in_polygon_xy + is_point_in_polyhedron + is_point_in_triangle + is_point_in_triangle_xy + is_point_on_line + is_point_on_line_xy + is_point_on_plane + is_point_on_polyline + is_point_on_polyline_xy + is_point_on_segment + is_point_on_segment_xy + is_polygon_convex + is_polygon_convex_xy + is_polygon_in_polygon_xy + + +Transformations +--------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + axis_and_angle_from_matrix + axis_angle_vector_from_matrix + axis_angle_from_quaternion + basis_vectors_from_matrix + compose_matrix + decompose_matrix + dehomogenize_numpy + dehomogenize_and_unflatten_frames_numpy + euler_angles_from_matrix + euler_angles_from_quaternion + homogenize_numpy + homogenize_and_flatten_frames_numpy + identity_matrix + local_axes + local_to_world_coordinates + local_to_world_coordinates_numpy + matrix_determinant + matrix_from_axis_and_angle + matrix_from_axis_angle_vector + matrix_from_basis_vectors + matrix_from_change_of_basis + matrix_from_euler_angles + matrix_from_frame + matrix_from_frame_to_frame + matrix_from_orthogonal_projection + matrix_from_parallel_projection + matrix_from_perspective_entries + matrix_from_perspective_projection + matrix_from_quaternion + matrix_from_scale_factors + matrix_from_shear + matrix_from_shear_entries + matrix_from_translation + matrix_inverse + mirror_point_plane + mirror_points_line + mirror_points_line_xy + mirror_points_plane + mirror_points_point + mirror_points_point_xy + mirror_vector_vector + orient_points + orthonormalize_axes + project_point_line + project_point_line_xy + project_point_plane + project_points_line + project_points_line_xy + project_points_plane + quaternion_canonize + quaternion_conjugate + quaternion_from_axis_angle + quaternion_from_euler_angles + quaternion_from_matrix + quaternion_is_unit + quaternion_multiply + quaternion_norm + quaternion_unitize + reflect_line_plane + reflect_line_triangle + rotate_points + rotate_points_xy + scale_points + scale_points_xy + transform_frames + transform_points + transform_points_numpy + transform_vectors + transform_vectors_numpy + translate_points + translate_points_xy + translation_from_matrix + world_to_local_coordinates + world_to_local_coordinates_numpy + + +Linear algebra +-------------- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + add_vectors + add_vectors_xy + allclose + argmax + argmin + close + cross_vectors + cross_vectors_xy + dehomogenize_vectors + divide_vectors + divide_vectors_xy + dot_vectors + dot_vectors_xy + homogenize_vectors + length_vector + length_vector_xy + length_vector_sqrd + length_vector_sqrd_xy + multiply_matrices + multiply_matrix_vector + multiply_vectors + multiply_vectors_xy + norm_vector + norm_vectors + normalize_vector + normalize_vector_xy + normalize_vectors + normalize_vectors_xy + orthonormalize_vectors + power_vector + power_vectors + scale_vector + scale_vector_xy + scale_vectors + scale_vectors_xy + square_vector + square_vectors + subtract_vectors + subtract_vectors_xy + sum_vectors + transpose_matrix + vector_average + vector_component + vector_component_xy + vector_standard_deviation + vector_variance + + +Misc +---- + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + KDTree + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + archimedean_spiral_evaluate + circle_evaluate + ellipse_evaluate + helix_evaluate + logarithmic_spiral_evaluate + diff --git a/docs/reference/compas.numerical.rst b/docs/reference/compas.numerical.rst new file mode 100644 index 00000000000..1d9053b0711 --- /dev/null +++ b/docs/reference/compas.numerical.rst @@ -0,0 +1,111 @@ +******************************************************************************** +compas.numerical +******************************************************************************** + +.. currentmodule:: compas.numerical + +.. warning:: + + Note that this package will be removed from :mod:`compas`. + Some of the functionality will be moved to :mod:`compas.geometry`. + Specific algorithms will be moved to their own packages. + For example, :mod:`compas.numerical.fd_numpy` will be moved to ``compas_fd``, + and :mod:`compas.numerical.dr_numpy` will be moved to ``compas_dr``. + +.. rst-class:: lead + +This package provides some basic linear algabra functions, +and matrix-based implementations of various geometric and topological algorithms. + +Solvers +======= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + descent_numpy + devo_numpy + dr + dr_numpy + fd_numpy + ga + moga + pca_numpy + topop_numpy + + +Isolines +======== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + scalarfield_contours_numpy + + +Linalg +====== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + nullspace + rank + dof + pivots + nonpivots + rref + rref_sympy + rref_matlab + chofactor + lufactorized + uvw_lengths + normrow + normalizerow + rot90 + solve_with_known + spsolve_with_known + + +Matrices +======== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + adjacency_matrix + connectivity_matrix + degree_matrix + equilibrium_matrix + face_matrix + laplacian_matrix + mass_matrix + stiffness_matrix + + +Operators +========= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + curl + div + grad + + +Utilities +========= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + float_formatter + set_array_print_precision + unset_array_print_precision diff --git a/docs/reference/compas.plugins.rst b/docs/reference/compas.plugins.rst new file mode 100644 index 00000000000..1d2360ae900 --- /dev/null +++ b/docs/reference/compas.plugins.rst @@ -0,0 +1,41 @@ +******************************************************************************** +compas.plugins +******************************************************************************** + +.. currentmodule:: compas.plugins + +.. rst-class:: lead + +COMPAS has an extensible architecture based on plugins that allows to +customize and extend the functionality of the core framework. + +Check out the developer guide to :ref:`plugins` for additional details. + +Decorators +========== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + pluggable + plugin + +Classes +======= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + PluginManager + +Exceptions +========== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + IncompletePluginImplError + PluginNotInstalledError diff --git a/docs/reference/compas.robots.rst b/docs/reference/compas.robots.rst new file mode 100644 index 00000000000..3b8dd2183e6 --- /dev/null +++ b/docs/reference/compas.robots.rst @@ -0,0 +1,101 @@ +******************************************************************************** +compas.robots +******************************************************************************** + +.. currentmodule:: compas.robots + +.. warning:: + + Note that this package will be removed from :mod:`compas` and moved to a separate core extension, ``compas_robots``. + +.. rst-class:: lead + +This package provides classes for describing robots, their components, and their kinematic behaviour. + + +Model +===== + +The root of the model is the :class:`RobotModel` class, which +describes a robot consisting of a set of link elements, and a set of joint +elements connecting the links together. + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + RobotModel + Joint + Link + ToolModel + Configuration + + +Geometric description +===================== + +The robot itself as well as its links can be geometrically described +using the following classes. + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Geometry + MeshDescriptor + Material + Texture + Color + + +Link +==== + +The link is described as a rigid body with inertial, visual and collision values. + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Visual + Collision + Inertial + Mass + Inertia + + +Joint +===== + +The joint describes the kinematics and dynamics of the robot's joint. + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + ParentLink + ChildLink + Calibration + Dynamics + Limit + Axis + Mimic + SafetyController + + +Resources +========= + +Model descriptions usually do not contain embedded geometry information but only +descriptions, filenames or URLs for externally hosted resources. +For that purpose, this package provides various loader classes that help automate +the processing of these resources. + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + AbstractMeshLoader + DefaultMeshLoader + GithubPackageMeshLoader + LocalPackageMeshLoader diff --git a/docs/reference/compas.rpc.rst b/docs/reference/compas.rpc.rst new file mode 100644 index 00000000000..048635479e2 --- /dev/null +++ b/docs/reference/compas.rpc.rst @@ -0,0 +1,38 @@ +******************************************************************************** +compas.rpc +******************************************************************************** + +.. currentmodule:: compas.rpc + +.. rst-class:: lead + +COMPAS runs in many different environments, but in some environments the availablity of libraries is limited. +For example, when running COMPAS in an IronPython-based environment like Rhino/Grasshopper, +plenty of CPython libraries such as `numpy` and `scipy` are not available. +To workaround this limitation, COMPAS provides a mechanisms to access the +functionality of a CPython environment seemlessly from any other Python environment +through a "Remote Procedure Call" or RPC. + + +Classes +======= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + Dispatcher + Proxy + Server + + +Exceptions +========== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + RPCClientError + RPCServerError + diff --git a/docs/reference/compas.rst b/docs/reference/compas.rst new file mode 100644 index 00000000000..19a672197a4 --- /dev/null +++ b/docs/reference/compas.rst @@ -0,0 +1,34 @@ +******************************************************************************** +compas +******************************************************************************** + +.. currentmodule:: compas + +.. rst-class:: lead + +This package is the core package of the COMPAS framework. +It defines all functionality for geometry processing, +data structures, topology, numerical methods, robotics, the plugin mechanism, remote procedure calls ... +and can be used independently of CAD systems in any environment that supports Python programming. + +Modules +======= + +.. toctree:: + :maxdepth: 1 + :titlesonly: + + compas.artists + compas.colors + compas.data + compas.datastructures + compas.files + compas.geometry + compas.numerical + compas.plugins + compas.robots + compas.rpc + compas.topology + compas.utilities + + diff --git a/docs/reference/compas.topology.rst b/docs/reference/compas.topology.rst new file mode 100644 index 00000000000..822e133585a --- /dev/null +++ b/docs/reference/compas.topology.rst @@ -0,0 +1,61 @@ +******************************************************************************** +compas.topology +******************************************************************************** + +.. currentmodule:: compas.topology + +.. rst-class:: lead + +Package containing topological algorithms for traversal, connectivity, combinatorics, etc. + +Connectivity +============ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + adjacency_from_edges + + +Combinatorics +============= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + vertex_coloring + connected_components + + +Orientation +=========== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + face_adjacency + face_adjacency_numpy + unify_cycles + unify_cycles_numpy + + +Traversal +========= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + astar_lightest_path + astar_shortest_path + breadth_first_ordering + breadth_first_traverse + breadth_first_paths + depth_first_ordering + dijkstra_distances + dijkstra_path + shortest_path + diff --git a/docs/reference/compas.utilities.rst b/docs/reference/compas.utilities.rst new file mode 100644 index 00000000000..b5f5604bbfd --- /dev/null +++ b/docs/reference/compas.utilities.rst @@ -0,0 +1,69 @@ +******************************************************************************** +compas.utilities +******************************************************************************** + +.. currentmodule:: compas.utilities + +.. rst-class:: lead + +This package collects miscellaneous functionality with the common characteristic +that it simply did not really fit anywhere else. + + +async +===== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + await_callback + + +colors +====== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + i_to_rgb + i_to_red + i_to_green + i_to_blue + i_to_white + i_to_black + rgb_to_hex + color_to_colordict + color_to_rgb + + +itertools +========= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + flatten + linspace + meshgrid + pairwise + window + iterable_like + normalize_values + remap_values + + +maps +==== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + geometric_key + reverse_geometric_key + geometric_key_xy + + diff --git a/docs/reference/compas_blender.artists.rst b/docs/reference/compas_blender.artists.rst new file mode 100644 index 00000000000..c61b9467355 --- /dev/null +++ b/docs/reference/compas_blender.artists.rst @@ -0,0 +1,84 @@ +******************************************************************************** +compas_blender.artists +******************************************************************************** + +.. currentmodule:: compas_blender.artists + +.. rst-class:: lead + +Artists for visualizing (painting) COMPAS geometry, robots, and data structures in Blender. +The artists in this package provide plugins for the pluggable methods of the base artists defined in :mod:`compas.artists`. +They can be used directly from here (:mod:`compas_blender.artists`), or through the base artist :class:`~compas.artists.Artist`. + + +Primitive Artists +================= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + CircleArtist + FrameArtist + LineArtist + PointArtist + PolygonArtist + PolylineArtist + VectorArtist + + +Shape Artists +============= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + BoxArtist + CapsuleArtist + ConeArtist + CylinderArtist + PolyhedronArtist + SphereArtist + + +Curve and Surface Artists +========================= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + CurveArtist + SurfaceArtist + + +Datastructure Artists +===================== + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + MeshArtist + NetworkArtist + + +Robot Artist +============ + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + RobotModelArtist + + +Base Classes +============ + +.. autosummary:: + :toctree: generated/ + + BlenderArtist + diff --git a/docs/reference/compas_blender.conversions.rst b/docs/reference/compas_blender.conversions.rst new file mode 100644 index 00000000000..7b1bc8cf144 --- /dev/null +++ b/docs/reference/compas_blender.conversions.rst @@ -0,0 +1,20 @@ +******************************************************************************** +compas_blender.conversions +******************************************************************************** + +.. currentmodule:: compas_blender.conversions + +.. rst-class:: lead + +This package provides classes for converting between COMPAS geometry and Blender geometry. + +Classes +======= + +.. autosummary:: + :toctree: generated/ + :nosignatures: + + BlenderGeometry + BlenderCurve + BlenderMesh diff --git a/docs/reference/compas_blender.geometry.rst b/docs/reference/compas_blender.geometry.rst new file mode 100644 index 00000000000..581890b4cd7 --- /dev/null +++ b/docs/reference/compas_blender.geometry.rst @@ -0,0 +1,5 @@ +******************************************************************************** +compas_blender.geometry +******************************************************************************** + +.. currentmodule:: compas_blender.geometry diff --git a/docs/reference/compas_blender.rst b/docs/reference/compas_blender.rst new file mode 100644 index 00000000000..9c50acd14ff --- /dev/null +++ b/docs/reference/compas_blender.rst @@ -0,0 +1,25 @@ +******************************************************************************** +compas_blender +******************************************************************************** + +.. currentmodule:: compas_blender + +.. rst-class:: lead + +This package provides functionality for reading and writing Blender geometry, for visualising +COMPAS geometry and data structures in Blender, and for basic user inter interaction. + +Modules +======= + +.. toctree:: + :maxdepth: 1 + :titlesonly: + + compas_blender.artists + compas_blender.conversions + compas_blender.geometry + compas_blender.ui + compas_blender.utilities + + diff --git a/docs/reference/compas_blender.ui.rst b/docs/reference/compas_blender.ui.rst new file mode 100644 index 00000000000..ca4b5bc72ce --- /dev/null +++ b/docs/reference/compas_blender.ui.rst @@ -0,0 +1,5 @@ +******************************************************************************** +compas_blender.ui +******************************************************************************** + +.. currentmodule:: compas_blender.ui diff --git a/docs/reference/compas_blender.utilities.rst b/docs/reference/compas_blender.utilities.rst new file mode 100644 index 00000000000..5863d52ffaf --- /dev/null +++ b/docs/reference/compas_blender.utilities.rst @@ -0,0 +1,5 @@ +******************************************************************************** +compas_blender.utilities +******************************************************************************** + +.. currentmodule:: compas_blender.utilities diff --git a/docs/reference/compas_ghpython.rst b/docs/reference/compas_ghpython.rst new file mode 100644 index 00000000000..67292ae15c2 --- /dev/null +++ b/docs/reference/compas_ghpython.rst @@ -0,0 +1,20 @@ +******************************************************************************** +compas_ghpython +******************************************************************************** + +.. currentmodule:: compas_ghpython + +.. rst-class:: lead + +This package provides functionality for reading and writing Rhino geometry, and for visualising +COMPAS geometry and data structures in Rhino, through GHPython. + +.. .. toctree:: +.. :maxdepth: 1 +.. :titlesonly: + +.. compas_ghpython.artists +.. compas_ghpython.components +.. compas_ghpython.utilities + + diff --git a/docs/reference/compas_rhino.rst b/docs/reference/compas_rhino.rst new file mode 100644 index 00000000000..d121eca8e43 --- /dev/null +++ b/docs/reference/compas_rhino.rst @@ -0,0 +1,23 @@ +******************************************************************************** +compas_rhino +******************************************************************************** + +.. currentmodule:: compas_rhino + +.. rst-class:: lead + +This package provides functionality for reading and writing Rhino geometry, for visualising +COMPAS geometry and data structures in Rhino, and for basic user inter interaction. + +.. .. toctree:: +.. :maxdepth: 1 +.. :titlesonly: + +.. compas_rhino.artists +.. compas_rhino.conduits +.. compas_rhino.conversions +.. compas_rhino.forms +.. compas_rhino.geometry +.. compas_rhino.utilities + + diff --git a/docs/reference/generated/compas.artists.Artist.build.rst b/docs/reference/generated/compas.artists.Artist.build.rst new file mode 100644 index 00000000000..add4b4af938 --- /dev/null +++ b/docs/reference/generated/compas.artists.Artist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Artist.build +=========================== + +.. currentmodule:: compas.artists + +.. automethod:: Artist.build \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.Artist.build_as.rst b/docs/reference/generated/compas.artists.Artist.build_as.rst new file mode 100644 index 00000000000..75fa4aac35b --- /dev/null +++ b/docs/reference/generated/compas.artists.Artist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Artist.build_as +============================== + +.. currentmodule:: compas.artists + +.. automethod:: Artist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.Artist.clear.rst b/docs/reference/generated/compas.artists.Artist.clear.rst new file mode 100644 index 00000000000..4688c446f65 --- /dev/null +++ b/docs/reference/generated/compas.artists.Artist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Artist.clear +=========================== + +.. currentmodule:: compas.artists + +.. automethod:: Artist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.Artist.draw.rst b/docs/reference/generated/compas.artists.Artist.draw.rst new file mode 100644 index 00000000000..9cd6ce36763 --- /dev/null +++ b/docs/reference/generated/compas.artists.Artist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Artist.draw +========================== + +.. currentmodule:: compas.artists + +.. automethod:: Artist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.Artist.draw_collection.rst b/docs/reference/generated/compas.artists.Artist.draw_collection.rst new file mode 100644 index 00000000000..a5b913004b0 --- /dev/null +++ b/docs/reference/generated/compas.artists.Artist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Artist.draw_collection +===================================== + +.. currentmodule:: compas.artists + +.. automethod:: Artist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.Artist.redraw.rst b/docs/reference/generated/compas.artists.Artist.redraw.rst new file mode 100644 index 00000000000..2414ae5c91c --- /dev/null +++ b/docs/reference/generated/compas.artists.Artist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Artist.redraw +============================ + +.. currentmodule:: compas.artists + +.. automethod:: Artist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.Artist.register.rst b/docs/reference/generated/compas.artists.Artist.register.rst new file mode 100644 index 00000000000..dfce0e1f0d5 --- /dev/null +++ b/docs/reference/generated/compas.artists.Artist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Artist.register +============================== + +.. currentmodule:: compas.artists + +.. automethod:: Artist.register \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.Artist.rst b/docs/reference/generated/compas.artists.Artist.rst new file mode 100644 index 00000000000..e7c02159e52 --- /dev/null +++ b/docs/reference/generated/compas.artists.Artist.rst @@ -0,0 +1,60 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Artist +====== + +.. currentmodule:: compas.artists + +.. autoclass:: Artist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~Artist.build + ~Artist.build_as + ~Artist.clear + ~Artist.draw + ~Artist.draw_collection + ~Artist.redraw + ~Artist.register + + + + \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.CurveArtist.build.rst b/docs/reference/generated/compas.artists.CurveArtist.build.rst new file mode 100644 index 00000000000..5b456d890e6 --- /dev/null +++ b/docs/reference/generated/compas.artists.CurveArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.build +================================ + +.. currentmodule:: compas.artists + +.. automethod:: CurveArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.CurveArtist.build_as.rst b/docs/reference/generated/compas.artists.CurveArtist.build_as.rst new file mode 100644 index 00000000000..76930ae0a88 --- /dev/null +++ b/docs/reference/generated/compas.artists.CurveArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.build_as +=================================== + +.. currentmodule:: compas.artists + +.. automethod:: CurveArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.CurveArtist.clear.rst b/docs/reference/generated/compas.artists.CurveArtist.clear.rst new file mode 100644 index 00000000000..f85c7dc10ba --- /dev/null +++ b/docs/reference/generated/compas.artists.CurveArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.clear +================================ + +.. currentmodule:: compas.artists + +.. automethod:: CurveArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.CurveArtist.draw.rst b/docs/reference/generated/compas.artists.CurveArtist.draw.rst new file mode 100644 index 00000000000..ca3f7b8bc93 --- /dev/null +++ b/docs/reference/generated/compas.artists.CurveArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.draw +=============================== + +.. currentmodule:: compas.artists + +.. automethod:: CurveArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.CurveArtist.draw_collection.rst b/docs/reference/generated/compas.artists.CurveArtist.draw_collection.rst new file mode 100644 index 00000000000..8405bd9adaa --- /dev/null +++ b/docs/reference/generated/compas.artists.CurveArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.draw_collection +========================================== + +.. currentmodule:: compas.artists + +.. automethod:: CurveArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.CurveArtist.redraw.rst b/docs/reference/generated/compas.artists.CurveArtist.redraw.rst new file mode 100644 index 00000000000..124902372a3 --- /dev/null +++ b/docs/reference/generated/compas.artists.CurveArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.redraw +================================= + +.. currentmodule:: compas.artists + +.. automethod:: CurveArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.CurveArtist.register.rst b/docs/reference/generated/compas.artists.CurveArtist.register.rst new file mode 100644 index 00000000000..88bc45a78dc --- /dev/null +++ b/docs/reference/generated/compas.artists.CurveArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.register +=================================== + +.. currentmodule:: compas.artists + +.. automethod:: CurveArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.CurveArtist.rst b/docs/reference/generated/compas.artists.CurveArtist.rst new file mode 100644 index 00000000000..4ddd9910324 --- /dev/null +++ b/docs/reference/generated/compas.artists.CurveArtist.rst @@ -0,0 +1,60 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CurveArtist +=========== + +.. currentmodule:: compas.artists + +.. autoclass:: CurveArtist + + + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~CurveArtist.build + ~CurveArtist.build_as + ~CurveArtist.clear + ~CurveArtist.draw + ~CurveArtist.draw_collection + ~CurveArtist.redraw + ~CurveArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.DataArtistNotRegistered.rst b/docs/reference/generated/compas.artists.DataArtistNotRegistered.rst new file mode 100644 index 00000000000..7a999d77846 --- /dev/null +++ b/docs/reference/generated/compas.artists.DataArtistNotRegistered.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +DataArtistNotRegistered +====================================== + +.. currentmodule:: compas.artists + +.. autoexception:: DataArtistNotRegistered \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.build.rst b/docs/reference/generated/compas.artists.MeshArtist.build.rst new file mode 100644 index 00000000000..7d43294c235 --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.build +=============================== + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.build_as.rst b/docs/reference/generated/compas.artists.MeshArtist.build_as.rst new file mode 100644 index 00000000000..66c79c979c0 --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.build_as +================================== + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.clear.rst b/docs/reference/generated/compas.artists.MeshArtist.clear.rst new file mode 100644 index 00000000000..52af5ec7e2a --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.clear +=============================== + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.clear_edges.rst b/docs/reference/generated/compas.artists.MeshArtist.clear_edges.rst new file mode 100644 index 00000000000..f4fd9e094c4 --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.clear_edges.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.clear_edges +===================================== + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.clear_edges \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.clear_faces.rst b/docs/reference/generated/compas.artists.MeshArtist.clear_faces.rst new file mode 100644 index 00000000000..2bc1ab0d707 --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.clear_faces.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.clear_faces +===================================== + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.clear_faces \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.clear_vertices.rst b/docs/reference/generated/compas.artists.MeshArtist.clear_vertices.rst new file mode 100644 index 00000000000..aaf27c8d2ae --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.clear_vertices.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.clear_vertices +======================================== + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.clear_vertices \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.draw.rst b/docs/reference/generated/compas.artists.MeshArtist.draw.rst new file mode 100644 index 00000000000..5f09682c32d --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw +============================== + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.draw_collection.rst b/docs/reference/generated/compas.artists.MeshArtist.draw_collection.rst new file mode 100644 index 00000000000..d89c712d331 --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_collection +========================================= + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.draw_edges.rst b/docs/reference/generated/compas.artists.MeshArtist.draw_edges.rst new file mode 100644 index 00000000000..0ffe597eff5 --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.draw_edges.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_edges +==================================== + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.draw_edges \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.draw_faces.rst b/docs/reference/generated/compas.artists.MeshArtist.draw_faces.rst new file mode 100644 index 00000000000..361a33de1ad --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.draw_faces.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_faces +==================================== + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.draw_faces \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.draw_mesh.rst b/docs/reference/generated/compas.artists.MeshArtist.draw_mesh.rst new file mode 100644 index 00000000000..7a33d942816 --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.draw_mesh.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_mesh +=================================== + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.draw_mesh \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.draw_vertices.rst b/docs/reference/generated/compas.artists.MeshArtist.draw_vertices.rst new file mode 100644 index 00000000000..71b93900eaf --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.draw_vertices.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_vertices +======================================= + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.draw_vertices \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.redraw.rst b/docs/reference/generated/compas.artists.MeshArtist.redraw.rst new file mode 100644 index 00000000000..dcdcc0f78b3 --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.redraw +================================ + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.register.rst b/docs/reference/generated/compas.artists.MeshArtist.register.rst new file mode 100644 index 00000000000..f1ea6ad7ffc --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.register +================================== + +.. currentmodule:: compas.artists + +.. automethod:: MeshArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.MeshArtist.rst b/docs/reference/generated/compas.artists.MeshArtist.rst new file mode 100644 index 00000000000..b7c71804df7 --- /dev/null +++ b/docs/reference/generated/compas.artists.MeshArtist.rst @@ -0,0 +1,102 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +MeshArtist +========== + +.. currentmodule:: compas.artists + +.. autoclass:: MeshArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~MeshArtist.clear + ~MeshArtist.clear_edges + ~MeshArtist.clear_faces + ~MeshArtist.clear_vertices + ~MeshArtist.draw_edges + ~MeshArtist.draw_faces + ~MeshArtist.draw_mesh + ~MeshArtist.draw_vertices + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~MeshArtist.build + ~MeshArtist.build_as + ~MeshArtist.draw + ~MeshArtist.draw_collection + ~MeshArtist.redraw + ~MeshArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.NetworkArtist.build.rst b/docs/reference/generated/compas.artists.NetworkArtist.build.rst new file mode 100644 index 00000000000..9faa1f9cde7 --- /dev/null +++ b/docs/reference/generated/compas.artists.NetworkArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.build +================================== + +.. currentmodule:: compas.artists + +.. automethod:: NetworkArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.NetworkArtist.build_as.rst b/docs/reference/generated/compas.artists.NetworkArtist.build_as.rst new file mode 100644 index 00000000000..4b75288144c --- /dev/null +++ b/docs/reference/generated/compas.artists.NetworkArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.build_as +===================================== + +.. currentmodule:: compas.artists + +.. automethod:: NetworkArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.NetworkArtist.clear.rst b/docs/reference/generated/compas.artists.NetworkArtist.clear.rst new file mode 100644 index 00000000000..d35ca48c74a --- /dev/null +++ b/docs/reference/generated/compas.artists.NetworkArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.clear +================================== + +.. currentmodule:: compas.artists + +.. automethod:: NetworkArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.NetworkArtist.clear_edges.rst b/docs/reference/generated/compas.artists.NetworkArtist.clear_edges.rst new file mode 100644 index 00000000000..2750531a57f --- /dev/null +++ b/docs/reference/generated/compas.artists.NetworkArtist.clear_edges.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.clear_edges +======================================== + +.. currentmodule:: compas.artists + +.. automethod:: NetworkArtist.clear_edges \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.NetworkArtist.clear_nodes.rst b/docs/reference/generated/compas.artists.NetworkArtist.clear_nodes.rst new file mode 100644 index 00000000000..a3843728259 --- /dev/null +++ b/docs/reference/generated/compas.artists.NetworkArtist.clear_nodes.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.clear_nodes +======================================== + +.. currentmodule:: compas.artists + +.. automethod:: NetworkArtist.clear_nodes \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.NetworkArtist.draw.rst b/docs/reference/generated/compas.artists.NetworkArtist.draw.rst new file mode 100644 index 00000000000..84464f36ce4 --- /dev/null +++ b/docs/reference/generated/compas.artists.NetworkArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.draw +================================= + +.. currentmodule:: compas.artists + +.. automethod:: NetworkArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.NetworkArtist.draw_collection.rst b/docs/reference/generated/compas.artists.NetworkArtist.draw_collection.rst new file mode 100644 index 00000000000..e67ba20ad9d --- /dev/null +++ b/docs/reference/generated/compas.artists.NetworkArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.draw_collection +============================================ + +.. currentmodule:: compas.artists + +.. automethod:: NetworkArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.NetworkArtist.draw_edges.rst b/docs/reference/generated/compas.artists.NetworkArtist.draw_edges.rst new file mode 100644 index 00000000000..ba1982356a8 --- /dev/null +++ b/docs/reference/generated/compas.artists.NetworkArtist.draw_edges.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.draw_edges +======================================= + +.. currentmodule:: compas.artists + +.. automethod:: NetworkArtist.draw_edges \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.NetworkArtist.draw_nodes.rst b/docs/reference/generated/compas.artists.NetworkArtist.draw_nodes.rst new file mode 100644 index 00000000000..4d5eb03a0f6 --- /dev/null +++ b/docs/reference/generated/compas.artists.NetworkArtist.draw_nodes.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.draw_nodes +======================================= + +.. currentmodule:: compas.artists + +.. automethod:: NetworkArtist.draw_nodes \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.NetworkArtist.redraw.rst b/docs/reference/generated/compas.artists.NetworkArtist.redraw.rst new file mode 100644 index 00000000000..787b1b5e759 --- /dev/null +++ b/docs/reference/generated/compas.artists.NetworkArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.redraw +=================================== + +.. currentmodule:: compas.artists + +.. automethod:: NetworkArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.NetworkArtist.register.rst b/docs/reference/generated/compas.artists.NetworkArtist.register.rst new file mode 100644 index 00000000000..e1e86f1fbfa --- /dev/null +++ b/docs/reference/generated/compas.artists.NetworkArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.register +===================================== + +.. currentmodule:: compas.artists + +.. automethod:: NetworkArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.NetworkArtist.rst b/docs/reference/generated/compas.artists.NetworkArtist.rst new file mode 100644 index 00000000000..13a9f0addb6 --- /dev/null +++ b/docs/reference/generated/compas.artists.NetworkArtist.rst @@ -0,0 +1,87 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +NetworkArtist +============= + +.. currentmodule:: compas.artists + +.. autoclass:: NetworkArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~NetworkArtist.clear + ~NetworkArtist.clear_edges + ~NetworkArtist.clear_nodes + ~NetworkArtist.draw_edges + ~NetworkArtist.draw_nodes + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~NetworkArtist.build + ~NetworkArtist.build_as + ~NetworkArtist.draw + ~NetworkArtist.draw_collection + ~NetworkArtist.redraw + ~NetworkArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.NoArtistContextError.rst b/docs/reference/generated/compas.artists.NoArtistContextError.rst new file mode 100644 index 00000000000..e95b6b3c57e --- /dev/null +++ b/docs/reference/generated/compas.artists.NoArtistContextError.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NoArtistContextError +=================================== + +.. currentmodule:: compas.artists + +.. autoexception:: NoArtistContextError \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.PrimitiveArtist.build.rst b/docs/reference/generated/compas.artists.PrimitiveArtist.build.rst new file mode 100644 index 00000000000..b3849c3866c --- /dev/null +++ b/docs/reference/generated/compas.artists.PrimitiveArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PrimitiveArtist.build +==================================== + +.. currentmodule:: compas.artists + +.. automethod:: PrimitiveArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.PrimitiveArtist.build_as.rst b/docs/reference/generated/compas.artists.PrimitiveArtist.build_as.rst new file mode 100644 index 00000000000..59ec5814954 --- /dev/null +++ b/docs/reference/generated/compas.artists.PrimitiveArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PrimitiveArtist.build_as +======================================= + +.. currentmodule:: compas.artists + +.. automethod:: PrimitiveArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.PrimitiveArtist.clear.rst b/docs/reference/generated/compas.artists.PrimitiveArtist.clear.rst new file mode 100644 index 00000000000..bfdad53a4bc --- /dev/null +++ b/docs/reference/generated/compas.artists.PrimitiveArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PrimitiveArtist.clear +==================================== + +.. currentmodule:: compas.artists + +.. automethod:: PrimitiveArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.PrimitiveArtist.draw.rst b/docs/reference/generated/compas.artists.PrimitiveArtist.draw.rst new file mode 100644 index 00000000000..5beb430b4d6 --- /dev/null +++ b/docs/reference/generated/compas.artists.PrimitiveArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PrimitiveArtist.draw +=================================== + +.. currentmodule:: compas.artists + +.. automethod:: PrimitiveArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.PrimitiveArtist.draw_collection.rst b/docs/reference/generated/compas.artists.PrimitiveArtist.draw_collection.rst new file mode 100644 index 00000000000..deed4259e53 --- /dev/null +++ b/docs/reference/generated/compas.artists.PrimitiveArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PrimitiveArtist.draw_collection +============================================== + +.. currentmodule:: compas.artists + +.. automethod:: PrimitiveArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.PrimitiveArtist.redraw.rst b/docs/reference/generated/compas.artists.PrimitiveArtist.redraw.rst new file mode 100644 index 00000000000..b9da99f49fe --- /dev/null +++ b/docs/reference/generated/compas.artists.PrimitiveArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PrimitiveArtist.redraw +===================================== + +.. currentmodule:: compas.artists + +.. automethod:: PrimitiveArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.PrimitiveArtist.register.rst b/docs/reference/generated/compas.artists.PrimitiveArtist.register.rst new file mode 100644 index 00000000000..cb9fb9347c1 --- /dev/null +++ b/docs/reference/generated/compas.artists.PrimitiveArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PrimitiveArtist.register +======================================= + +.. currentmodule:: compas.artists + +.. automethod:: PrimitiveArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.PrimitiveArtist.rst b/docs/reference/generated/compas.artists.PrimitiveArtist.rst new file mode 100644 index 00000000000..a34b8822207 --- /dev/null +++ b/docs/reference/generated/compas.artists.PrimitiveArtist.rst @@ -0,0 +1,60 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +PrimitiveArtist +=============== + +.. currentmodule:: compas.artists + +.. autoclass:: PrimitiveArtist + + + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~PrimitiveArtist.build + ~PrimitiveArtist.build_as + ~PrimitiveArtist.clear + ~PrimitiveArtist.draw + ~PrimitiveArtist.draw_collection + ~PrimitiveArtist.redraw + ~PrimitiveArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.attach_mesh.rst b/docs/reference/generated/compas.artists.RobotModelArtist.attach_mesh.rst new file mode 100644 index 00000000000..05fde5d9689 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.attach_mesh.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.attach_mesh +=========================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.attach_mesh \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.attach_tool_model.rst b/docs/reference/generated/compas.artists.RobotModelArtist.attach_tool_model.rst new file mode 100644 index 00000000000..dbaf61eba8c --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.attach_tool_model.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.attach_tool_model +================================================= + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.attach_tool_model \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.build.rst b/docs/reference/generated/compas.artists.RobotModelArtist.build.rst new file mode 100644 index 00000000000..3e0adccd326 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.build +===================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.build_as.rst b/docs/reference/generated/compas.artists.RobotModelArtist.build_as.rst new file mode 100644 index 00000000000..e422947db5b --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.build_as +======================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.clear.rst b/docs/reference/generated/compas.artists.RobotModelArtist.clear.rst new file mode 100644 index 00000000000..92c458dd983 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.clear +===================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.create.rst b/docs/reference/generated/compas.artists.RobotModelArtist.create.rst new file mode 100644 index 00000000000..132245ab9ff --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.create.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.create +====================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.create \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.create_geometry.rst b/docs/reference/generated/compas.artists.RobotModelArtist.create_geometry.rst new file mode 100644 index 00000000000..819ffe7dc49 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.create_geometry.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.create_geometry +=============================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.create_geometry \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.detach_mesh.rst b/docs/reference/generated/compas.artists.RobotModelArtist.detach_mesh.rst new file mode 100644 index 00000000000..d92987d9e64 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.detach_mesh.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.detach_mesh +=========================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.detach_mesh \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.detach_tool_model.rst b/docs/reference/generated/compas.artists.RobotModelArtist.detach_tool_model.rst new file mode 100644 index 00000000000..9e629e7ae8e --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.detach_tool_model.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.detach_tool_model +================================================= + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.detach_tool_model \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.draw.rst b/docs/reference/generated/compas.artists.RobotModelArtist.draw.rst new file mode 100644 index 00000000000..a189b38d941 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.draw +==================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.draw_attached_meshes.rst b/docs/reference/generated/compas.artists.RobotModelArtist.draw_attached_meshes.rst new file mode 100644 index 00000000000..cd0c9a509c8 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.draw_attached_meshes.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.draw_attached_meshes +==================================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.draw_attached_meshes \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.draw_collection.rst b/docs/reference/generated/compas.artists.RobotModelArtist.draw_collection.rst new file mode 100644 index 00000000000..5347ec730f3 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.draw_collection +=============================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.draw_collision.rst b/docs/reference/generated/compas.artists.RobotModelArtist.draw_collision.rst new file mode 100644 index 00000000000..fe4ea4db403 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.draw_collision.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.draw_collision +============================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.draw_collision \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.draw_visual.rst b/docs/reference/generated/compas.artists.RobotModelArtist.draw_visual.rst new file mode 100644 index 00000000000..e85c1286795 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.draw_visual.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.draw_visual +=========================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.draw_visual \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.meshes.rst b/docs/reference/generated/compas.artists.RobotModelArtist.meshes.rst new file mode 100644 index 00000000000..cc021150b0d --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.meshes.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.meshes +====================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.meshes \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.redraw.rst b/docs/reference/generated/compas.artists.RobotModelArtist.redraw.rst new file mode 100644 index 00000000000..8789db0cae7 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.redraw +====================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.register.rst b/docs/reference/generated/compas.artists.RobotModelArtist.register.rst new file mode 100644 index 00000000000..fa94bc0a1c1 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.register +======================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.rst b/docs/reference/generated/compas.artists.RobotModelArtist.rst new file mode 100644 index 00000000000..a9e9dc58cd1 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.rst @@ -0,0 +1,142 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +RobotModelArtist +================ + +.. currentmodule:: compas.artists + +.. autoclass:: RobotModelArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~RobotModelArtist.attach_mesh + ~RobotModelArtist.attach_tool_model + ~RobotModelArtist.create + ~RobotModelArtist.detach_mesh + ~RobotModelArtist.detach_tool_model + ~RobotModelArtist.draw_attached_meshes + ~RobotModelArtist.draw_collision + ~RobotModelArtist.draw_visual + ~RobotModelArtist.meshes + ~RobotModelArtist.scale + ~RobotModelArtist.scale_link + ~RobotModelArtist.update + ~RobotModelArtist.update_tool + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~RobotModelArtist.build + ~RobotModelArtist.build_as + ~RobotModelArtist.clear + ~RobotModelArtist.create_geometry + ~RobotModelArtist.draw + ~RobotModelArtist.draw_collection + ~RobotModelArtist.redraw + ~RobotModelArtist.register + ~RobotModelArtist.transform + + \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.scale.rst b/docs/reference/generated/compas.artists.RobotModelArtist.scale.rst new file mode 100644 index 00000000000..24d333b2b1f --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.scale.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.scale +===================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.scale \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.scale_link.rst b/docs/reference/generated/compas.artists.RobotModelArtist.scale_link.rst new file mode 100644 index 00000000000..67dedfa130a --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.scale_link.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.scale_link +========================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.scale_link \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.transform.rst b/docs/reference/generated/compas.artists.RobotModelArtist.transform.rst new file mode 100644 index 00000000000..969a07a433b --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.transform.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.transform +========================================= + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.transform \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.update.rst b/docs/reference/generated/compas.artists.RobotModelArtist.update.rst new file mode 100644 index 00000000000..2243a4c4766 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.update.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.update +====================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.update \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.RobotModelArtist.update_tool.rst b/docs/reference/generated/compas.artists.RobotModelArtist.update_tool.rst new file mode 100644 index 00000000000..75fc1fc7a14 --- /dev/null +++ b/docs/reference/generated/compas.artists.RobotModelArtist.update_tool.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.update_tool +=========================================== + +.. currentmodule:: compas.artists + +.. automethod:: RobotModelArtist.update_tool \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.ShapeArtist.build.rst b/docs/reference/generated/compas.artists.ShapeArtist.build.rst new file mode 100644 index 00000000000..48c9a31d322 --- /dev/null +++ b/docs/reference/generated/compas.artists.ShapeArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ShapeArtist.build +================================ + +.. currentmodule:: compas.artists + +.. automethod:: ShapeArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.ShapeArtist.build_as.rst b/docs/reference/generated/compas.artists.ShapeArtist.build_as.rst new file mode 100644 index 00000000000..e645bb6c31f --- /dev/null +++ b/docs/reference/generated/compas.artists.ShapeArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ShapeArtist.build_as +=================================== + +.. currentmodule:: compas.artists + +.. automethod:: ShapeArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.ShapeArtist.clear.rst b/docs/reference/generated/compas.artists.ShapeArtist.clear.rst new file mode 100644 index 00000000000..7a863fa1a60 --- /dev/null +++ b/docs/reference/generated/compas.artists.ShapeArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ShapeArtist.clear +================================ + +.. currentmodule:: compas.artists + +.. automethod:: ShapeArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.ShapeArtist.draw.rst b/docs/reference/generated/compas.artists.ShapeArtist.draw.rst new file mode 100644 index 00000000000..070b68bd151 --- /dev/null +++ b/docs/reference/generated/compas.artists.ShapeArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ShapeArtist.draw +=============================== + +.. currentmodule:: compas.artists + +.. automethod:: ShapeArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.ShapeArtist.draw_collection.rst b/docs/reference/generated/compas.artists.ShapeArtist.draw_collection.rst new file mode 100644 index 00000000000..8d49b2cd906 --- /dev/null +++ b/docs/reference/generated/compas.artists.ShapeArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ShapeArtist.draw_collection +========================================== + +.. currentmodule:: compas.artists + +.. automethod:: ShapeArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.ShapeArtist.redraw.rst b/docs/reference/generated/compas.artists.ShapeArtist.redraw.rst new file mode 100644 index 00000000000..ed7091205da --- /dev/null +++ b/docs/reference/generated/compas.artists.ShapeArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ShapeArtist.redraw +================================= + +.. currentmodule:: compas.artists + +.. automethod:: ShapeArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.ShapeArtist.register.rst b/docs/reference/generated/compas.artists.ShapeArtist.register.rst new file mode 100644 index 00000000000..9e05b493614 --- /dev/null +++ b/docs/reference/generated/compas.artists.ShapeArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ShapeArtist.register +=================================== + +.. currentmodule:: compas.artists + +.. automethod:: ShapeArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.ShapeArtist.rst b/docs/reference/generated/compas.artists.ShapeArtist.rst new file mode 100644 index 00000000000..c333cfd2566 --- /dev/null +++ b/docs/reference/generated/compas.artists.ShapeArtist.rst @@ -0,0 +1,60 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ShapeArtist +=========== + +.. currentmodule:: compas.artists + +.. autoclass:: ShapeArtist + + + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~ShapeArtist.build + ~ShapeArtist.build_as + ~ShapeArtist.clear + ~ShapeArtist.draw + ~ShapeArtist.draw_collection + ~ShapeArtist.redraw + ~ShapeArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.SurfaceArtist.build.rst b/docs/reference/generated/compas.artists.SurfaceArtist.build.rst new file mode 100644 index 00000000000..0dbc2f72f93 --- /dev/null +++ b/docs/reference/generated/compas.artists.SurfaceArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.build +================================== + +.. currentmodule:: compas.artists + +.. automethod:: SurfaceArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.SurfaceArtist.build_as.rst b/docs/reference/generated/compas.artists.SurfaceArtist.build_as.rst new file mode 100644 index 00000000000..d2e61c02ad8 --- /dev/null +++ b/docs/reference/generated/compas.artists.SurfaceArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.build_as +===================================== + +.. currentmodule:: compas.artists + +.. automethod:: SurfaceArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.SurfaceArtist.clear.rst b/docs/reference/generated/compas.artists.SurfaceArtist.clear.rst new file mode 100644 index 00000000000..6e55e15f694 --- /dev/null +++ b/docs/reference/generated/compas.artists.SurfaceArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.clear +================================== + +.. currentmodule:: compas.artists + +.. automethod:: SurfaceArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.SurfaceArtist.draw.rst b/docs/reference/generated/compas.artists.SurfaceArtist.draw.rst new file mode 100644 index 00000000000..74132998ae7 --- /dev/null +++ b/docs/reference/generated/compas.artists.SurfaceArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.draw +================================= + +.. currentmodule:: compas.artists + +.. automethod:: SurfaceArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.SurfaceArtist.draw_collection.rst b/docs/reference/generated/compas.artists.SurfaceArtist.draw_collection.rst new file mode 100644 index 00000000000..49072f6d06b --- /dev/null +++ b/docs/reference/generated/compas.artists.SurfaceArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.draw_collection +============================================ + +.. currentmodule:: compas.artists + +.. automethod:: SurfaceArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.SurfaceArtist.redraw.rst b/docs/reference/generated/compas.artists.SurfaceArtist.redraw.rst new file mode 100644 index 00000000000..faefc4dca12 --- /dev/null +++ b/docs/reference/generated/compas.artists.SurfaceArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.redraw +=================================== + +.. currentmodule:: compas.artists + +.. automethod:: SurfaceArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.SurfaceArtist.register.rst b/docs/reference/generated/compas.artists.SurfaceArtist.register.rst new file mode 100644 index 00000000000..ef3d50ac0d0 --- /dev/null +++ b/docs/reference/generated/compas.artists.SurfaceArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.register +===================================== + +.. currentmodule:: compas.artists + +.. automethod:: SurfaceArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.SurfaceArtist.rst b/docs/reference/generated/compas.artists.SurfaceArtist.rst new file mode 100644 index 00000000000..dcf415ee896 --- /dev/null +++ b/docs/reference/generated/compas.artists.SurfaceArtist.rst @@ -0,0 +1,60 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +SurfaceArtist +============= + +.. currentmodule:: compas.artists + +.. autoclass:: SurfaceArtist + + + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~SurfaceArtist.build + ~SurfaceArtist.build_as + ~SurfaceArtist.clear + ~SurfaceArtist.draw + ~SurfaceArtist.draw_collection + ~SurfaceArtist.redraw + ~SurfaceArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.build.rst b/docs/reference/generated/compas.artists.VolMeshArtist.build.rst new file mode 100644 index 00000000000..82e9d8d67c3 --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.build +================================== + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.build_as.rst b/docs/reference/generated/compas.artists.VolMeshArtist.build_as.rst new file mode 100644 index 00000000000..041c8c82d58 --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.build_as +===================================== + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.clear.rst b/docs/reference/generated/compas.artists.VolMeshArtist.clear.rst new file mode 100644 index 00000000000..eea6be18879 --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.clear +================================== + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.clear_cells.rst b/docs/reference/generated/compas.artists.VolMeshArtist.clear_cells.rst new file mode 100644 index 00000000000..9453fdf26d1 --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.clear_cells.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.clear_cells +======================================== + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.clear_cells \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.clear_edges.rst b/docs/reference/generated/compas.artists.VolMeshArtist.clear_edges.rst new file mode 100644 index 00000000000..e96686e30c5 --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.clear_edges.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.clear_edges +======================================== + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.clear_edges \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.clear_faces.rst b/docs/reference/generated/compas.artists.VolMeshArtist.clear_faces.rst new file mode 100644 index 00000000000..a5af158bd7c --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.clear_faces.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.clear_faces +======================================== + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.clear_faces \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.clear_vertices.rst b/docs/reference/generated/compas.artists.VolMeshArtist.clear_vertices.rst new file mode 100644 index 00000000000..1d36cc66f49 --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.clear_vertices.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.clear_vertices +=========================================== + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.clear_vertices \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.draw.rst b/docs/reference/generated/compas.artists.VolMeshArtist.draw.rst new file mode 100644 index 00000000000..87e24edf398 --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.draw +================================= + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.draw_cells.rst b/docs/reference/generated/compas.artists.VolMeshArtist.draw_cells.rst new file mode 100644 index 00000000000..6b5cadd4c17 --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.draw_cells.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.draw_cells +======================================= + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.draw_cells \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.draw_collection.rst b/docs/reference/generated/compas.artists.VolMeshArtist.draw_collection.rst new file mode 100644 index 00000000000..9dfa89e1801 --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.draw_collection +============================================ + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.draw_edges.rst b/docs/reference/generated/compas.artists.VolMeshArtist.draw_edges.rst new file mode 100644 index 00000000000..f8baff0684b --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.draw_edges.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.draw_edges +======================================= + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.draw_edges \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.draw_faces.rst b/docs/reference/generated/compas.artists.VolMeshArtist.draw_faces.rst new file mode 100644 index 00000000000..55162b40e51 --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.draw_faces.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.draw_faces +======================================= + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.draw_faces \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.draw_vertices.rst b/docs/reference/generated/compas.artists.VolMeshArtist.draw_vertices.rst new file mode 100644 index 00000000000..78b71e40df4 --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.draw_vertices.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.draw_vertices +========================================== + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.draw_vertices \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.redraw.rst b/docs/reference/generated/compas.artists.VolMeshArtist.redraw.rst new file mode 100644 index 00000000000..86ef3e38198 --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.redraw +=================================== + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.register.rst b/docs/reference/generated/compas.artists.VolMeshArtist.register.rst new file mode 100644 index 00000000000..3cf1094200e --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VolMeshArtist.register +===================================== + +.. currentmodule:: compas.artists + +.. automethod:: VolMeshArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.VolMeshArtist.rst b/docs/reference/generated/compas.artists.VolMeshArtist.rst new file mode 100644 index 00000000000..bd3cb5fff08 --- /dev/null +++ b/docs/reference/generated/compas.artists.VolMeshArtist.rst @@ -0,0 +1,107 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +VolMeshArtist +============= + +.. currentmodule:: compas.artists + +.. autoclass:: VolMeshArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~VolMeshArtist.clear_cells + ~VolMeshArtist.clear_edges + ~VolMeshArtist.clear_faces + ~VolMeshArtist.clear_vertices + ~VolMeshArtist.draw_cells + ~VolMeshArtist.draw_edges + ~VolMeshArtist.draw_faces + ~VolMeshArtist.draw_vertices + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~VolMeshArtist.build + ~VolMeshArtist.build_as + ~VolMeshArtist.clear + ~VolMeshArtist.draw + ~VolMeshArtist.draw_collection + ~VolMeshArtist.redraw + ~VolMeshArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.clear.rst b/docs/reference/generated/compas.artists.clear.rst new file mode 100644 index 00000000000..eca4f9c5a03 --- /dev/null +++ b/docs/reference/generated/compas.artists.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +clear +==================== + +.. currentmodule:: compas.artists + +.. autofunction:: clear \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.redraw.rst b/docs/reference/generated/compas.artists.redraw.rst new file mode 100644 index 00000000000..ad4707cef78 --- /dev/null +++ b/docs/reference/generated/compas.artists.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +redraw +===================== + +.. currentmodule:: compas.artists + +.. autofunction:: redraw \ No newline at end of file diff --git a/docs/reference/generated/compas.artists.register_artists.rst b/docs/reference/generated/compas.artists.register_artists.rst new file mode 100644 index 00000000000..a07d1fd8828 --- /dev/null +++ b/docs/reference/generated/compas.artists.register_artists.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +register_artists +=============================== + +.. currentmodule:: compas.artists + +.. autofunction:: register_artists \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.ToString.rst b/docs/reference/generated/compas.colors.Color.ToString.rst new file mode 100644 index 00000000000..6eb5104572c --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.ToString.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.ToString +============================ + +.. currentmodule:: compas.colors + +.. automethod:: Color.ToString \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.azure.rst b/docs/reference/generated/compas.colors.Color.azure.rst new file mode 100644 index 00000000000..abc61fadfed --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.azure.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.azure +========================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.azure \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.black.rst b/docs/reference/generated/compas.colors.Color.black.rst new file mode 100644 index 00000000000..3b7910dba9d --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.black.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.black +========================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.black \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.blue.rst b/docs/reference/generated/compas.colors.Color.blue.rst new file mode 100644 index 00000000000..9335423ccab --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.blue.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.blue +======================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.blue \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.brown.rst b/docs/reference/generated/compas.colors.Color.brown.rst new file mode 100644 index 00000000000..63ee90cf33e --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.brown.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.brown +========================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.brown \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.coerce.rst b/docs/reference/generated/compas.colors.Color.coerce.rst new file mode 100644 index 00000000000..eada8b69520 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.coerce.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.coerce +========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.coerce \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.copy.rst b/docs/reference/generated/compas.colors.Color.copy.rst new file mode 100644 index 00000000000..ec311ae3a3f --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.copy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.copy +======================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.copy \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.cyan.rst b/docs/reference/generated/compas.colors.Color.cyan.rst new file mode 100644 index 00000000000..cbe6d26c6f5 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.cyan.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.cyan +======================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.cyan \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.darken.rst b/docs/reference/generated/compas.colors.Color.darken.rst new file mode 100644 index 00000000000..298d3864033 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.darken.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.darken +========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.darken \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.darkened.rst b/docs/reference/generated/compas.colors.Color.darkened.rst new file mode 100644 index 00000000000..0e7c83d964f --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.darkened.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.darkened +============================ + +.. currentmodule:: compas.colors + +.. automethod:: Color.darkened \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.desaturate.rst b/docs/reference/generated/compas.colors.Color.desaturate.rst new file mode 100644 index 00000000000..29a626186a8 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.desaturate.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.desaturate +============================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.desaturate \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.desaturated.rst b/docs/reference/generated/compas.colors.Color.desaturated.rst new file mode 100644 index 00000000000..d2c5e957ee6 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.desaturated.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.desaturated +=============================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.desaturated \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.from_data.rst b/docs/reference/generated/compas.colors.Color.from_data.rst new file mode 100644 index 00000000000..cd543057c99 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.from_data.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.from_data +============================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.from_data \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.from_hex.rst b/docs/reference/generated/compas.colors.Color.from_hex.rst new file mode 100644 index 00000000000..352d8db6bd9 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.from_hex.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.from_hex +============================ + +.. currentmodule:: compas.colors + +.. automethod:: Color.from_hex \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.from_hls.rst b/docs/reference/generated/compas.colors.Color.from_hls.rst new file mode 100644 index 00000000000..28e20088554 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.from_hls.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.from_hls +============================ + +.. currentmodule:: compas.colors + +.. automethod:: Color.from_hls \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.from_hsv.rst b/docs/reference/generated/compas.colors.Color.from_hsv.rst new file mode 100644 index 00000000000..8cbf3611012 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.from_hsv.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.from_hsv +============================ + +.. currentmodule:: compas.colors + +.. automethod:: Color.from_hsv \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.from_i.rst b/docs/reference/generated/compas.colors.Color.from_i.rst new file mode 100644 index 00000000000..68ac0a3e1cf --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.from_i.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.from_i +========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.from_i \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.from_json.rst b/docs/reference/generated/compas.colors.Color.from_json.rst new file mode 100644 index 00000000000..b75bb6a2881 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.from_json.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.from_json +============================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.from_json \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.from_jsonstring.rst b/docs/reference/generated/compas.colors.Color.from_jsonstring.rst new file mode 100644 index 00000000000..75497011f75 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.from_jsonstring.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.from_jsonstring +=================================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.from_jsonstring \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.from_name.rst b/docs/reference/generated/compas.colors.Color.from_name.rst new file mode 100644 index 00000000000..be27a6774e3 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.from_name.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.from_name +============================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.from_name \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.from_rgb255.rst b/docs/reference/generated/compas.colors.Color.from_rgb255.rst new file mode 100644 index 00000000000..48484985a28 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.from_rgb255.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.from_rgb255 +=============================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.from_rgb255 \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.from_yiq.rst b/docs/reference/generated/compas.colors.Color.from_yiq.rst new file mode 100644 index 00000000000..2edb7e9a146 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.from_yiq.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.from_yiq +============================ + +.. currentmodule:: compas.colors + +.. automethod:: Color.from_yiq \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.from_yuv.rst b/docs/reference/generated/compas.colors.Color.from_yuv.rst new file mode 100644 index 00000000000..ddfafb9c35a --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.from_yuv.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.from_yuv +============================ + +.. currentmodule:: compas.colors + +.. automethod:: Color.from_yuv \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.green.rst b/docs/reference/generated/compas.colors.Color.green.rst new file mode 100644 index 00000000000..2d2a3c5cd0a --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.green.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.green +========================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.green \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.grey.rst b/docs/reference/generated/compas.colors.Color.grey.rst new file mode 100644 index 00000000000..dae18f253fd --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.grey.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.grey +======================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.grey \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.invert.rst b/docs/reference/generated/compas.colors.Color.invert.rst new file mode 100644 index 00000000000..a2ce569f2fd --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.invert.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.invert +========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.invert \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.inverted.rst b/docs/reference/generated/compas.colors.Color.inverted.rst new file mode 100644 index 00000000000..3b4d7cd664d --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.inverted.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.inverted +============================ + +.. currentmodule:: compas.colors + +.. automethod:: Color.inverted \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.is_hex.rst b/docs/reference/generated/compas.colors.Color.is_hex.rst new file mode 100644 index 00000000000..410657612d2 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.is_hex.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.is_hex +========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.is_hex \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.is_rgb1.rst b/docs/reference/generated/compas.colors.Color.is_rgb1.rst new file mode 100644 index 00000000000..05e72dfd263 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.is_rgb1.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.is_rgb1 +=========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.is_rgb1 \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.is_rgb255.rst b/docs/reference/generated/compas.colors.Color.is_rgb255.rst new file mode 100644 index 00000000000..1b41eb9d927 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.is_rgb255.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.is_rgb255 +============================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.is_rgb255 \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.lighten.rst b/docs/reference/generated/compas.colors.Color.lighten.rst new file mode 100644 index 00000000000..9b3e8d5902b --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.lighten.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.lighten +=========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.lighten \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.lightened.rst b/docs/reference/generated/compas.colors.Color.lightened.rst new file mode 100644 index 00000000000..a87e7df9dfa --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.lightened.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.lightened +============================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.lightened \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.lime.rst b/docs/reference/generated/compas.colors.Color.lime.rst new file mode 100644 index 00000000000..661ed15ee73 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.lime.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.lime +======================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.lime \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.magenta.rst b/docs/reference/generated/compas.colors.Color.magenta.rst new file mode 100644 index 00000000000..7b97f20c092 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.magenta.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.magenta +=========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.magenta \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.maroon.rst b/docs/reference/generated/compas.colors.Color.maroon.rst new file mode 100644 index 00000000000..5d9abb3f0c5 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.maroon.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.maroon +========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.maroon \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.mint.rst b/docs/reference/generated/compas.colors.Color.mint.rst new file mode 100644 index 00000000000..4053b1ba78b --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.mint.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.mint +======================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.mint \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.navy.rst b/docs/reference/generated/compas.colors.Color.navy.rst new file mode 100644 index 00000000000..7f5c84764f5 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.navy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.navy +======================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.navy \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.olive.rst b/docs/reference/generated/compas.colors.Color.olive.rst new file mode 100644 index 00000000000..a849d0f720d --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.olive.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.olive +========================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.olive \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.orange.rst b/docs/reference/generated/compas.colors.Color.orange.rst new file mode 100644 index 00000000000..65e501af36f --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.orange.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.orange +========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.orange \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.pink.rst b/docs/reference/generated/compas.colors.Color.pink.rst new file mode 100644 index 00000000000..fb17dda2d96 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.pink.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.pink +======================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.pink \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.purple.rst b/docs/reference/generated/compas.colors.Color.purple.rst new file mode 100644 index 00000000000..e1ff38c0dc9 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.purple.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.purple +========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.purple \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.red.rst b/docs/reference/generated/compas.colors.Color.red.rst new file mode 100644 index 00000000000..2f4dea27ae3 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.red.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.red +======================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.red \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.rst b/docs/reference/generated/compas.colors.Color.rst new file mode 100644 index 00000000000..f38ae3ac00a --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.rst @@ -0,0 +1,312 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Color +===== + +.. currentmodule:: compas.colors + +.. autoclass:: Color + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~Color.azure + ~Color.black + ~Color.blue + ~Color.brown + ~Color.coerce + ~Color.cyan + ~Color.darken + ~Color.darkened + ~Color.desaturate + ~Color.desaturated + ~Color.from_data + ~Color.from_hex + ~Color.from_hls + ~Color.from_hsv + ~Color.from_i + ~Color.from_name + ~Color.from_rgb255 + ~Color.from_yiq + ~Color.from_yuv + ~Color.green + ~Color.grey + ~Color.invert + ~Color.inverted + ~Color.is_hex + ~Color.is_rgb1 + ~Color.is_rgb255 + ~Color.lighten + ~Color.lightened + ~Color.lime + ~Color.magenta + ~Color.maroon + ~Color.mint + ~Color.navy + ~Color.olive + ~Color.orange + ~Color.pink + ~Color.purple + ~Color.red + ~Color.saturate + ~Color.saturated + ~Color.silver + ~Color.teal + ~Color.violet + ~Color.white + ~Color.yellow + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~Color.ToString + ~Color.copy + ~Color.from_json + ~Color.from_jsonstring + ~Color.sha256 + ~Color.to_data + ~Color.to_json + ~Color.to_jsonstring + ~Color.validate_json + ~Color.validate_jsondata + ~Color.validate_jsonstring + + \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.saturate.rst b/docs/reference/generated/compas.colors.Color.saturate.rst new file mode 100644 index 00000000000..80ffe33c001 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.saturate.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.saturate +============================ + +.. currentmodule:: compas.colors + +.. automethod:: Color.saturate \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.saturated.rst b/docs/reference/generated/compas.colors.Color.saturated.rst new file mode 100644 index 00000000000..2b44e48e6a3 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.saturated.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.saturated +============================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.saturated \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.sha256.rst b/docs/reference/generated/compas.colors.Color.sha256.rst new file mode 100644 index 00000000000..910e9e5765f --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.sha256.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.sha256 +========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.sha256 \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.silver.rst b/docs/reference/generated/compas.colors.Color.silver.rst new file mode 100644 index 00000000000..d0794d9df50 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.silver.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.silver +========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.silver \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.teal.rst b/docs/reference/generated/compas.colors.Color.teal.rst new file mode 100644 index 00000000000..9d34c158068 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.teal.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.teal +======================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.teal \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.to_data.rst b/docs/reference/generated/compas.colors.Color.to_data.rst new file mode 100644 index 00000000000..2fa25109f8c --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.to_data.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.to_data +=========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.to_data \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.to_json.rst b/docs/reference/generated/compas.colors.Color.to_json.rst new file mode 100644 index 00000000000..2e879850fc4 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.to_json.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.to_json +=========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.to_json \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.to_jsonstring.rst b/docs/reference/generated/compas.colors.Color.to_jsonstring.rst new file mode 100644 index 00000000000..b9c66179448 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.to_jsonstring.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.to_jsonstring +================================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.to_jsonstring \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.validate_json.rst b/docs/reference/generated/compas.colors.Color.validate_json.rst new file mode 100644 index 00000000000..6b4465bfee7 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.validate_json.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.validate_json +================================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.validate_json \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.violet.rst b/docs/reference/generated/compas.colors.Color.violet.rst new file mode 100644 index 00000000000..02eb587ea27 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.violet.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.violet +========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.violet \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.white.rst b/docs/reference/generated/compas.colors.Color.white.rst new file mode 100644 index 00000000000..054ce73d2ed --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.white.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.white +========================= + +.. currentmodule:: compas.colors + +.. automethod:: Color.white \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.Color.yellow.rst b/docs/reference/generated/compas.colors.Color.yellow.rst new file mode 100644 index 00000000000..aeeb8396409 --- /dev/null +++ b/docs/reference/generated/compas.colors.Color.yellow.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Color.yellow +========================== + +.. currentmodule:: compas.colors + +.. automethod:: Color.yellow \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.ColorMap.from_color.rst b/docs/reference/generated/compas.colors.ColorMap.from_color.rst new file mode 100644 index 00000000000..8aaf865366c --- /dev/null +++ b/docs/reference/generated/compas.colors.ColorMap.from_color.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ColorMap.from_color +================================= + +.. currentmodule:: compas.colors + +.. automethod:: ColorMap.from_color \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.ColorMap.from_mpl.rst b/docs/reference/generated/compas.colors.ColorMap.from_mpl.rst new file mode 100644 index 00000000000..63f328b52c5 --- /dev/null +++ b/docs/reference/generated/compas.colors.ColorMap.from_mpl.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ColorMap.from_mpl +=============================== + +.. currentmodule:: compas.colors + +.. automethod:: ColorMap.from_mpl \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.ColorMap.from_palette.rst b/docs/reference/generated/compas.colors.ColorMap.from_palette.rst new file mode 100644 index 00000000000..fd41f677d3f --- /dev/null +++ b/docs/reference/generated/compas.colors.ColorMap.from_palette.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ColorMap.from_palette +=================================== + +.. currentmodule:: compas.colors + +.. automethod:: ColorMap.from_palette \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.ColorMap.from_rgb.rst b/docs/reference/generated/compas.colors.ColorMap.from_rgb.rst new file mode 100644 index 00000000000..e0cc988363c --- /dev/null +++ b/docs/reference/generated/compas.colors.ColorMap.from_rgb.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ColorMap.from_rgb +=============================== + +.. currentmodule:: compas.colors + +.. automethod:: ColorMap.from_rgb \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.ColorMap.from_three_colors.rst b/docs/reference/generated/compas.colors.ColorMap.from_three_colors.rst new file mode 100644 index 00000000000..5dfa388d20d --- /dev/null +++ b/docs/reference/generated/compas.colors.ColorMap.from_three_colors.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ColorMap.from_three_colors +======================================== + +.. currentmodule:: compas.colors + +.. automethod:: ColorMap.from_three_colors \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.ColorMap.from_two_colors.rst b/docs/reference/generated/compas.colors.ColorMap.from_two_colors.rst new file mode 100644 index 00000000000..0241239d1a5 --- /dev/null +++ b/docs/reference/generated/compas.colors.ColorMap.from_two_colors.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ColorMap.from_two_colors +====================================== + +.. currentmodule:: compas.colors + +.. automethod:: ColorMap.from_two_colors \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.ColorMap.plot.rst b/docs/reference/generated/compas.colors.ColorMap.plot.rst new file mode 100644 index 00000000000..8815a2c692a --- /dev/null +++ b/docs/reference/generated/compas.colors.ColorMap.plot.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ColorMap.plot +=========================== + +.. currentmodule:: compas.colors + +.. automethod:: ColorMap.plot \ No newline at end of file diff --git a/docs/reference/generated/compas.colors.ColorMap.rst b/docs/reference/generated/compas.colors.ColorMap.rst new file mode 100644 index 00000000000..5bf4b145abc --- /dev/null +++ b/docs/reference/generated/compas.colors.ColorMap.rst @@ -0,0 +1,60 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ColorMap +======== + +.. currentmodule:: compas.colors + +.. autoclass:: ColorMap + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~ColorMap.from_color + ~ColorMap.from_mpl + ~ColorMap.from_palette + ~ColorMap.from_rgb + ~ColorMap.from_three_colors + ~ColorMap.from_two_colors + ~ColorMap.plot + + + + \ No newline at end of file diff --git a/docs/reference/generated/compas.data.Data.ToString.rst b/docs/reference/generated/compas.data.Data.ToString.rst new file mode 100644 index 00000000000..320c2b8ccce --- /dev/null +++ b/docs/reference/generated/compas.data.Data.ToString.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Data.ToString +========================= + +.. currentmodule:: compas.data + +.. automethod:: Data.ToString \ No newline at end of file diff --git a/docs/reference/generated/compas.data.Data.copy.rst b/docs/reference/generated/compas.data.Data.copy.rst new file mode 100644 index 00000000000..2ea915e3b88 --- /dev/null +++ b/docs/reference/generated/compas.data.Data.copy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Data.copy +===================== + +.. currentmodule:: compas.data + +.. automethod:: Data.copy \ No newline at end of file diff --git a/docs/reference/generated/compas.data.Data.from_data.rst b/docs/reference/generated/compas.data.Data.from_data.rst new file mode 100644 index 00000000000..3162b6c5c07 --- /dev/null +++ b/docs/reference/generated/compas.data.Data.from_data.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Data.from_data +========================== + +.. currentmodule:: compas.data + +.. automethod:: Data.from_data \ No newline at end of file diff --git a/docs/reference/generated/compas.data.Data.from_json.rst b/docs/reference/generated/compas.data.Data.from_json.rst new file mode 100644 index 00000000000..b837bde1938 --- /dev/null +++ b/docs/reference/generated/compas.data.Data.from_json.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Data.from_json +========================== + +.. currentmodule:: compas.data + +.. automethod:: Data.from_json \ No newline at end of file diff --git a/docs/reference/generated/compas.data.Data.from_jsonstring.rst b/docs/reference/generated/compas.data.Data.from_jsonstring.rst new file mode 100644 index 00000000000..5997f47cfc6 --- /dev/null +++ b/docs/reference/generated/compas.data.Data.from_jsonstring.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Data.from_jsonstring +================================ + +.. currentmodule:: compas.data + +.. automethod:: Data.from_jsonstring \ No newline at end of file diff --git a/docs/reference/generated/compas.data.Data.rst b/docs/reference/generated/compas.data.Data.rst new file mode 100644 index 00000000000..0268d835908 --- /dev/null +++ b/docs/reference/generated/compas.data.Data.rst @@ -0,0 +1,85 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Data +==== + +.. currentmodule:: compas.data + +.. autoclass:: Data + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~Data.ToString + ~Data.copy + ~Data.from_data + ~Data.from_json + ~Data.from_jsonstring + ~Data.sha256 + ~Data.to_data + ~Data.to_json + ~Data.to_jsonstring + ~Data.validate_json + ~Data.validate_jsondata + ~Data.validate_jsonstring + + + + \ No newline at end of file diff --git a/docs/reference/generated/compas.data.Data.sha256.rst b/docs/reference/generated/compas.data.Data.sha256.rst new file mode 100644 index 00000000000..ffefa539e55 --- /dev/null +++ b/docs/reference/generated/compas.data.Data.sha256.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Data.sha256 +======================= + +.. currentmodule:: compas.data + +.. automethod:: Data.sha256 \ No newline at end of file diff --git a/docs/reference/generated/compas.data.Data.to_data.rst b/docs/reference/generated/compas.data.Data.to_data.rst new file mode 100644 index 00000000000..2550b98327c --- /dev/null +++ b/docs/reference/generated/compas.data.Data.to_data.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Data.to_data +======================== + +.. currentmodule:: compas.data + +.. automethod:: Data.to_data \ No newline at end of file diff --git a/docs/reference/generated/compas.data.Data.to_json.rst b/docs/reference/generated/compas.data.Data.to_json.rst new file mode 100644 index 00000000000..8611dc907a8 --- /dev/null +++ b/docs/reference/generated/compas.data.Data.to_json.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Data.to_json +======================== + +.. currentmodule:: compas.data + +.. automethod:: Data.to_json \ No newline at end of file diff --git a/docs/reference/generated/compas.data.Data.to_jsonstring.rst b/docs/reference/generated/compas.data.Data.to_jsonstring.rst new file mode 100644 index 00000000000..97887462459 --- /dev/null +++ b/docs/reference/generated/compas.data.Data.to_jsonstring.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Data.to_jsonstring +============================== + +.. currentmodule:: compas.data + +.. automethod:: Data.to_jsonstring \ No newline at end of file diff --git a/docs/reference/generated/compas.data.Data.validate_json.rst b/docs/reference/generated/compas.data.Data.validate_json.rst new file mode 100644 index 00000000000..d84f8b85cf7 --- /dev/null +++ b/docs/reference/generated/compas.data.Data.validate_json.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Data.validate_json +============================== + +.. currentmodule:: compas.data + +.. automethod:: Data.validate_json \ No newline at end of file diff --git a/docs/reference/generated/compas.data.DataDecoder.decode.rst b/docs/reference/generated/compas.data.DataDecoder.decode.rst new file mode 100644 index 00000000000..cf50d682be2 --- /dev/null +++ b/docs/reference/generated/compas.data.DataDecoder.decode.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +DataDecoder.decode +============================== + +.. currentmodule:: compas.data + +.. automethod:: DataDecoder.decode \ No newline at end of file diff --git a/docs/reference/generated/compas.data.DataDecoder.object_hook.rst b/docs/reference/generated/compas.data.DataDecoder.object_hook.rst new file mode 100644 index 00000000000..02f7e201f45 --- /dev/null +++ b/docs/reference/generated/compas.data.DataDecoder.object_hook.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +DataDecoder.object_hook +=================================== + +.. currentmodule:: compas.data + +.. automethod:: DataDecoder.object_hook \ No newline at end of file diff --git a/docs/reference/generated/compas.data.DataDecoder.raw_decode.rst b/docs/reference/generated/compas.data.DataDecoder.raw_decode.rst new file mode 100644 index 00000000000..19f336ea0bf --- /dev/null +++ b/docs/reference/generated/compas.data.DataDecoder.raw_decode.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +DataDecoder.raw_decode +================================== + +.. currentmodule:: compas.data + +.. automethod:: DataDecoder.raw_decode \ No newline at end of file diff --git a/docs/reference/generated/compas.data.DataDecoder.rst b/docs/reference/generated/compas.data.DataDecoder.rst new file mode 100644 index 00000000000..39c650b9748 --- /dev/null +++ b/docs/reference/generated/compas.data.DataDecoder.rst @@ -0,0 +1,47 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + +DataDecoder +=========== + +.. currentmodule:: compas.data + +.. autoclass:: DataDecoder + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~DataDecoder.object_hook + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~DataDecoder.decode + ~DataDecoder.raw_decode + + \ No newline at end of file diff --git a/docs/reference/generated/compas.data.DataEncoder.default.rst b/docs/reference/generated/compas.data.DataEncoder.default.rst new file mode 100644 index 00000000000..27896e6d912 --- /dev/null +++ b/docs/reference/generated/compas.data.DataEncoder.default.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +DataEncoder.default +=============================== + +.. currentmodule:: compas.data + +.. automethod:: DataEncoder.default \ No newline at end of file diff --git a/docs/reference/generated/compas.data.DataEncoder.encode.rst b/docs/reference/generated/compas.data.DataEncoder.encode.rst new file mode 100644 index 00000000000..057d61de725 --- /dev/null +++ b/docs/reference/generated/compas.data.DataEncoder.encode.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +DataEncoder.encode +============================== + +.. currentmodule:: compas.data + +.. automethod:: DataEncoder.encode \ No newline at end of file diff --git a/docs/reference/generated/compas.data.DataEncoder.iterencode.rst b/docs/reference/generated/compas.data.DataEncoder.iterencode.rst new file mode 100644 index 00000000000..fe8495fb221 --- /dev/null +++ b/docs/reference/generated/compas.data.DataEncoder.iterencode.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +DataEncoder.iterencode +================================== + +.. currentmodule:: compas.data + +.. automethod:: DataEncoder.iterencode \ No newline at end of file diff --git a/docs/reference/generated/compas.data.DataEncoder.rst b/docs/reference/generated/compas.data.DataEncoder.rst new file mode 100644 index 00000000000..215dedde118 --- /dev/null +++ b/docs/reference/generated/compas.data.DataEncoder.rst @@ -0,0 +1,47 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + +DataEncoder +=========== + +.. currentmodule:: compas.data + +.. autoclass:: DataEncoder + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~DataEncoder.default + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~DataEncoder.encode + ~DataEncoder.iterencode + + \ No newline at end of file diff --git a/docs/reference/generated/compas.data.DecoderError.rst b/docs/reference/generated/compas.data.DecoderError.rst new file mode 100644 index 00000000000..07fbba32754 --- /dev/null +++ b/docs/reference/generated/compas.data.DecoderError.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +DecoderError +======================== + +.. currentmodule:: compas.data + +.. autoexception:: DecoderError \ No newline at end of file diff --git a/docs/reference/generated/compas.data.is_float3.rst b/docs/reference/generated/compas.data.is_float3.rst new file mode 100644 index 00000000000..45f8aa92e2a --- /dev/null +++ b/docs/reference/generated/compas.data.is_float3.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +is_float3 +===================== + +.. currentmodule:: compas.data + +.. autofunction:: is_float3 \ No newline at end of file diff --git a/docs/reference/generated/compas.data.is_float4x4.rst b/docs/reference/generated/compas.data.is_float4x4.rst new file mode 100644 index 00000000000..77b0001f405 --- /dev/null +++ b/docs/reference/generated/compas.data.is_float4x4.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +is_float4x4 +======================= + +.. currentmodule:: compas.data + +.. autofunction:: is_float4x4 \ No newline at end of file diff --git a/docs/reference/generated/compas.data.is_int3.rst b/docs/reference/generated/compas.data.is_int3.rst new file mode 100644 index 00000000000..5482b5e4bc8 --- /dev/null +++ b/docs/reference/generated/compas.data.is_int3.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +is_int3 +=================== + +.. currentmodule:: compas.data + +.. autofunction:: is_int3 \ No newline at end of file diff --git a/docs/reference/generated/compas.data.is_sequence_of_float.rst b/docs/reference/generated/compas.data.is_sequence_of_float.rst new file mode 100644 index 00000000000..ceccc26fa76 --- /dev/null +++ b/docs/reference/generated/compas.data.is_sequence_of_float.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +is_sequence_of_float +================================ + +.. currentmodule:: compas.data + +.. autofunction:: is_sequence_of_float \ No newline at end of file diff --git a/docs/reference/generated/compas.data.is_sequence_of_int.rst b/docs/reference/generated/compas.data.is_sequence_of_int.rst new file mode 100644 index 00000000000..0f2c29d9547 --- /dev/null +++ b/docs/reference/generated/compas.data.is_sequence_of_int.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +is_sequence_of_int +============================== + +.. currentmodule:: compas.data + +.. autofunction:: is_sequence_of_int \ No newline at end of file diff --git a/docs/reference/generated/compas.data.is_sequence_of_uint.rst b/docs/reference/generated/compas.data.is_sequence_of_uint.rst new file mode 100644 index 00000000000..5b28db63dd6 --- /dev/null +++ b/docs/reference/generated/compas.data.is_sequence_of_uint.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +is_sequence_of_uint +=============================== + +.. currentmodule:: compas.data + +.. autofunction:: is_sequence_of_uint \ No newline at end of file diff --git a/docs/reference/generated/compas.data.json_dump.rst b/docs/reference/generated/compas.data.json_dump.rst new file mode 100644 index 00000000000..06cb8dfe997 --- /dev/null +++ b/docs/reference/generated/compas.data.json_dump.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +json_dump +===================== + +.. currentmodule:: compas.data + +.. autofunction:: json_dump \ No newline at end of file diff --git a/docs/reference/generated/compas.data.json_dumps.rst b/docs/reference/generated/compas.data.json_dumps.rst new file mode 100644 index 00000000000..84dbbf47cbc --- /dev/null +++ b/docs/reference/generated/compas.data.json_dumps.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +json_dumps +====================== + +.. currentmodule:: compas.data + +.. autofunction:: json_dumps \ No newline at end of file diff --git a/docs/reference/generated/compas.data.json_load.rst b/docs/reference/generated/compas.data.json_load.rst new file mode 100644 index 00000000000..94c64940070 --- /dev/null +++ b/docs/reference/generated/compas.data.json_load.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +json_load +===================== + +.. currentmodule:: compas.data + +.. autofunction:: json_load \ No newline at end of file diff --git a/docs/reference/generated/compas.data.json_loads.rst b/docs/reference/generated/compas.data.json_loads.rst new file mode 100644 index 00000000000..973bdf05712 --- /dev/null +++ b/docs/reference/generated/compas.data.json_loads.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +json_loads +====================== + +.. currentmodule:: compas.data + +.. autofunction:: json_loads \ No newline at end of file diff --git a/docs/reference/generated/compas.data.validate_data.rst b/docs/reference/generated/compas.data.validate_data.rst new file mode 100644 index 00000000000..9044238d434 --- /dev/null +++ b/docs/reference/generated/compas.data.validate_data.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +validate_data +========================= + +.. currentmodule:: compas.data + +.. autofunction:: validate_data \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.adjacency_matrix.rst b/docs/reference/generated/compas.numerical.adjacency_matrix.rst new file mode 100644 index 00000000000..9fee55cbcfa --- /dev/null +++ b/docs/reference/generated/compas.numerical.adjacency_matrix.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +adjacency_matrix +================================= + +.. currentmodule:: compas.numerical + +.. autofunction:: adjacency_matrix \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.chofactor.rst b/docs/reference/generated/compas.numerical.chofactor.rst new file mode 100644 index 00000000000..9df6b796a19 --- /dev/null +++ b/docs/reference/generated/compas.numerical.chofactor.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +chofactor +========================== + +.. currentmodule:: compas.numerical + +.. autofunction:: chofactor \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.connectivity_matrix.rst b/docs/reference/generated/compas.numerical.connectivity_matrix.rst new file mode 100644 index 00000000000..4a00d5d9560 --- /dev/null +++ b/docs/reference/generated/compas.numerical.connectivity_matrix.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +connectivity_matrix +==================================== + +.. currentmodule:: compas.numerical + +.. autofunction:: connectivity_matrix \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.curl.rst b/docs/reference/generated/compas.numerical.curl.rst new file mode 100644 index 00000000000..f76f7e4d83f --- /dev/null +++ b/docs/reference/generated/compas.numerical.curl.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +curl +===================== + +.. currentmodule:: compas.numerical + +.. autofunction:: curl \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.degree_matrix.rst b/docs/reference/generated/compas.numerical.degree_matrix.rst new file mode 100644 index 00000000000..91fb82331bd --- /dev/null +++ b/docs/reference/generated/compas.numerical.degree_matrix.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +degree_matrix +============================== + +.. currentmodule:: compas.numerical + +.. autofunction:: degree_matrix \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.descent_numpy.rst b/docs/reference/generated/compas.numerical.descent_numpy.rst new file mode 100644 index 00000000000..e5acb1ed30a --- /dev/null +++ b/docs/reference/generated/compas.numerical.descent_numpy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +descent_numpy +============================== + +.. currentmodule:: compas.numerical + +.. autofunction:: descent_numpy \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.devo_numpy.rst b/docs/reference/generated/compas.numerical.devo_numpy.rst new file mode 100644 index 00000000000..a6fcefdc977 --- /dev/null +++ b/docs/reference/generated/compas.numerical.devo_numpy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +devo_numpy +=========================== + +.. currentmodule:: compas.numerical + +.. autofunction:: devo_numpy \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.div.rst b/docs/reference/generated/compas.numerical.div.rst new file mode 100644 index 00000000000..3b589f3aadb --- /dev/null +++ b/docs/reference/generated/compas.numerical.div.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +div +==================== + +.. currentmodule:: compas.numerical + +.. autofunction:: div \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.dof.rst b/docs/reference/generated/compas.numerical.dof.rst new file mode 100644 index 00000000000..637ea554e58 --- /dev/null +++ b/docs/reference/generated/compas.numerical.dof.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +dof +==================== + +.. currentmodule:: compas.numerical + +.. autofunction:: dof \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.dr.rst b/docs/reference/generated/compas.numerical.dr.rst new file mode 100644 index 00000000000..f3af4ae112b --- /dev/null +++ b/docs/reference/generated/compas.numerical.dr.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +dr +=================== + +.. currentmodule:: compas.numerical + +.. autofunction:: dr \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.dr_numpy.rst b/docs/reference/generated/compas.numerical.dr_numpy.rst new file mode 100644 index 00000000000..80bf243a249 --- /dev/null +++ b/docs/reference/generated/compas.numerical.dr_numpy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +dr_numpy +========================= + +.. currentmodule:: compas.numerical + +.. autofunction:: dr_numpy \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.equilibrium_matrix.rst b/docs/reference/generated/compas.numerical.equilibrium_matrix.rst new file mode 100644 index 00000000000..1fb1d517f94 --- /dev/null +++ b/docs/reference/generated/compas.numerical.equilibrium_matrix.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +equilibrium_matrix +=================================== + +.. currentmodule:: compas.numerical + +.. autofunction:: equilibrium_matrix \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.face_matrix.rst b/docs/reference/generated/compas.numerical.face_matrix.rst new file mode 100644 index 00000000000..eb039af208c --- /dev/null +++ b/docs/reference/generated/compas.numerical.face_matrix.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +face_matrix +============================ + +.. currentmodule:: compas.numerical + +.. autofunction:: face_matrix \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.fd_numpy.rst b/docs/reference/generated/compas.numerical.fd_numpy.rst new file mode 100644 index 00000000000..b96353bb3d4 --- /dev/null +++ b/docs/reference/generated/compas.numerical.fd_numpy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +fd_numpy +========================= + +.. currentmodule:: compas.numerical + +.. autofunction:: fd_numpy \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.float_formatter.rst b/docs/reference/generated/compas.numerical.float_formatter.rst new file mode 100644 index 00000000000..5e9e8b07939 --- /dev/null +++ b/docs/reference/generated/compas.numerical.float_formatter.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +float_formatter +================================ + +.. currentmodule:: compas.numerical + +.. autofunction:: float_formatter \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.ga.rst b/docs/reference/generated/compas.numerical.ga.rst new file mode 100644 index 00000000000..5d58f640a1a --- /dev/null +++ b/docs/reference/generated/compas.numerical.ga.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ga +=================== + +.. currentmodule:: compas.numerical + +.. autofunction:: ga \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.grad.rst b/docs/reference/generated/compas.numerical.grad.rst new file mode 100644 index 00000000000..f1ff344c16c --- /dev/null +++ b/docs/reference/generated/compas.numerical.grad.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +grad +===================== + +.. currentmodule:: compas.numerical + +.. autofunction:: grad \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.laplacian_matrix.rst b/docs/reference/generated/compas.numerical.laplacian_matrix.rst new file mode 100644 index 00000000000..965177fab44 --- /dev/null +++ b/docs/reference/generated/compas.numerical.laplacian_matrix.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +laplacian_matrix +================================= + +.. currentmodule:: compas.numerical + +.. autofunction:: laplacian_matrix \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.lufactorized.rst b/docs/reference/generated/compas.numerical.lufactorized.rst new file mode 100644 index 00000000000..26fa3956cc5 --- /dev/null +++ b/docs/reference/generated/compas.numerical.lufactorized.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +lufactorized +============================= + +.. currentmodule:: compas.numerical + +.. autofunction:: lufactorized \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.mass_matrix.rst b/docs/reference/generated/compas.numerical.mass_matrix.rst new file mode 100644 index 00000000000..476cb2efe1c --- /dev/null +++ b/docs/reference/generated/compas.numerical.mass_matrix.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +mass_matrix +============================ + +.. currentmodule:: compas.numerical + +.. autofunction:: mass_matrix \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.moga.rst b/docs/reference/generated/compas.numerical.moga.rst new file mode 100644 index 00000000000..fc3add0a49c --- /dev/null +++ b/docs/reference/generated/compas.numerical.moga.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +moga +===================== + +.. currentmodule:: compas.numerical + +.. autofunction:: moga \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.nonpivots.rst b/docs/reference/generated/compas.numerical.nonpivots.rst new file mode 100644 index 00000000000..e9462570c13 --- /dev/null +++ b/docs/reference/generated/compas.numerical.nonpivots.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +nonpivots +========================== + +.. currentmodule:: compas.numerical + +.. autofunction:: nonpivots \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.normalizerow.rst b/docs/reference/generated/compas.numerical.normalizerow.rst new file mode 100644 index 00000000000..33d11bdeced --- /dev/null +++ b/docs/reference/generated/compas.numerical.normalizerow.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +normalizerow +============================= + +.. currentmodule:: compas.numerical + +.. autofunction:: normalizerow \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.normrow.rst b/docs/reference/generated/compas.numerical.normrow.rst new file mode 100644 index 00000000000..eee10fddb51 --- /dev/null +++ b/docs/reference/generated/compas.numerical.normrow.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +normrow +======================== + +.. currentmodule:: compas.numerical + +.. autofunction:: normrow \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.nullspace.rst b/docs/reference/generated/compas.numerical.nullspace.rst new file mode 100644 index 00000000000..e3a6fc5da43 --- /dev/null +++ b/docs/reference/generated/compas.numerical.nullspace.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +nullspace +========================== + +.. currentmodule:: compas.numerical + +.. autofunction:: nullspace \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.pca_numpy.rst b/docs/reference/generated/compas.numerical.pca_numpy.rst new file mode 100644 index 00000000000..1d32cffd06e --- /dev/null +++ b/docs/reference/generated/compas.numerical.pca_numpy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +pca_numpy +========================== + +.. currentmodule:: compas.numerical + +.. autofunction:: pca_numpy \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.pivots.rst b/docs/reference/generated/compas.numerical.pivots.rst new file mode 100644 index 00000000000..82ddbeace9f --- /dev/null +++ b/docs/reference/generated/compas.numerical.pivots.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +pivots +======================= + +.. currentmodule:: compas.numerical + +.. autofunction:: pivots \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.rank.rst b/docs/reference/generated/compas.numerical.rank.rst new file mode 100644 index 00000000000..d327db69bd4 --- /dev/null +++ b/docs/reference/generated/compas.numerical.rank.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +rank +===================== + +.. currentmodule:: compas.numerical + +.. autofunction:: rank \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.rot90.rst b/docs/reference/generated/compas.numerical.rot90.rst new file mode 100644 index 00000000000..1c6951a9c20 --- /dev/null +++ b/docs/reference/generated/compas.numerical.rot90.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +rot90 +====================== + +.. currentmodule:: compas.numerical + +.. autofunction:: rot90 \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.rref.rst b/docs/reference/generated/compas.numerical.rref.rst new file mode 100644 index 00000000000..198842c8490 --- /dev/null +++ b/docs/reference/generated/compas.numerical.rref.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +rref +===================== + +.. currentmodule:: compas.numerical + +.. autofunction:: rref \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.rref_matlab.rst b/docs/reference/generated/compas.numerical.rref_matlab.rst new file mode 100644 index 00000000000..74992513cbd --- /dev/null +++ b/docs/reference/generated/compas.numerical.rref_matlab.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +rref_matlab +============================ + +.. currentmodule:: compas.numerical + +.. autofunction:: rref_matlab \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.rref_sympy.rst b/docs/reference/generated/compas.numerical.rref_sympy.rst new file mode 100644 index 00000000000..ff427c51e3e --- /dev/null +++ b/docs/reference/generated/compas.numerical.rref_sympy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +rref_sympy +=========================== + +.. currentmodule:: compas.numerical + +.. autofunction:: rref_sympy \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.scalarfield_contours_numpy.rst b/docs/reference/generated/compas.numerical.scalarfield_contours_numpy.rst new file mode 100644 index 00000000000..fea42357f46 --- /dev/null +++ b/docs/reference/generated/compas.numerical.scalarfield_contours_numpy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +scalarfield_contours_numpy +=========================================== + +.. currentmodule:: compas.numerical + +.. autofunction:: scalarfield_contours_numpy \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.set_array_print_precision.rst b/docs/reference/generated/compas.numerical.set_array_print_precision.rst new file mode 100644 index 00000000000..81e4f38a4e6 --- /dev/null +++ b/docs/reference/generated/compas.numerical.set_array_print_precision.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +set_array_print_precision +========================================== + +.. currentmodule:: compas.numerical + +.. autofunction:: set_array_print_precision \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.solve_with_known.rst b/docs/reference/generated/compas.numerical.solve_with_known.rst new file mode 100644 index 00000000000..538bb6717dd --- /dev/null +++ b/docs/reference/generated/compas.numerical.solve_with_known.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +solve_with_known +================================= + +.. currentmodule:: compas.numerical + +.. autofunction:: solve_with_known \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.spsolve_with_known.rst b/docs/reference/generated/compas.numerical.spsolve_with_known.rst new file mode 100644 index 00000000000..174196bb45b --- /dev/null +++ b/docs/reference/generated/compas.numerical.spsolve_with_known.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +spsolve_with_known +=================================== + +.. currentmodule:: compas.numerical + +.. autofunction:: spsolve_with_known \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.stiffness_matrix.rst b/docs/reference/generated/compas.numerical.stiffness_matrix.rst new file mode 100644 index 00000000000..f264ad58f84 --- /dev/null +++ b/docs/reference/generated/compas.numerical.stiffness_matrix.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +stiffness_matrix +================================= + +.. currentmodule:: compas.numerical + +.. autofunction:: stiffness_matrix \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.topop_numpy.rst b/docs/reference/generated/compas.numerical.topop_numpy.rst new file mode 100644 index 00000000000..8ee7a6d9a00 --- /dev/null +++ b/docs/reference/generated/compas.numerical.topop_numpy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +topop_numpy +============================ + +.. currentmodule:: compas.numerical + +.. autofunction:: topop_numpy \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.unset_array_print_precision.rst b/docs/reference/generated/compas.numerical.unset_array_print_precision.rst new file mode 100644 index 00000000000..f626da8e3a1 --- /dev/null +++ b/docs/reference/generated/compas.numerical.unset_array_print_precision.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +unset_array_print_precision +============================================ + +.. currentmodule:: compas.numerical + +.. autofunction:: unset_array_print_precision \ No newline at end of file diff --git a/docs/reference/generated/compas.numerical.uvw_lengths.rst b/docs/reference/generated/compas.numerical.uvw_lengths.rst new file mode 100644 index 00000000000..7ec06645acd --- /dev/null +++ b/docs/reference/generated/compas.numerical.uvw_lengths.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +uvw_lengths +============================ + +.. currentmodule:: compas.numerical + +.. autofunction:: uvw_lengths \ No newline at end of file diff --git a/docs/reference/generated/compas.plugins.IncompletePluginImplError.rst b/docs/reference/generated/compas.plugins.IncompletePluginImplError.rst new file mode 100644 index 00000000000..a762263837c --- /dev/null +++ b/docs/reference/generated/compas.plugins.IncompletePluginImplError.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +IncompletePluginImplError +======================================== + +.. currentmodule:: compas.plugins + +.. autoexception:: IncompletePluginImplError \ No newline at end of file diff --git a/docs/reference/generated/compas.plugins.PluginManager.load_plugins.rst b/docs/reference/generated/compas.plugins.PluginManager.load_plugins.rst new file mode 100644 index 00000000000..227a3bef698 --- /dev/null +++ b/docs/reference/generated/compas.plugins.PluginManager.load_plugins.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PluginManager.load_plugins +========================================= + +.. currentmodule:: compas.plugins + +.. automethod:: PluginManager.load_plugins \ No newline at end of file diff --git a/docs/reference/generated/compas.plugins.PluginManager.register_module.rst b/docs/reference/generated/compas.plugins.PluginManager.register_module.rst new file mode 100644 index 00000000000..158fb1d935a --- /dev/null +++ b/docs/reference/generated/compas.plugins.PluginManager.register_module.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PluginManager.register_module +============================================ + +.. currentmodule:: compas.plugins + +.. automethod:: PluginManager.register_module \ No newline at end of file diff --git a/docs/reference/generated/compas.plugins.PluginManager.rst b/docs/reference/generated/compas.plugins.PluginManager.rst new file mode 100644 index 00000000000..5db48dced80 --- /dev/null +++ b/docs/reference/generated/compas.plugins.PluginManager.rst @@ -0,0 +1,35 @@ +.. rst-class:: detail + + + + + + + + + + + + + +PluginManager +============= + +.. currentmodule:: compas.plugins + +.. autoclass:: PluginManager + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~PluginManager.load_plugins + ~PluginManager.register_module + + + + \ No newline at end of file diff --git a/docs/reference/generated/compas.plugins.PluginNotInstalledError.rst b/docs/reference/generated/compas.plugins.PluginNotInstalledError.rst new file mode 100644 index 00000000000..d4275093bd1 --- /dev/null +++ b/docs/reference/generated/compas.plugins.PluginNotInstalledError.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PluginNotInstalledError +====================================== + +.. currentmodule:: compas.plugins + +.. autoexception:: PluginNotInstalledError \ No newline at end of file diff --git a/docs/reference/generated/compas.plugins.pluggable.rst b/docs/reference/generated/compas.plugins.pluggable.rst new file mode 100644 index 00000000000..343a2dd5ada --- /dev/null +++ b/docs/reference/generated/compas.plugins.pluggable.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +pluggable +======================== + +.. currentmodule:: compas.plugins + +.. autofunction:: pluggable \ No newline at end of file diff --git a/docs/reference/generated/compas.plugins.plugin.rst b/docs/reference/generated/compas.plugins.plugin.rst new file mode 100644 index 00000000000..c63d110d160 --- /dev/null +++ b/docs/reference/generated/compas.plugins.plugin.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +plugin +===================== + +.. currentmodule:: compas.plugins + +.. autofunction:: plugin \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Dispatcher.on_module_imported.rst b/docs/reference/generated/compas.rpc.Dispatcher.on_module_imported.rst new file mode 100644 index 00000000000..aeee93e07b0 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Dispatcher.on_module_imported.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Dispatcher.on_module_imported +======================================== + +.. currentmodule:: compas.rpc + +.. automethod:: Dispatcher.on_module_imported \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Dispatcher.rst b/docs/reference/generated/compas.rpc.Dispatcher.rst new file mode 100644 index 00000000000..4ac496895df --- /dev/null +++ b/docs/reference/generated/compas.rpc.Dispatcher.rst @@ -0,0 +1,30 @@ +.. rst-class:: detail + + + + + + + + + +Dispatcher +========== + +.. currentmodule:: compas.rpc + +.. autoclass:: Dispatcher + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~Dispatcher.on_module_imported + + + + \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Proxy.restart_server.rst b/docs/reference/generated/compas.rpc.Proxy.restart_server.rst new file mode 100644 index 00000000000..b6b9bf215d5 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Proxy.restart_server.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Proxy.restart_server +=============================== + +.. currentmodule:: compas.rpc + +.. automethod:: Proxy.restart_server \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Proxy.rst b/docs/reference/generated/compas.rpc.Proxy.rst new file mode 100644 index 00000000000..0c75b23dc4f --- /dev/null +++ b/docs/reference/generated/compas.rpc.Proxy.rst @@ -0,0 +1,40 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + +Proxy +===== + +.. currentmodule:: compas.rpc + +.. autoclass:: Proxy + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~Proxy.restart_server + ~Proxy.start_server + ~Proxy.stop_server + + + + \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Proxy.start_server.rst b/docs/reference/generated/compas.rpc.Proxy.start_server.rst new file mode 100644 index 00000000000..d1fb8601505 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Proxy.start_server.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Proxy.start_server +============================= + +.. currentmodule:: compas.rpc + +.. automethod:: Proxy.start_server \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Proxy.stop_server.rst b/docs/reference/generated/compas.rpc.Proxy.stop_server.rst new file mode 100644 index 00000000000..b97c908e0e3 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Proxy.stop_server.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Proxy.stop_server +============================ + +.. currentmodule:: compas.rpc + +.. automethod:: Proxy.stop_server \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.RPCClientError.rst b/docs/reference/generated/compas.rpc.RPCClientError.rst new file mode 100644 index 00000000000..727c4612258 --- /dev/null +++ b/docs/reference/generated/compas.rpc.RPCClientError.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RPCClientError +========================= + +.. currentmodule:: compas.rpc + +.. autoexception:: RPCClientError \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.RPCServerError.rst b/docs/reference/generated/compas.rpc.RPCServerError.rst new file mode 100644 index 00000000000..e0ae7fce6b1 --- /dev/null +++ b/docs/reference/generated/compas.rpc.RPCServerError.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RPCServerError +========================= + +.. currentmodule:: compas.rpc + +.. autoexception:: RPCServerError \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.close_request.rst b/docs/reference/generated/compas.rpc.Server.close_request.rst new file mode 100644 index 00000000000..6821d98392c --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.close_request.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.close_request +=============================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.close_request \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.fileno.rst b/docs/reference/generated/compas.rpc.Server.fileno.rst new file mode 100644 index 00000000000..164a1a9bd37 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.fileno.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.fileno +======================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.fileno \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.finish_request.rst b/docs/reference/generated/compas.rpc.Server.finish_request.rst new file mode 100644 index 00000000000..b8918b7e488 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.finish_request.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.finish_request +================================ + +.. currentmodule:: compas.rpc + +.. automethod:: Server.finish_request \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.get_request.rst b/docs/reference/generated/compas.rpc.Server.get_request.rst new file mode 100644 index 00000000000..36702a218a9 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.get_request.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.get_request +============================= + +.. currentmodule:: compas.rpc + +.. automethod:: Server.get_request \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.handle_error.rst b/docs/reference/generated/compas.rpc.Server.handle_error.rst new file mode 100644 index 00000000000..0fabb4e8d17 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.handle_error.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.handle_error +============================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.handle_error \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.handle_request.rst b/docs/reference/generated/compas.rpc.Server.handle_request.rst new file mode 100644 index 00000000000..e1a9f212266 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.handle_request.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.handle_request +================================ + +.. currentmodule:: compas.rpc + +.. automethod:: Server.handle_request \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.handle_timeout.rst b/docs/reference/generated/compas.rpc.Server.handle_timeout.rst new file mode 100644 index 00000000000..a1f208af080 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.handle_timeout.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.handle_timeout +================================ + +.. currentmodule:: compas.rpc + +.. automethod:: Server.handle_timeout \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.ping.rst b/docs/reference/generated/compas.rpc.Server.ping.rst new file mode 100644 index 00000000000..f8be2061573 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.ping.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.ping +====================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.ping \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.process_request.rst b/docs/reference/generated/compas.rpc.Server.process_request.rst new file mode 100644 index 00000000000..3411549d43c --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.process_request.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.process_request +================================= + +.. currentmodule:: compas.rpc + +.. automethod:: Server.process_request \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.register_function.rst b/docs/reference/generated/compas.rpc.Server.register_function.rst new file mode 100644 index 00000000000..3363e508b22 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.register_function.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.register_function +=================================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.register_function \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.register_instance.rst b/docs/reference/generated/compas.rpc.Server.register_instance.rst new file mode 100644 index 00000000000..69834615fad --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.register_instance.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.register_instance +=================================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.register_instance \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.register_introspection_functions.rst b/docs/reference/generated/compas.rpc.Server.register_introspection_functions.rst new file mode 100644 index 00000000000..bb508ede176 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.register_introspection_functions.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.register_introspection_functions +================================================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.register_introspection_functions \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.register_multicall_functions.rst b/docs/reference/generated/compas.rpc.Server.register_multicall_functions.rst new file mode 100644 index 00000000000..184c877d708 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.register_multicall_functions.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.register_multicall_functions +============================================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.register_multicall_functions \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.remote_shutdown.rst b/docs/reference/generated/compas.rpc.Server.remote_shutdown.rst new file mode 100644 index 00000000000..c420603d557 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.remote_shutdown.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.remote_shutdown +================================= + +.. currentmodule:: compas.rpc + +.. automethod:: Server.remote_shutdown \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.rst b/docs/reference/generated/compas.rpc.Server.rst new file mode 100644 index 00000000000..6724e70f000 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.rst @@ -0,0 +1,162 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Server +====== + +.. currentmodule:: compas.rpc + +.. autoclass:: Server + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~Server.ping + ~Server.remote_shutdown + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~Server.close_request + ~Server.fileno + ~Server.finish_request + ~Server.get_request + ~Server.handle_error + ~Server.handle_request + ~Server.handle_timeout + ~Server.process_request + ~Server.register_function + ~Server.register_instance + ~Server.register_introspection_functions + ~Server.register_multicall_functions + ~Server.serve_forever + ~Server.server_activate + ~Server.server_bind + ~Server.server_close + ~Server.service_actions + ~Server.shutdown + ~Server.shutdown_request + ~Server.system_listMethods + ~Server.system_methodHelp + ~Server.system_methodSignature + ~Server.system_multicall + ~Server.verify_request + + \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.serve_forever.rst b/docs/reference/generated/compas.rpc.Server.serve_forever.rst new file mode 100644 index 00000000000..c7500f164e8 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.serve_forever.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.serve_forever +=============================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.serve_forever \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.server_activate.rst b/docs/reference/generated/compas.rpc.Server.server_activate.rst new file mode 100644 index 00000000000..652d6aeb25f --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.server_activate.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.server_activate +================================= + +.. currentmodule:: compas.rpc + +.. automethod:: Server.server_activate \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.server_bind.rst b/docs/reference/generated/compas.rpc.Server.server_bind.rst new file mode 100644 index 00000000000..250309bd2bb --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.server_bind.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.server_bind +============================= + +.. currentmodule:: compas.rpc + +.. automethod:: Server.server_bind \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.server_close.rst b/docs/reference/generated/compas.rpc.Server.server_close.rst new file mode 100644 index 00000000000..3483ebf7f7f --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.server_close.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.server_close +============================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.server_close \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.service_actions.rst b/docs/reference/generated/compas.rpc.Server.service_actions.rst new file mode 100644 index 00000000000..a071538756d --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.service_actions.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.service_actions +================================= + +.. currentmodule:: compas.rpc + +.. automethod:: Server.service_actions \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.shutdown.rst b/docs/reference/generated/compas.rpc.Server.shutdown.rst new file mode 100644 index 00000000000..06ecf0dc5b4 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.shutdown.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.shutdown +========================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.shutdown \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.shutdown_request.rst b/docs/reference/generated/compas.rpc.Server.shutdown_request.rst new file mode 100644 index 00000000000..376aa1441b6 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.shutdown_request.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.shutdown_request +================================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.shutdown_request \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.system_listMethods.rst b/docs/reference/generated/compas.rpc.Server.system_listMethods.rst new file mode 100644 index 00000000000..819aeb89796 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.system_listMethods.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.system_listMethods +==================================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.system_listMethods \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.system_methodHelp.rst b/docs/reference/generated/compas.rpc.Server.system_methodHelp.rst new file mode 100644 index 00000000000..83220005e1d --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.system_methodHelp.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.system_methodHelp +=================================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.system_methodHelp \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.system_methodSignature.rst b/docs/reference/generated/compas.rpc.Server.system_methodSignature.rst new file mode 100644 index 00000000000..60e6096015d --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.system_methodSignature.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.system_methodSignature +======================================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.system_methodSignature \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.system_multicall.rst b/docs/reference/generated/compas.rpc.Server.system_multicall.rst new file mode 100644 index 00000000000..822cf399888 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.system_multicall.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.system_multicall +================================== + +.. currentmodule:: compas.rpc + +.. automethod:: Server.system_multicall \ No newline at end of file diff --git a/docs/reference/generated/compas.rpc.Server.verify_request.rst b/docs/reference/generated/compas.rpc.Server.verify_request.rst new file mode 100644 index 00000000000..cf85e507a00 --- /dev/null +++ b/docs/reference/generated/compas.rpc.Server.verify_request.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +Server.verify_request +================================ + +.. currentmodule:: compas.rpc + +.. automethod:: Server.verify_request \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.adjacency_from_edges.rst b/docs/reference/generated/compas.topology.adjacency_from_edges.rst new file mode 100644 index 00000000000..6f0f910b56a --- /dev/null +++ b/docs/reference/generated/compas.topology.adjacency_from_edges.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +adjacency_from_edges +==================================== + +.. currentmodule:: compas.topology + +.. autofunction:: adjacency_from_edges \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.astar_lightest_path.rst b/docs/reference/generated/compas.topology.astar_lightest_path.rst new file mode 100644 index 00000000000..6163376a505 --- /dev/null +++ b/docs/reference/generated/compas.topology.astar_lightest_path.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +astar_lightest_path +=================================== + +.. currentmodule:: compas.topology + +.. autofunction:: astar_lightest_path \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.astar_shortest_path.rst b/docs/reference/generated/compas.topology.astar_shortest_path.rst new file mode 100644 index 00000000000..14c9371e0f5 --- /dev/null +++ b/docs/reference/generated/compas.topology.astar_shortest_path.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +astar_shortest_path +=================================== + +.. currentmodule:: compas.topology + +.. autofunction:: astar_shortest_path \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.breadth_first_ordering.rst b/docs/reference/generated/compas.topology.breadth_first_ordering.rst new file mode 100644 index 00000000000..61e564eabd8 --- /dev/null +++ b/docs/reference/generated/compas.topology.breadth_first_ordering.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +breadth_first_ordering +====================================== + +.. currentmodule:: compas.topology + +.. autofunction:: breadth_first_ordering \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.breadth_first_paths.rst b/docs/reference/generated/compas.topology.breadth_first_paths.rst new file mode 100644 index 00000000000..e15cd94787b --- /dev/null +++ b/docs/reference/generated/compas.topology.breadth_first_paths.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +breadth_first_paths +=================================== + +.. currentmodule:: compas.topology + +.. autofunction:: breadth_first_paths \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.breadth_first_traverse.rst b/docs/reference/generated/compas.topology.breadth_first_traverse.rst new file mode 100644 index 00000000000..495e9585852 --- /dev/null +++ b/docs/reference/generated/compas.topology.breadth_first_traverse.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +breadth_first_traverse +====================================== + +.. currentmodule:: compas.topology + +.. autofunction:: breadth_first_traverse \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.connected_components.rst b/docs/reference/generated/compas.topology.connected_components.rst new file mode 100644 index 00000000000..4e1e6a4f1bd --- /dev/null +++ b/docs/reference/generated/compas.topology.connected_components.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +connected_components +==================================== + +.. currentmodule:: compas.topology + +.. autofunction:: connected_components \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.depth_first_ordering.rst b/docs/reference/generated/compas.topology.depth_first_ordering.rst new file mode 100644 index 00000000000..85175a7f124 --- /dev/null +++ b/docs/reference/generated/compas.topology.depth_first_ordering.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +depth_first_ordering +==================================== + +.. currentmodule:: compas.topology + +.. autofunction:: depth_first_ordering \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.dijkstra_distances.rst b/docs/reference/generated/compas.topology.dijkstra_distances.rst new file mode 100644 index 00000000000..c118942e832 --- /dev/null +++ b/docs/reference/generated/compas.topology.dijkstra_distances.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +dijkstra_distances +================================== + +.. currentmodule:: compas.topology + +.. autofunction:: dijkstra_distances \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.dijkstra_path.rst b/docs/reference/generated/compas.topology.dijkstra_path.rst new file mode 100644 index 00000000000..5875808ab5c --- /dev/null +++ b/docs/reference/generated/compas.topology.dijkstra_path.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +dijkstra_path +============================= + +.. currentmodule:: compas.topology + +.. autofunction:: dijkstra_path \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.face_adjacency.rst b/docs/reference/generated/compas.topology.face_adjacency.rst new file mode 100644 index 00000000000..6d7292d7040 --- /dev/null +++ b/docs/reference/generated/compas.topology.face_adjacency.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +face_adjacency +============================== + +.. currentmodule:: compas.topology + +.. autofunction:: face_adjacency \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.face_adjacency_numpy.rst b/docs/reference/generated/compas.topology.face_adjacency_numpy.rst new file mode 100644 index 00000000000..f01f15829ed --- /dev/null +++ b/docs/reference/generated/compas.topology.face_adjacency_numpy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +face_adjacency_numpy +==================================== + +.. currentmodule:: compas.topology + +.. autofunction:: face_adjacency_numpy \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.shortest_path.rst b/docs/reference/generated/compas.topology.shortest_path.rst new file mode 100644 index 00000000000..0ecbaab9f86 --- /dev/null +++ b/docs/reference/generated/compas.topology.shortest_path.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +shortest_path +============================= + +.. currentmodule:: compas.topology + +.. autofunction:: shortest_path \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.unify_cycles.rst b/docs/reference/generated/compas.topology.unify_cycles.rst new file mode 100644 index 00000000000..e4cb30cc026 --- /dev/null +++ b/docs/reference/generated/compas.topology.unify_cycles.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +unify_cycles +============================ + +.. currentmodule:: compas.topology + +.. autofunction:: unify_cycles \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.unify_cycles_numpy.rst b/docs/reference/generated/compas.topology.unify_cycles_numpy.rst new file mode 100644 index 00000000000..ef065c0c1ce --- /dev/null +++ b/docs/reference/generated/compas.topology.unify_cycles_numpy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +unify_cycles_numpy +================================== + +.. currentmodule:: compas.topology + +.. autofunction:: unify_cycles_numpy \ No newline at end of file diff --git a/docs/reference/generated/compas.topology.vertex_coloring.rst b/docs/reference/generated/compas.topology.vertex_coloring.rst new file mode 100644 index 00000000000..b751df2f7ac --- /dev/null +++ b/docs/reference/generated/compas.topology.vertex_coloring.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +vertex_coloring +=============================== + +.. currentmodule:: compas.topology + +.. autofunction:: vertex_coloring \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.await_callback.rst b/docs/reference/generated/compas.utilities.await_callback.rst new file mode 100644 index 00000000000..e705d20179b --- /dev/null +++ b/docs/reference/generated/compas.utilities.await_callback.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +await_callback +=============================== + +.. currentmodule:: compas.utilities + +.. autofunction:: await_callback \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.color_to_colordict.rst b/docs/reference/generated/compas.utilities.color_to_colordict.rst new file mode 100644 index 00000000000..26662f28383 --- /dev/null +++ b/docs/reference/generated/compas.utilities.color_to_colordict.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +color_to_colordict +=================================== + +.. currentmodule:: compas.utilities + +.. autofunction:: color_to_colordict \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.color_to_rgb.rst b/docs/reference/generated/compas.utilities.color_to_rgb.rst new file mode 100644 index 00000000000..3fe0e2f4fb6 --- /dev/null +++ b/docs/reference/generated/compas.utilities.color_to_rgb.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +color_to_rgb +============================= + +.. currentmodule:: compas.utilities + +.. autofunction:: color_to_rgb \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.flatten.rst b/docs/reference/generated/compas.utilities.flatten.rst new file mode 100644 index 00000000000..57b3325f5ad --- /dev/null +++ b/docs/reference/generated/compas.utilities.flatten.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +flatten +======================== + +.. currentmodule:: compas.utilities + +.. autofunction:: flatten \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.geometric_key.rst b/docs/reference/generated/compas.utilities.geometric_key.rst new file mode 100644 index 00000000000..ceecdd8a6e3 --- /dev/null +++ b/docs/reference/generated/compas.utilities.geometric_key.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +geometric_key +============================== + +.. currentmodule:: compas.utilities + +.. autofunction:: geometric_key \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.geometric_key_xy.rst b/docs/reference/generated/compas.utilities.geometric_key_xy.rst new file mode 100644 index 00000000000..5ed96c855b5 --- /dev/null +++ b/docs/reference/generated/compas.utilities.geometric_key_xy.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +geometric_key_xy +================================= + +.. currentmodule:: compas.utilities + +.. autofunction:: geometric_key_xy \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.i_to_black.rst b/docs/reference/generated/compas.utilities.i_to_black.rst new file mode 100644 index 00000000000..c52d938b452 --- /dev/null +++ b/docs/reference/generated/compas.utilities.i_to_black.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +i_to_black +=========================== + +.. currentmodule:: compas.utilities + +.. autofunction:: i_to_black \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.i_to_blue.rst b/docs/reference/generated/compas.utilities.i_to_blue.rst new file mode 100644 index 00000000000..c51bccb566b --- /dev/null +++ b/docs/reference/generated/compas.utilities.i_to_blue.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +i_to_blue +========================== + +.. currentmodule:: compas.utilities + +.. autofunction:: i_to_blue \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.i_to_green.rst b/docs/reference/generated/compas.utilities.i_to_green.rst new file mode 100644 index 00000000000..65917f35e7b --- /dev/null +++ b/docs/reference/generated/compas.utilities.i_to_green.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +i_to_green +=========================== + +.. currentmodule:: compas.utilities + +.. autofunction:: i_to_green \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.i_to_red.rst b/docs/reference/generated/compas.utilities.i_to_red.rst new file mode 100644 index 00000000000..3d487269119 --- /dev/null +++ b/docs/reference/generated/compas.utilities.i_to_red.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +i_to_red +========================= + +.. currentmodule:: compas.utilities + +.. autofunction:: i_to_red \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.i_to_rgb.rst b/docs/reference/generated/compas.utilities.i_to_rgb.rst new file mode 100644 index 00000000000..0934b8dd8b2 --- /dev/null +++ b/docs/reference/generated/compas.utilities.i_to_rgb.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +i_to_rgb +========================= + +.. currentmodule:: compas.utilities + +.. autofunction:: i_to_rgb \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.i_to_white.rst b/docs/reference/generated/compas.utilities.i_to_white.rst new file mode 100644 index 00000000000..af74083106f --- /dev/null +++ b/docs/reference/generated/compas.utilities.i_to_white.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +i_to_white +=========================== + +.. currentmodule:: compas.utilities + +.. autofunction:: i_to_white \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.iterable_like.rst b/docs/reference/generated/compas.utilities.iterable_like.rst new file mode 100644 index 00000000000..8786917e92b --- /dev/null +++ b/docs/reference/generated/compas.utilities.iterable_like.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +iterable_like +============================== + +.. currentmodule:: compas.utilities + +.. autofunction:: iterable_like \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.linspace.rst b/docs/reference/generated/compas.utilities.linspace.rst new file mode 100644 index 00000000000..a85681a2d99 --- /dev/null +++ b/docs/reference/generated/compas.utilities.linspace.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +linspace +========================= + +.. currentmodule:: compas.utilities + +.. autofunction:: linspace \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.meshgrid.rst b/docs/reference/generated/compas.utilities.meshgrid.rst new file mode 100644 index 00000000000..0d0d6311c28 --- /dev/null +++ b/docs/reference/generated/compas.utilities.meshgrid.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +meshgrid +========================= + +.. currentmodule:: compas.utilities + +.. autofunction:: meshgrid \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.normalize_values.rst b/docs/reference/generated/compas.utilities.normalize_values.rst new file mode 100644 index 00000000000..a38b9cc887e --- /dev/null +++ b/docs/reference/generated/compas.utilities.normalize_values.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +normalize_values +================================= + +.. currentmodule:: compas.utilities + +.. autofunction:: normalize_values \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.pairwise.rst b/docs/reference/generated/compas.utilities.pairwise.rst new file mode 100644 index 00000000000..a58e8f0739d --- /dev/null +++ b/docs/reference/generated/compas.utilities.pairwise.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +pairwise +========================= + +.. currentmodule:: compas.utilities + +.. autofunction:: pairwise \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.remap_values.rst b/docs/reference/generated/compas.utilities.remap_values.rst new file mode 100644 index 00000000000..5a1d15a52b4 --- /dev/null +++ b/docs/reference/generated/compas.utilities.remap_values.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +remap_values +============================= + +.. currentmodule:: compas.utilities + +.. autofunction:: remap_values \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.reverse_geometric_key.rst b/docs/reference/generated/compas.utilities.reverse_geometric_key.rst new file mode 100644 index 00000000000..7bf97262fd1 --- /dev/null +++ b/docs/reference/generated/compas.utilities.reverse_geometric_key.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +reverse_geometric_key +====================================== + +.. currentmodule:: compas.utilities + +.. autofunction:: reverse_geometric_key \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.rgb_to_hex.rst b/docs/reference/generated/compas.utilities.rgb_to_hex.rst new file mode 100644 index 00000000000..59a41c49ace --- /dev/null +++ b/docs/reference/generated/compas.utilities.rgb_to_hex.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +rgb_to_hex +=========================== + +.. currentmodule:: compas.utilities + +.. autofunction:: rgb_to_hex \ No newline at end of file diff --git a/docs/reference/generated/compas.utilities.window.rst b/docs/reference/generated/compas.utilities.window.rst new file mode 100644 index 00000000000..b0f4f2ed3c1 --- /dev/null +++ b/docs/reference/generated/compas.utilities.window.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +window +======================= + +.. currentmodule:: compas.utilities + +.. autofunction:: window \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BlenderArtist.build.rst b/docs/reference/generated/compas_blender.artists.BlenderArtist.build.rst new file mode 100644 index 00000000000..f52bc2e6649 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BlenderArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderArtist.build +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: BlenderArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BlenderArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.BlenderArtist.build_as.rst new file mode 100644 index 00000000000..9d23a12ed29 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BlenderArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderArtist.build_as +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: BlenderArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BlenderArtist.clear.rst b/docs/reference/generated/compas_blender.artists.BlenderArtist.clear.rst new file mode 100644 index 00000000000..de710833631 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BlenderArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderArtist.clear +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: BlenderArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BlenderArtist.draw.rst b/docs/reference/generated/compas_blender.artists.BlenderArtist.draw.rst new file mode 100644 index 00000000000..f9d08ddd407 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BlenderArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderArtist.draw +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: BlenderArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BlenderArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.BlenderArtist.draw_collection.rst new file mode 100644 index 00000000000..e83e19cc3f4 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BlenderArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderArtist.draw_collection +==================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: BlenderArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BlenderArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.BlenderArtist.redraw.rst new file mode 100644 index 00000000000..fea84fc5e13 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BlenderArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderArtist.redraw +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: BlenderArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BlenderArtist.register.rst b/docs/reference/generated/compas_blender.artists.BlenderArtist.register.rst new file mode 100644 index 00000000000..213cf31f1b5 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BlenderArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderArtist.register +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: BlenderArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BlenderArtist.rst b/docs/reference/generated/compas_blender.artists.BlenderArtist.rst new file mode 100644 index 00000000000..2abdf5ba6fb --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BlenderArtist.rst @@ -0,0 +1,60 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +BlenderArtist +============= + +.. currentmodule:: compas_blender.artists + +.. autoclass:: BlenderArtist + + + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~BlenderArtist.build + ~BlenderArtist.build_as + ~BlenderArtist.clear + ~BlenderArtist.draw + ~BlenderArtist.draw_collection + ~BlenderArtist.redraw + ~BlenderArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BoxArtist.build.rst b/docs/reference/generated/compas_blender.artists.BoxArtist.build.rst new file mode 100644 index 00000000000..fcd2c6a1fcc --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BoxArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BoxArtist.build +====================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: BoxArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BoxArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.BoxArtist.build_as.rst new file mode 100644 index 00000000000..9afa880c957 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BoxArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BoxArtist.build_as +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: BoxArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BoxArtist.clear.rst b/docs/reference/generated/compas_blender.artists.BoxArtist.clear.rst new file mode 100644 index 00000000000..b95805f07cd --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BoxArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BoxArtist.clear +====================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: BoxArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BoxArtist.draw.rst b/docs/reference/generated/compas_blender.artists.BoxArtist.draw.rst new file mode 100644 index 00000000000..90cc122e540 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BoxArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BoxArtist.draw +===================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: BoxArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BoxArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.BoxArtist.draw_collection.rst new file mode 100644 index 00000000000..99a0b1a1435 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BoxArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BoxArtist.draw_collection +================================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: BoxArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BoxArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.BoxArtist.redraw.rst new file mode 100644 index 00000000000..0fa6ad2d068 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BoxArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BoxArtist.redraw +======================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: BoxArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BoxArtist.register.rst b/docs/reference/generated/compas_blender.artists.BoxArtist.register.rst new file mode 100644 index 00000000000..1757e7965ec --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BoxArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BoxArtist.register +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: BoxArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.BoxArtist.rst b/docs/reference/generated/compas_blender.artists.BoxArtist.rst new file mode 100644 index 00000000000..4903673b70e --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.BoxArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +BoxArtist +========= + +.. currentmodule:: compas_blender.artists + +.. autoclass:: BoxArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~BoxArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~BoxArtist.build + ~BoxArtist.build_as + ~BoxArtist.clear + ~BoxArtist.draw_collection + ~BoxArtist.redraw + ~BoxArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CapsuleArtist.build.rst b/docs/reference/generated/compas_blender.artists.CapsuleArtist.build.rst new file mode 100644 index 00000000000..4778227f12b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CapsuleArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CapsuleArtist.build +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CapsuleArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CapsuleArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.CapsuleArtist.build_as.rst new file mode 100644 index 00000000000..bb71ee50a6c --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CapsuleArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CapsuleArtist.build_as +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: CapsuleArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CapsuleArtist.clear.rst b/docs/reference/generated/compas_blender.artists.CapsuleArtist.clear.rst new file mode 100644 index 00000000000..157ffa25fa9 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CapsuleArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CapsuleArtist.clear +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CapsuleArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CapsuleArtist.draw.rst b/docs/reference/generated/compas_blender.artists.CapsuleArtist.draw.rst new file mode 100644 index 00000000000..d0e7ecebae7 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CapsuleArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CapsuleArtist.draw +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: CapsuleArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CapsuleArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.CapsuleArtist.draw_collection.rst new file mode 100644 index 00000000000..b02b8baa4c0 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CapsuleArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CapsuleArtist.draw_collection +==================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CapsuleArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CapsuleArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.CapsuleArtist.redraw.rst new file mode 100644 index 00000000000..ef4aa78c6c0 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CapsuleArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CapsuleArtist.redraw +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CapsuleArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CapsuleArtist.register.rst b/docs/reference/generated/compas_blender.artists.CapsuleArtist.register.rst new file mode 100644 index 00000000000..2aa40eb3924 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CapsuleArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CapsuleArtist.register +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: CapsuleArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CapsuleArtist.rst b/docs/reference/generated/compas_blender.artists.CapsuleArtist.rst new file mode 100644 index 00000000000..40863caab17 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CapsuleArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CapsuleArtist +============= + +.. currentmodule:: compas_blender.artists + +.. autoclass:: CapsuleArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~CapsuleArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~CapsuleArtist.build + ~CapsuleArtist.build_as + ~CapsuleArtist.clear + ~CapsuleArtist.draw_collection + ~CapsuleArtist.redraw + ~CapsuleArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CircleArtist.build.rst b/docs/reference/generated/compas_blender.artists.CircleArtist.build.rst new file mode 100644 index 00000000000..ecf2046a211 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CircleArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CircleArtist.build +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: CircleArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CircleArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.CircleArtist.build_as.rst new file mode 100644 index 00000000000..75f1c30cfea --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CircleArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CircleArtist.build_as +============================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: CircleArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CircleArtist.clear.rst b/docs/reference/generated/compas_blender.artists.CircleArtist.clear.rst new file mode 100644 index 00000000000..cf1cdfdc4ba --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CircleArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CircleArtist.clear +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: CircleArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CircleArtist.draw.rst b/docs/reference/generated/compas_blender.artists.CircleArtist.draw.rst new file mode 100644 index 00000000000..a12dbdebeb6 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CircleArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CircleArtist.draw +======================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CircleArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CircleArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.CircleArtist.draw_collection.rst new file mode 100644 index 00000000000..2463dba3970 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CircleArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CircleArtist.draw_collection +=================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CircleArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CircleArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.CircleArtist.redraw.rst new file mode 100644 index 00000000000..673ff6ba96d --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CircleArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CircleArtist.redraw +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CircleArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CircleArtist.register.rst b/docs/reference/generated/compas_blender.artists.CircleArtist.register.rst new file mode 100644 index 00000000000..4167065f260 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CircleArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CircleArtist.register +============================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: CircleArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CircleArtist.rst b/docs/reference/generated/compas_blender.artists.CircleArtist.rst new file mode 100644 index 00000000000..e27a05943e6 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CircleArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CircleArtist +============ + +.. currentmodule:: compas_blender.artists + +.. autoclass:: CircleArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~CircleArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~CircleArtist.build + ~CircleArtist.build_as + ~CircleArtist.clear + ~CircleArtist.draw_collection + ~CircleArtist.redraw + ~CircleArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.ConeArtist.build.rst b/docs/reference/generated/compas_blender.artists.ConeArtist.build.rst new file mode 100644 index 00000000000..81e04ce60de --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.ConeArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ConeArtist.build +======================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: ConeArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.ConeArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.ConeArtist.build_as.rst new file mode 100644 index 00000000000..f5236194ac7 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.ConeArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ConeArtist.build_as +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: ConeArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.ConeArtist.clear.rst b/docs/reference/generated/compas_blender.artists.ConeArtist.clear.rst new file mode 100644 index 00000000000..fcc2fbb2f8c --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.ConeArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ConeArtist.clear +======================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: ConeArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.ConeArtist.draw.rst b/docs/reference/generated/compas_blender.artists.ConeArtist.draw.rst new file mode 100644 index 00000000000..22e72faec0b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.ConeArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ConeArtist.draw +====================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: ConeArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.ConeArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.ConeArtist.draw_collection.rst new file mode 100644 index 00000000000..67d6e049ea8 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.ConeArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ConeArtist.draw_collection +================================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: ConeArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.ConeArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.ConeArtist.redraw.rst new file mode 100644 index 00000000000..59405e46375 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.ConeArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ConeArtist.redraw +======================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: ConeArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.ConeArtist.register.rst b/docs/reference/generated/compas_blender.artists.ConeArtist.register.rst new file mode 100644 index 00000000000..08c583ea6b6 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.ConeArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +ConeArtist.register +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: ConeArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.ConeArtist.rst b/docs/reference/generated/compas_blender.artists.ConeArtist.rst new file mode 100644 index 00000000000..9485d447696 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.ConeArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ConeArtist +========== + +.. currentmodule:: compas_blender.artists + +.. autoclass:: ConeArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~ConeArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~ConeArtist.build + ~ConeArtist.build_as + ~ConeArtist.clear + ~ConeArtist.draw_collection + ~ConeArtist.redraw + ~ConeArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CurveArtist.build.rst b/docs/reference/generated/compas_blender.artists.CurveArtist.build.rst new file mode 100644 index 00000000000..74e2638359b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CurveArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.build +======================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CurveArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CurveArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.CurveArtist.build_as.rst new file mode 100644 index 00000000000..1d54d495f72 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CurveArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.build_as +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CurveArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CurveArtist.clear.rst b/docs/reference/generated/compas_blender.artists.CurveArtist.clear.rst new file mode 100644 index 00000000000..326518e02bd --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CurveArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.clear +======================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CurveArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CurveArtist.draw.rst b/docs/reference/generated/compas_blender.artists.CurveArtist.draw.rst new file mode 100644 index 00000000000..82421b2a6d1 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CurveArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.draw +======================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: CurveArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CurveArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.CurveArtist.draw_collection.rst new file mode 100644 index 00000000000..78800551fb8 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CurveArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.draw_collection +================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CurveArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CurveArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.CurveArtist.redraw.rst new file mode 100644 index 00000000000..4706dbafc66 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CurveArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.redraw +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: CurveArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CurveArtist.register.rst b/docs/reference/generated/compas_blender.artists.CurveArtist.register.rst new file mode 100644 index 00000000000..2e6b79e8e92 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CurveArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CurveArtist.register +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CurveArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CurveArtist.rst b/docs/reference/generated/compas_blender.artists.CurveArtist.rst new file mode 100644 index 00000000000..529577f6d08 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CurveArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CurveArtist +=========== + +.. currentmodule:: compas_blender.artists + +.. autoclass:: CurveArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~CurveArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~CurveArtist.build + ~CurveArtist.build_as + ~CurveArtist.clear + ~CurveArtist.draw_collection + ~CurveArtist.redraw + ~CurveArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CylinderArtist.build.rst b/docs/reference/generated/compas_blender.artists.CylinderArtist.build.rst new file mode 100644 index 00000000000..01b4ca015cd --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CylinderArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CylinderArtist.build +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CylinderArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CylinderArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.CylinderArtist.build_as.rst new file mode 100644 index 00000000000..f8d427f5590 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CylinderArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CylinderArtist.build_as +============================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CylinderArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CylinderArtist.clear.rst b/docs/reference/generated/compas_blender.artists.CylinderArtist.clear.rst new file mode 100644 index 00000000000..1b0737f452a --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CylinderArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CylinderArtist.clear +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CylinderArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CylinderArtist.draw.rst b/docs/reference/generated/compas_blender.artists.CylinderArtist.draw.rst new file mode 100644 index 00000000000..6240598d94f --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CylinderArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CylinderArtist.draw +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CylinderArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CylinderArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.CylinderArtist.draw_collection.rst new file mode 100644 index 00000000000..148ec70bcbe --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CylinderArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CylinderArtist.draw_collection +===================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CylinderArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CylinderArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.CylinderArtist.redraw.rst new file mode 100644 index 00000000000..63479fcf150 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CylinderArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CylinderArtist.redraw +============================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: CylinderArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CylinderArtist.register.rst b/docs/reference/generated/compas_blender.artists.CylinderArtist.register.rst new file mode 100644 index 00000000000..5ee7d4fe697 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CylinderArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +CylinderArtist.register +============================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: CylinderArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.CylinderArtist.rst b/docs/reference/generated/compas_blender.artists.CylinderArtist.rst new file mode 100644 index 00000000000..d99cc0d1249 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.CylinderArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CylinderArtist +============== + +.. currentmodule:: compas_blender.artists + +.. autoclass:: CylinderArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~CylinderArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~CylinderArtist.build + ~CylinderArtist.build_as + ~CylinderArtist.clear + ~CylinderArtist.draw_collection + ~CylinderArtist.redraw + ~CylinderArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.FrameArtist.build.rst b/docs/reference/generated/compas_blender.artists.FrameArtist.build.rst new file mode 100644 index 00000000000..920325d72e1 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.FrameArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +FrameArtist.build +======================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: FrameArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.FrameArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.FrameArtist.build_as.rst new file mode 100644 index 00000000000..8bcf4e06753 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.FrameArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +FrameArtist.build_as +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: FrameArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.FrameArtist.clear.rst b/docs/reference/generated/compas_blender.artists.FrameArtist.clear.rst new file mode 100644 index 00000000000..48ab08345fe --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.FrameArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +FrameArtist.clear +======================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: FrameArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.FrameArtist.draw.rst b/docs/reference/generated/compas_blender.artists.FrameArtist.draw.rst new file mode 100644 index 00000000000..8c3e739cb8c --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.FrameArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +FrameArtist.draw +======================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: FrameArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.FrameArtist.draw_axes.rst b/docs/reference/generated/compas_blender.artists.FrameArtist.draw_axes.rst new file mode 100644 index 00000000000..da439af53e6 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.FrameArtist.draw_axes.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +FrameArtist.draw_axes +============================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: FrameArtist.draw_axes \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.FrameArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.FrameArtist.draw_collection.rst new file mode 100644 index 00000000000..e079b94cf9c --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.FrameArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +FrameArtist.draw_collection +================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: FrameArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.FrameArtist.draw_origin.rst b/docs/reference/generated/compas_blender.artists.FrameArtist.draw_origin.rst new file mode 100644 index 00000000000..5f632202153 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.FrameArtist.draw_origin.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +FrameArtist.draw_origin +============================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: FrameArtist.draw_origin \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.FrameArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.FrameArtist.redraw.rst new file mode 100644 index 00000000000..47e7afd845b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.FrameArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +FrameArtist.redraw +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: FrameArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.FrameArtist.register.rst b/docs/reference/generated/compas_blender.artists.FrameArtist.register.rst new file mode 100644 index 00000000000..436d015c92e --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.FrameArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +FrameArtist.register +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: FrameArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.FrameArtist.rst b/docs/reference/generated/compas_blender.artists.FrameArtist.rst new file mode 100644 index 00000000000..95230e648c3 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.FrameArtist.rst @@ -0,0 +1,77 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +FrameArtist +=========== + +.. currentmodule:: compas_blender.artists + +.. autoclass:: FrameArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~FrameArtist.draw + ~FrameArtist.draw_axes + ~FrameArtist.draw_origin + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~FrameArtist.build + ~FrameArtist.build_as + ~FrameArtist.clear + ~FrameArtist.draw_collection + ~FrameArtist.redraw + ~FrameArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.LineArtist.build.rst b/docs/reference/generated/compas_blender.artists.LineArtist.build.rst new file mode 100644 index 00000000000..b6967ec0bf9 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.LineArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +LineArtist.build +======================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: LineArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.LineArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.LineArtist.build_as.rst new file mode 100644 index 00000000000..9fa6f748d0d --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.LineArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +LineArtist.build_as +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: LineArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.LineArtist.clear.rst b/docs/reference/generated/compas_blender.artists.LineArtist.clear.rst new file mode 100644 index 00000000000..02a53e0b4f1 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.LineArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +LineArtist.clear +======================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: LineArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.LineArtist.draw.rst b/docs/reference/generated/compas_blender.artists.LineArtist.draw.rst new file mode 100644 index 00000000000..ab5d131ff83 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.LineArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +LineArtist.draw +====================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: LineArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.LineArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.LineArtist.draw_collection.rst new file mode 100644 index 00000000000..dbad34df696 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.LineArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +LineArtist.draw_collection +================================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: LineArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.LineArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.LineArtist.redraw.rst new file mode 100644 index 00000000000..8215b40954a --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.LineArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +LineArtist.redraw +======================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: LineArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.LineArtist.register.rst b/docs/reference/generated/compas_blender.artists.LineArtist.register.rst new file mode 100644 index 00000000000..69a8d7b17a8 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.LineArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +LineArtist.register +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: LineArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.LineArtist.rst b/docs/reference/generated/compas_blender.artists.LineArtist.rst new file mode 100644 index 00000000000..e476866284b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.LineArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +LineArtist +========== + +.. currentmodule:: compas_blender.artists + +.. autoclass:: LineArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~LineArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~LineArtist.build + ~LineArtist.build_as + ~LineArtist.clear + ~LineArtist.draw_collection + ~LineArtist.redraw + ~LineArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.build.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.build.rst new file mode 100644 index 00000000000..a664496be6e --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.build +======================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.build_as.rst new file mode 100644 index 00000000000..7404c83f4fc --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.build_as +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.clear.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.clear.rst new file mode 100644 index 00000000000..f0f9a9fc631 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.clear +======================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.clear_edges.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.clear_edges.rst new file mode 100644 index 00000000000..7f549a12f21 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.clear_edges.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.clear_edges +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.clear_edges \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.clear_faces.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.clear_faces.rst new file mode 100644 index 00000000000..f273f9b179b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.clear_faces.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.clear_faces +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.clear_faces \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.clear_vertices.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.clear_vertices.rst new file mode 100644 index 00000000000..f4557b172dc --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.clear_vertices.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.clear_vertices +================================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.clear_vertices \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.draw.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.draw.rst new file mode 100644 index 00000000000..e2e29280a78 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw +====================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_collection.rst new file mode 100644 index 00000000000..035ea73ce39 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_collection +================================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.draw_edgelabels.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_edgelabels.rst new file mode 100644 index 00000000000..f6fce4a3ad5 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_edgelabels.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_edgelabels +================================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.draw_edgelabels \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.draw_edges.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_edges.rst new file mode 100644 index 00000000000..855ef45d25b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_edges.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_edges +============================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.draw_edges \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.draw_facelabels.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_facelabels.rst new file mode 100644 index 00000000000..11e2578fb3d --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_facelabels.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_facelabels +================================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.draw_facelabels \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.draw_facenormals.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_facenormals.rst new file mode 100644 index 00000000000..5ea22803cc5 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_facenormals.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_facenormals +================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.draw_facenormals \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.draw_faces.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_faces.rst new file mode 100644 index 00000000000..a87d70414bc --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_faces.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_faces +============================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.draw_faces \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.draw_mesh.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_mesh.rst new file mode 100644 index 00000000000..ec7db4c1304 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_mesh.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_mesh +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.draw_mesh \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.draw_vertexlabels.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_vertexlabels.rst new file mode 100644 index 00000000000..b3c191b502b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_vertexlabels.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_vertexlabels +=================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.draw_vertexlabels \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.draw_vertexnormals.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_vertexnormals.rst new file mode 100644 index 00000000000..bc5f1e1c29e --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_vertexnormals.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_vertexnormals +==================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.draw_vertexnormals \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.draw_vertices.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_vertices.rst new file mode 100644 index 00000000000..f9845869b0b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.draw_vertices.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.draw_vertices +=============================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.draw_vertices \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.redraw.rst new file mode 100644 index 00000000000..8e168b5777a --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.redraw +======================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.register.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.register.rst new file mode 100644 index 00000000000..f34e9259acd --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +MeshArtist.register +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: MeshArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.MeshArtist.rst b/docs/reference/generated/compas_blender.artists.MeshArtist.rst new file mode 100644 index 00000000000..63262b2e65a --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.MeshArtist.rst @@ -0,0 +1,127 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +MeshArtist +========== + +.. currentmodule:: compas_blender.artists + +.. autoclass:: MeshArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~MeshArtist.clear + ~MeshArtist.clear_edges + ~MeshArtist.clear_faces + ~MeshArtist.clear_vertices + ~MeshArtist.draw + ~MeshArtist.draw_edgelabels + ~MeshArtist.draw_edges + ~MeshArtist.draw_facelabels + ~MeshArtist.draw_facenormals + ~MeshArtist.draw_faces + ~MeshArtist.draw_vertexlabels + ~MeshArtist.draw_vertexnormals + ~MeshArtist.draw_vertices + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~MeshArtist.build + ~MeshArtist.build_as + ~MeshArtist.draw_collection + ~MeshArtist.draw_mesh + ~MeshArtist.redraw + ~MeshArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.build.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.build.rst new file mode 100644 index 00000000000..7d702218cc1 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.build +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.build_as.rst new file mode 100644 index 00000000000..007bc7fbecb --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.build_as +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.clear.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.clear.rst new file mode 100644 index 00000000000..712daee77c0 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.clear +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.clear_edgelabels.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.clear_edgelabels.rst new file mode 100644 index 00000000000..6f489f9445f --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.clear_edgelabels.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.clear_edgelabels +===================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.clear_edgelabels \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.clear_edges.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.clear_edges.rst new file mode 100644 index 00000000000..b0838868851 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.clear_edges.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.clear_edges +================================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.clear_edges \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.clear_nodelabels.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.clear_nodelabels.rst new file mode 100644 index 00000000000..fb1046c41f5 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.clear_nodelabels.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.clear_nodelabels +===================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.clear_nodelabels \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.clear_nodes.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.clear_nodes.rst new file mode 100644 index 00000000000..7310ad6af90 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.clear_nodes.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.clear_nodes +================================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.clear_nodes \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.draw.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.draw.rst new file mode 100644 index 00000000000..5101d5d530c --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.draw +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_collection.rst new file mode 100644 index 00000000000..e0668965162 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.draw_collection +==================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_edgelabels.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_edgelabels.rst new file mode 100644 index 00000000000..629a421b5e7 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_edgelabels.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.draw_edgelabels +==================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.draw_edgelabels \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_edges.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_edges.rst new file mode 100644 index 00000000000..beb9e2b3a5f --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_edges.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.draw_edges +=============================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.draw_edges \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_nodelabels.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_nodelabels.rst new file mode 100644 index 00000000000..48fc4db2787 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_nodelabels.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.draw_nodelabels +==================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.draw_nodelabels \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_nodes.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_nodes.rst new file mode 100644 index 00000000000..db0b8a6d8d8 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.draw_nodes.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.draw_nodes +=============================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.draw_nodes \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.redraw.rst new file mode 100644 index 00000000000..7b95e4a7b90 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.redraw +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.register.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.register.rst new file mode 100644 index 00000000000..1dab0cdcedf --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +NetworkArtist.register +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: NetworkArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.NetworkArtist.rst b/docs/reference/generated/compas_blender.artists.NetworkArtist.rst new file mode 100644 index 00000000000..ec65ebfc8a1 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.NetworkArtist.rst @@ -0,0 +1,107 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +NetworkArtist +============= + +.. currentmodule:: compas_blender.artists + +.. autoclass:: NetworkArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~NetworkArtist.clear_edgelabels + ~NetworkArtist.clear_edges + ~NetworkArtist.clear_nodelabels + ~NetworkArtist.clear_nodes + ~NetworkArtist.draw + ~NetworkArtist.draw_edgelabels + ~NetworkArtist.draw_edges + ~NetworkArtist.draw_nodelabels + ~NetworkArtist.draw_nodes + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~NetworkArtist.build + ~NetworkArtist.build_as + ~NetworkArtist.clear + ~NetworkArtist.draw_collection + ~NetworkArtist.redraw + ~NetworkArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PointArtist.build.rst b/docs/reference/generated/compas_blender.artists.PointArtist.build.rst new file mode 100644 index 00000000000..8a8d87722b1 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PointArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PointArtist.build +======================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PointArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PointArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.PointArtist.build_as.rst new file mode 100644 index 00000000000..1f63c4208bf --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PointArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PointArtist.build_as +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PointArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PointArtist.clear.rst b/docs/reference/generated/compas_blender.artists.PointArtist.clear.rst new file mode 100644 index 00000000000..00655d4a91b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PointArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PointArtist.clear +======================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PointArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PointArtist.draw.rst b/docs/reference/generated/compas_blender.artists.PointArtist.draw.rst new file mode 100644 index 00000000000..92dc4d8dcc6 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PointArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PointArtist.draw +======================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: PointArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PointArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.PointArtist.draw_collection.rst new file mode 100644 index 00000000000..06b670ab0f3 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PointArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PointArtist.draw_collection +================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PointArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PointArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.PointArtist.redraw.rst new file mode 100644 index 00000000000..37f802264a0 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PointArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PointArtist.redraw +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: PointArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PointArtist.register.rst b/docs/reference/generated/compas_blender.artists.PointArtist.register.rst new file mode 100644 index 00000000000..da3205e0bc7 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PointArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PointArtist.register +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PointArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PointArtist.rst b/docs/reference/generated/compas_blender.artists.PointArtist.rst new file mode 100644 index 00000000000..c84554c0ee7 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PointArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +PointArtist +=========== + +.. currentmodule:: compas_blender.artists + +.. autoclass:: PointArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~PointArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~PointArtist.build + ~PointArtist.build_as + ~PointArtist.clear + ~PointArtist.draw_collection + ~PointArtist.redraw + ~PointArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolygonArtist.build.rst b/docs/reference/generated/compas_blender.artists.PolygonArtist.build.rst new file mode 100644 index 00000000000..6c671c3961d --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolygonArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolygonArtist.build +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolygonArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolygonArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.PolygonArtist.build_as.rst new file mode 100644 index 00000000000..8198fc92d36 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolygonArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolygonArtist.build_as +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolygonArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolygonArtist.clear.rst b/docs/reference/generated/compas_blender.artists.PolygonArtist.clear.rst new file mode 100644 index 00000000000..f850f6b8f8e --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolygonArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolygonArtist.clear +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolygonArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolygonArtist.draw.rst b/docs/reference/generated/compas_blender.artists.PolygonArtist.draw.rst new file mode 100644 index 00000000000..ea917225853 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolygonArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolygonArtist.draw +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolygonArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolygonArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.PolygonArtist.draw_collection.rst new file mode 100644 index 00000000000..f6d9f4c65e9 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolygonArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolygonArtist.draw_collection +==================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolygonArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolygonArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.PolygonArtist.redraw.rst new file mode 100644 index 00000000000..8fdfcce13c1 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolygonArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolygonArtist.redraw +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolygonArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolygonArtist.register.rst b/docs/reference/generated/compas_blender.artists.PolygonArtist.register.rst new file mode 100644 index 00000000000..f90da396b30 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolygonArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolygonArtist.register +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolygonArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolygonArtist.rst b/docs/reference/generated/compas_blender.artists.PolygonArtist.rst new file mode 100644 index 00000000000..285842c788c --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolygonArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +PolygonArtist +============= + +.. currentmodule:: compas_blender.artists + +.. autoclass:: PolygonArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~PolygonArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~PolygonArtist.build + ~PolygonArtist.build_as + ~PolygonArtist.clear + ~PolygonArtist.draw_collection + ~PolygonArtist.redraw + ~PolygonArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolyhedronArtist.build.rst b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.build.rst new file mode 100644 index 00000000000..243758e563c --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolyhedronArtist.build +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolyhedronArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolyhedronArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.build_as.rst new file mode 100644 index 00000000000..52c771f14c4 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolyhedronArtist.build_as +================================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolyhedronArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolyhedronArtist.clear.rst b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.clear.rst new file mode 100644 index 00000000000..9ec8946735f --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolyhedronArtist.clear +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolyhedronArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolyhedronArtist.draw.rst b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.draw.rst new file mode 100644 index 00000000000..47810f26f6b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolyhedronArtist.draw +============================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolyhedronArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolyhedronArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.draw_collection.rst new file mode 100644 index 00000000000..4d0d0db1db3 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolyhedronArtist.draw_collection +======================================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolyhedronArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolyhedronArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.redraw.rst new file mode 100644 index 00000000000..8e86803debc --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolyhedronArtist.redraw +============================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolyhedronArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolyhedronArtist.register.rst b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.register.rst new file mode 100644 index 00000000000..434b8c4726b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolyhedronArtist.register +================================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolyhedronArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolyhedronArtist.rst b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.rst new file mode 100644 index 00000000000..da1ad3f14d4 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolyhedronArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +PolyhedronArtist +================ + +.. currentmodule:: compas_blender.artists + +.. autoclass:: PolyhedronArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~PolyhedronArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~PolyhedronArtist.build + ~PolyhedronArtist.build_as + ~PolyhedronArtist.clear + ~PolyhedronArtist.draw_collection + ~PolyhedronArtist.redraw + ~PolyhedronArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolylineArtist.build.rst b/docs/reference/generated/compas_blender.artists.PolylineArtist.build.rst new file mode 100644 index 00000000000..faf4ab7103a --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolylineArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolylineArtist.build +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolylineArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolylineArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.PolylineArtist.build_as.rst new file mode 100644 index 00000000000..37f26c2f3e5 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolylineArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolylineArtist.build_as +============================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolylineArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolylineArtist.clear.rst b/docs/reference/generated/compas_blender.artists.PolylineArtist.clear.rst new file mode 100644 index 00000000000..a7fafbd16c8 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolylineArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolylineArtist.clear +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolylineArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolylineArtist.draw.rst b/docs/reference/generated/compas_blender.artists.PolylineArtist.draw.rst new file mode 100644 index 00000000000..0c62070cc0e --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolylineArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolylineArtist.draw +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolylineArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolylineArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.PolylineArtist.draw_collection.rst new file mode 100644 index 00000000000..f222c5bc5e3 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolylineArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolylineArtist.draw_collection +===================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolylineArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolylineArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.PolylineArtist.redraw.rst new file mode 100644 index 00000000000..5c163ab29fe --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolylineArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolylineArtist.redraw +============================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolylineArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolylineArtist.register.rst b/docs/reference/generated/compas_blender.artists.PolylineArtist.register.rst new file mode 100644 index 00000000000..3744845aaba --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolylineArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +PolylineArtist.register +============================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: PolylineArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.PolylineArtist.rst b/docs/reference/generated/compas_blender.artists.PolylineArtist.rst new file mode 100644 index 00000000000..ce6d8f113aa --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.PolylineArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +PolylineArtist +============== + +.. currentmodule:: compas_blender.artists + +.. autoclass:: PolylineArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~PolylineArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~PolylineArtist.build + ~PolylineArtist.build_as + ~PolylineArtist.clear + ~PolylineArtist.draw_collection + ~PolylineArtist.redraw + ~PolylineArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.attach_mesh.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.attach_mesh.rst new file mode 100644 index 00000000000..bd1183f5e34 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.attach_mesh.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.attach_mesh +=================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.attach_mesh \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.attach_tool_model.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.attach_tool_model.rst new file mode 100644 index 00000000000..f14f9fdc753 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.attach_tool_model.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.attach_tool_model +========================================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.attach_tool_model \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.build.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.build.rst new file mode 100644 index 00000000000..71e0275f614 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.build +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.build_as.rst new file mode 100644 index 00000000000..1a0ab4da33f --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.build_as +================================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.clear.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.clear.rst new file mode 100644 index 00000000000..aaa301d52fd --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.clear +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.create.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.create.rst new file mode 100644 index 00000000000..fc8bcd906a5 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.create.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.create +============================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.create \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.create_geometry.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.create_geometry.rst new file mode 100644 index 00000000000..0d352321125 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.create_geometry.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.create_geometry +======================================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.create_geometry \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.detach_mesh.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.detach_mesh.rst new file mode 100644 index 00000000000..dee1a883492 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.detach_mesh.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.detach_mesh +=================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.detach_mesh \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.detach_tool_model.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.detach_tool_model.rst new file mode 100644 index 00000000000..35187d0f868 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.detach_tool_model.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.detach_tool_model +========================================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.detach_tool_model \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw.rst new file mode 100644 index 00000000000..dc3a6484dc5 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.draw +============================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw_attached_meshes.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw_attached_meshes.rst new file mode 100644 index 00000000000..c9e0c4b7320 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw_attached_meshes.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.draw_attached_meshes +============================================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.draw_attached_meshes \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw_collection.rst new file mode 100644 index 00000000000..9c567fdc442 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.draw_collection +======================================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw_collision.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw_collision.rst new file mode 100644 index 00000000000..a69527f8584 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw_collision.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.draw_collision +====================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.draw_collision \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw_visual.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw_visual.rst new file mode 100644 index 00000000000..e1d18758db8 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.draw_visual.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.draw_visual +=================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.draw_visual \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.meshes.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.meshes.rst new file mode 100644 index 00000000000..069602709d6 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.meshes.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.meshes +============================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.meshes \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.redraw.rst new file mode 100644 index 00000000000..b715904a978 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.redraw +============================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.register.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.register.rst new file mode 100644 index 00000000000..eb9972cd75b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.register +================================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.rst new file mode 100644 index 00000000000..10fc33582ad --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.rst @@ -0,0 +1,142 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +RobotModelArtist +================ + +.. currentmodule:: compas_blender.artists + +.. autoclass:: RobotModelArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~RobotModelArtist.create_geometry + ~RobotModelArtist.draw + ~RobotModelArtist.draw_attached_meshes + ~RobotModelArtist.draw_collision + ~RobotModelArtist.draw_visual + ~RobotModelArtist.transform + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~RobotModelArtist.attach_mesh + ~RobotModelArtist.attach_tool_model + ~RobotModelArtist.build + ~RobotModelArtist.build_as + ~RobotModelArtist.clear + ~RobotModelArtist.create + ~RobotModelArtist.detach_mesh + ~RobotModelArtist.detach_tool_model + ~RobotModelArtist.draw_collection + ~RobotModelArtist.meshes + ~RobotModelArtist.redraw + ~RobotModelArtist.register + ~RobotModelArtist.scale + ~RobotModelArtist.scale_link + ~RobotModelArtist.update + ~RobotModelArtist.update_tool + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.scale.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.scale.rst new file mode 100644 index 00000000000..067e81df759 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.scale.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.scale +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.scale \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.scale_link.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.scale_link.rst new file mode 100644 index 00000000000..6b6b4523098 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.scale_link.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.scale_link +================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.scale_link \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.transform.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.transform.rst new file mode 100644 index 00000000000..46cd4c20e75 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.transform.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.transform +================================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.transform \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.update.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.update.rst new file mode 100644 index 00000000000..ddbc01bc868 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.update.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.update +============================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.update \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.RobotModelArtist.update_tool.rst b/docs/reference/generated/compas_blender.artists.RobotModelArtist.update_tool.rst new file mode 100644 index 00000000000..c660a7b872c --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.RobotModelArtist.update_tool.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +RobotModelArtist.update_tool +=================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: RobotModelArtist.update_tool \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SphereArtist.build.rst b/docs/reference/generated/compas_blender.artists.SphereArtist.build.rst new file mode 100644 index 00000000000..53cdbdbc073 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SphereArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SphereArtist.build +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: SphereArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SphereArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.SphereArtist.build_as.rst new file mode 100644 index 00000000000..ff52f6d6f1e --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SphereArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SphereArtist.build_as +============================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: SphereArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SphereArtist.clear.rst b/docs/reference/generated/compas_blender.artists.SphereArtist.clear.rst new file mode 100644 index 00000000000..1ed9c813150 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SphereArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SphereArtist.clear +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: SphereArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SphereArtist.draw.rst b/docs/reference/generated/compas_blender.artists.SphereArtist.draw.rst new file mode 100644 index 00000000000..c879017803a --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SphereArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SphereArtist.draw +======================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: SphereArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SphereArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.SphereArtist.draw_collection.rst new file mode 100644 index 00000000000..a2b37059d67 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SphereArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SphereArtist.draw_collection +=================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: SphereArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SphereArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.SphereArtist.redraw.rst new file mode 100644 index 00000000000..e86d61f52ce --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SphereArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SphereArtist.redraw +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: SphereArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SphereArtist.register.rst b/docs/reference/generated/compas_blender.artists.SphereArtist.register.rst new file mode 100644 index 00000000000..688d81243b1 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SphereArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SphereArtist.register +============================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: SphereArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SphereArtist.rst b/docs/reference/generated/compas_blender.artists.SphereArtist.rst new file mode 100644 index 00000000000..276649413e5 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SphereArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +SphereArtist +============ + +.. currentmodule:: compas_blender.artists + +.. autoclass:: SphereArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~SphereArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~SphereArtist.build + ~SphereArtist.build_as + ~SphereArtist.clear + ~SphereArtist.draw_collection + ~SphereArtist.redraw + ~SphereArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SurfaceArtist.build.rst b/docs/reference/generated/compas_blender.artists.SurfaceArtist.build.rst new file mode 100644 index 00000000000..35245f0c052 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SurfaceArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.build +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: SurfaceArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SurfaceArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.SurfaceArtist.build_as.rst new file mode 100644 index 00000000000..1cf2cb82577 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SurfaceArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.build_as +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: SurfaceArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SurfaceArtist.clear.rst b/docs/reference/generated/compas_blender.artists.SurfaceArtist.clear.rst new file mode 100644 index 00000000000..ddc91ea22e2 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SurfaceArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.clear +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: SurfaceArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SurfaceArtist.draw.rst b/docs/reference/generated/compas_blender.artists.SurfaceArtist.draw.rst new file mode 100644 index 00000000000..3932646e927 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SurfaceArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.draw +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: SurfaceArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SurfaceArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.SurfaceArtist.draw_collection.rst new file mode 100644 index 00000000000..0d6725886fc --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SurfaceArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.draw_collection +==================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: SurfaceArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SurfaceArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.SurfaceArtist.redraw.rst new file mode 100644 index 00000000000..d9d705cf03c --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SurfaceArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.redraw +=========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: SurfaceArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SurfaceArtist.register.rst b/docs/reference/generated/compas_blender.artists.SurfaceArtist.register.rst new file mode 100644 index 00000000000..50df5520b0b --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SurfaceArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +SurfaceArtist.register +============================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: SurfaceArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.SurfaceArtist.rst b/docs/reference/generated/compas_blender.artists.SurfaceArtist.rst new file mode 100644 index 00000000000..578cfbe2dcb --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.SurfaceArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +SurfaceArtist +============= + +.. currentmodule:: compas_blender.artists + +.. autoclass:: SurfaceArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~SurfaceArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~SurfaceArtist.build + ~SurfaceArtist.build_as + ~SurfaceArtist.clear + ~SurfaceArtist.draw_collection + ~SurfaceArtist.redraw + ~SurfaceArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.VectorArtist.build.rst b/docs/reference/generated/compas_blender.artists.VectorArtist.build.rst new file mode 100644 index 00000000000..3c8026cd2cd --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.VectorArtist.build.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VectorArtist.build +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: VectorArtist.build \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.VectorArtist.build_as.rst b/docs/reference/generated/compas_blender.artists.VectorArtist.build_as.rst new file mode 100644 index 00000000000..e8798d8938e --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.VectorArtist.build_as.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VectorArtist.build_as +============================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: VectorArtist.build_as \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.VectorArtist.clear.rst b/docs/reference/generated/compas_blender.artists.VectorArtist.clear.rst new file mode 100644 index 00000000000..f003b023a47 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.VectorArtist.clear.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VectorArtist.clear +========================================= + +.. currentmodule:: compas_blender.artists + +.. automethod:: VectorArtist.clear \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.VectorArtist.draw.rst b/docs/reference/generated/compas_blender.artists.VectorArtist.draw.rst new file mode 100644 index 00000000000..1a957b19474 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.VectorArtist.draw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VectorArtist.draw +======================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: VectorArtist.draw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.VectorArtist.draw_collection.rst b/docs/reference/generated/compas_blender.artists.VectorArtist.draw_collection.rst new file mode 100644 index 00000000000..ad39bc4012d --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.VectorArtist.draw_collection.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VectorArtist.draw_collection +=================================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: VectorArtist.draw_collection \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.VectorArtist.redraw.rst b/docs/reference/generated/compas_blender.artists.VectorArtist.redraw.rst new file mode 100644 index 00000000000..49c98cd46a6 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.VectorArtist.redraw.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VectorArtist.redraw +========================================== + +.. currentmodule:: compas_blender.artists + +.. automethod:: VectorArtist.redraw \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.VectorArtist.register.rst b/docs/reference/generated/compas_blender.artists.VectorArtist.register.rst new file mode 100644 index 00000000000..04a9f77e8f2 --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.VectorArtist.register.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +VectorArtist.register +============================================ + +.. currentmodule:: compas_blender.artists + +.. automethod:: VectorArtist.register \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.artists.VectorArtist.rst b/docs/reference/generated/compas_blender.artists.VectorArtist.rst new file mode 100644 index 00000000000..89697113f5d --- /dev/null +++ b/docs/reference/generated/compas_blender.artists.VectorArtist.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +VectorArtist +============ + +.. currentmodule:: compas_blender.artists + +.. autoclass:: VectorArtist + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~VectorArtist.draw + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~VectorArtist.build + ~VectorArtist.build_as + ~VectorArtist.clear + ~VectorArtist.draw_collection + ~VectorArtist.redraw + ~VectorArtist.register + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderCurve.from_geometry.rst b/docs/reference/generated/compas_blender.conversions.BlenderCurve.from_geometry.rst new file mode 100644 index 00000000000..bbbb30923a5 --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderCurve.from_geometry.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderCurve.from_geometry +===================================================== + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderCurve.from_geometry \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderCurve.from_name.rst b/docs/reference/generated/compas_blender.conversions.BlenderCurve.from_name.rst new file mode 100644 index 00000000000..a8a7d36c2c7 --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderCurve.from_name.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderCurve.from_name +================================================= + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderCurve.from_name \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderCurve.from_object.rst b/docs/reference/generated/compas_blender.conversions.BlenderCurve.from_object.rst new file mode 100644 index 00000000000..3aa37a4f45a --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderCurve.from_object.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderCurve.from_object +=================================================== + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderCurve.from_object \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderCurve.rst b/docs/reference/generated/compas_blender.conversions.BlenderCurve.rst new file mode 100644 index 00000000000..f9bab870297 --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderCurve.rst @@ -0,0 +1,57 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + +BlenderCurve +============ + +.. currentmodule:: compas_blender.conversions + +.. autoclass:: BlenderCurve + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~BlenderCurve.to_compas + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~BlenderCurve.from_geometry + ~BlenderCurve.from_name + ~BlenderCurve.from_object + ~BlenderCurve.transform + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderCurve.to_compas.rst b/docs/reference/generated/compas_blender.conversions.BlenderCurve.to_compas.rst new file mode 100644 index 00000000000..1e709d28aa6 --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderCurve.to_compas.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderCurve.to_compas +================================================= + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderCurve.to_compas \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderCurve.transform.rst b/docs/reference/generated/compas_blender.conversions.BlenderCurve.transform.rst new file mode 100644 index 00000000000..88762cbb57b --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderCurve.transform.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderCurve.transform +================================================= + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderCurve.transform \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderGeometry.from_geometry.rst b/docs/reference/generated/compas_blender.conversions.BlenderGeometry.from_geometry.rst new file mode 100644 index 00000000000..0bdeaceb156 --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderGeometry.from_geometry.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderGeometry.from_geometry +======================================================== + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderGeometry.from_geometry \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderGeometry.from_name.rst b/docs/reference/generated/compas_blender.conversions.BlenderGeometry.from_name.rst new file mode 100644 index 00000000000..b403f463624 --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderGeometry.from_name.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderGeometry.from_name +==================================================== + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderGeometry.from_name \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderGeometry.from_object.rst b/docs/reference/generated/compas_blender.conversions.BlenderGeometry.from_object.rst new file mode 100644 index 00000000000..ebe5949278d --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderGeometry.from_object.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderGeometry.from_object +====================================================== + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderGeometry.from_object \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderGeometry.rst b/docs/reference/generated/compas_blender.conversions.BlenderGeometry.rst new file mode 100644 index 00000000000..ec73abfdc9b --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderGeometry.rst @@ -0,0 +1,50 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + +BlenderGeometry +=============== + +.. currentmodule:: compas_blender.conversions + +.. autoclass:: BlenderGeometry + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~BlenderGeometry.from_geometry + ~BlenderGeometry.from_name + ~BlenderGeometry.from_object + ~BlenderGeometry.to_compas + ~BlenderGeometry.transform + + + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderGeometry.to_compas.rst b/docs/reference/generated/compas_blender.conversions.BlenderGeometry.to_compas.rst new file mode 100644 index 00000000000..2e4719949ab --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderGeometry.to_compas.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderGeometry.to_compas +==================================================== + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderGeometry.to_compas \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderGeometry.transform.rst b/docs/reference/generated/compas_blender.conversions.BlenderGeometry.transform.rst new file mode 100644 index 00000000000..2537a298d40 --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderGeometry.transform.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderGeometry.transform +==================================================== + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderGeometry.transform \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_bmesh.rst b/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_bmesh.rst new file mode 100644 index 00000000000..27bcb80ec22 --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_bmesh.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderMesh.from_bmesh +================================================= + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderMesh.from_bmesh \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_geometry.rst b/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_geometry.rst new file mode 100644 index 00000000000..658f07d79f9 --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_geometry.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderMesh.from_geometry +==================================================== + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderMesh.from_geometry \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_monkey.rst b/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_monkey.rst new file mode 100644 index 00000000000..dadb328cbef --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_monkey.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderMesh.from_monkey +================================================== + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderMesh.from_monkey \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_name.rst b/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_name.rst new file mode 100644 index 00000000000..443d4f1fc80 --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_name.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderMesh.from_name +================================================ + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderMesh.from_name \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_object.rst b/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_object.rst new file mode 100644 index 00000000000..a6509585acb --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderMesh.from_object.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderMesh.from_object +================================================== + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderMesh.from_object \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderMesh.rst b/docs/reference/generated/compas_blender.conversions.BlenderMesh.rst new file mode 100644 index 00000000000..784add6b7f8 --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderMesh.rst @@ -0,0 +1,67 @@ +.. rst-class:: detail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +BlenderMesh +=========== + +.. currentmodule:: compas_blender.conversions + +.. autoclass:: BlenderMesh + + + + .. rubric:: Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~BlenderMesh.from_bmesh + ~BlenderMesh.from_monkey + ~BlenderMesh.to_compas + + + + .. rubric:: Inherited Methods + + .. autosummary:: + :toctree: + :nosignatures: + + ~BlenderMesh.from_geometry + ~BlenderMesh.from_name + ~BlenderMesh.from_object + ~BlenderMesh.transform + + \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderMesh.to_compas.rst b/docs/reference/generated/compas_blender.conversions.BlenderMesh.to_compas.rst new file mode 100644 index 00000000000..f8d8549ffce --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderMesh.to_compas.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderMesh.to_compas +================================================ + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderMesh.to_compas \ No newline at end of file diff --git a/docs/reference/generated/compas_blender.conversions.BlenderMesh.transform.rst b/docs/reference/generated/compas_blender.conversions.BlenderMesh.transform.rst new file mode 100644 index 00000000000..c0f3726b5bf --- /dev/null +++ b/docs/reference/generated/compas_blender.conversions.BlenderMesh.transform.rst @@ -0,0 +1,8 @@ +.. rst-class:: detail + +BlenderMesh.transform +================================================ + +.. currentmodule:: compas_blender.conversions + +.. automethod:: BlenderMesh.transform \ No newline at end of file diff --git a/docs/reference/index.rst b/docs/reference/index.rst new file mode 100644 index 00000000000..44c7dafb4bf --- /dev/null +++ b/docs/reference/index.rst @@ -0,0 +1,11 @@ +Package Reference +================= + +.. toctree:: + :maxdepth: 2 + :titlesonly: + + compas + compas_blender + compas_ghpython + compas_rhino diff --git a/docs/roadmap.rst b/docs/roadmap.rst deleted file mode 100644 index 6b879b38c18..00000000000 --- a/docs/roadmap.rst +++ /dev/null @@ -1,15 +0,0 @@ -******* -Roadmap -******* - - -COMPAS 1.x LTS -============== - -coming soon... - - -COMPAS 2.0 -========== - -coming soon... \ No newline at end of file diff --git a/docs/tutorial.rst b/docs/tutorial.rst deleted file mode 100644 index 296f758bf4d..00000000000 --- a/docs/tutorial.rst +++ /dev/null @@ -1,19 +0,0 @@ -Tutorial -******** - -.. toctree:: - :maxdepth: 1 - :titlesonly: - - tutorial/data - tutorial/geometry - tutorial/brep - tutorial/networks - tutorial/meshes - tutorial/volmeshes - tutorial/robots - tutorial/numericaldata - tutorial/rpc - tutorial/geomaps - tutorial/plotters - tutorial/colors diff --git a/docs/citing.rst b/docs/userguide/citing.rst similarity index 100% rename from docs/citing.rst rename to docs/userguide/citing.rst diff --git a/docs/gettingstarted.rst b/docs/userguide/configuration.rst similarity index 71% rename from docs/gettingstarted.rst rename to docs/userguide/configuration.rst index 7b19346510e..6a70f7ea736 100644 --- a/docs/gettingstarted.rst +++ b/docs/userguide/configuration.rst @@ -1,5 +1,5 @@ ******************************************************************************** -Getting started +Configuration ******************************************************************************** .. rst-class:: lead @@ -12,8 +12,8 @@ as well as in scriptable CAD software such as Blender, Rhino and Grasshopper. :maxdepth: 1 :glob: - gettingstarted/vscode - gettingstarted/rhino - gettingstarted/grasshopper - gettingstarted/blender - gettingstarted/rhino5 + configuration/vscode + configuration/rhino + configuration/grasshopper + configuration/blender + configuration/rhino5 diff --git a/docs/gettingstarted/blender.rst b/docs/userguide/configuration/blender.rst similarity index 99% rename from docs/gettingstarted/blender.rst rename to docs/userguide/configuration/blender.rst index 2030af134e3..e97ef94dc61 100644 --- a/docs/gettingstarted/blender.rst +++ b/docs/userguide/configuration/blender.rst @@ -30,10 +30,9 @@ If you don't have an environment yet with Python 3.9 and COMPAS you can create o Configuring Blender to use the newly installed environment is slightly different per OS. -.. tabs:: +.. tab-set:: .. tab-item:: Windows - :active: .. code-block:: bash @@ -132,10 +131,9 @@ On Mac or Linux, you should start Blender from the command line. By adding the Blender executable to the ``PATH`` variable this is really simple. Just add the following to your ``.bash_profile`` or ``.bashrc``. -.. tabs:: +.. tab-set:: .. tab-item:: OSX - :active: .. code-block:: bash diff --git a/docs/gettingstarted/freecad.rst b/docs/userguide/configuration/freecad.rst similarity index 100% rename from docs/gettingstarted/freecad.rst rename to docs/userguide/configuration/freecad.rst diff --git a/docs/gettingstarted/grasshopper.rst b/docs/userguide/configuration/grasshopper.rst similarity index 100% rename from docs/gettingstarted/grasshopper.rst rename to docs/userguide/configuration/grasshopper.rst diff --git a/docs/gettingstarted/rhino.rst b/docs/userguide/configuration/rhino.rst similarity index 100% rename from docs/gettingstarted/rhino.rst rename to docs/userguide/configuration/rhino.rst diff --git a/docs/gettingstarted/rhino5.rst b/docs/userguide/configuration/rhino5.rst similarity index 100% rename from docs/gettingstarted/rhino5.rst rename to docs/userguide/configuration/rhino5.rst diff --git a/docs/gettingstarted/vscode.rst b/docs/userguide/configuration/vscode.rst similarity index 100% rename from docs/gettingstarted/vscode.rst rename to docs/userguide/configuration/vscode.rst diff --git a/docs/api.rst b/docs/userguide/conventions.rst similarity index 95% rename from docs/api.rst rename to docs/userguide/conventions.rst index 1fb5ae895b3..dbaef45fde6 100644 --- a/docs/api.rst +++ b/docs/userguide/conventions.rst @@ -1,21 +1,7 @@ ******************************************************************************** -API Reference +Conventions ******************************************************************************** -Packages -======== - -.. toctree:: - :maxdepth: 1 - :titlesonly: - - api/compas - api/compas_blender - api/compas_ghpython - api/compas_plotters - api/compas_rhino - - Package Structure ================= @@ -135,7 +121,7 @@ Type aliases can also be nested to further improve legibility of more complex ty * - ``frame`` - ``[point, vector, vector]`` | :class:`compas.geometry.Frame` * - ``circle`` - - ``[plane, float]``| :class:`compas.geometry.Circle` + - ``[plane, float]`` | :class:`compas.geometry.Circle` * - ``ellipse`` - ``[plane, float, float]`` | :class:`compas.geometry.Ellipse` * - ``polyline`` diff --git a/docs/userguide/index.rst b/docs/userguide/index.rst new file mode 100644 index 00000000000..b076eb36b48 --- /dev/null +++ b/docs/userguide/index.rst @@ -0,0 +1,14 @@ +User Guide +========== + +.. toctree:: + :maxdepth: 2 + :titlesonly: + + installation + configuration + tutorials + conventions + releases + citing + license diff --git a/docs/installation.rst b/docs/userguide/installation.rst similarity index 100% rename from docs/installation.rst rename to docs/userguide/installation.rst diff --git a/docs/license.rst b/docs/userguide/license.rst similarity index 92% rename from docs/license.rst rename to docs/userguide/license.rst index 60671fc9437..0bd6806aeaa 100644 --- a/docs/license.rst +++ b/docs/userguide/license.rst @@ -8,5 +8,5 @@ COMPAS is an open source framework with a permissive license such that it can be for research as well as for proprietary projects, in academia and in practice, or at the interface between both. -.. literalinclude:: ../LICENSE +.. literalinclude:: ../../LICENSE :language: none diff --git a/docs/releases.rst b/docs/userguide/releases.rst similarity index 100% rename from docs/releases.rst rename to docs/userguide/releases.rst diff --git a/docs/userguide/tutorials.rst b/docs/userguide/tutorials.rst new file mode 100644 index 00000000000..c6e9c296b8c --- /dev/null +++ b/docs/userguide/tutorials.rst @@ -0,0 +1,20 @@ +Tutorials +********* + +.. toctree:: + :maxdepth: 1 + :titlesonly: + + tutorials/data + tutorials/geometry + tutorials/brep + tutorials/meshes + tutorials/robots + tutorials/rpc + tutorials/colors + +.. tutorial/geomaps +.. tutorial/networks +.. tutorial/numericaldata +.. tutorial/plotters +.. tutorial/volmeshes diff --git a/docs/tutorial/artists/try_artists_mesh.py b/docs/userguide/tutorials/artists/try_artists_mesh.py similarity index 100% rename from docs/tutorial/artists/try_artists_mesh.py rename to docs/userguide/tutorials/artists/try_artists_mesh.py diff --git a/docs/tutorial/artists/try_artists_network.py b/docs/userguide/tutorials/artists/try_artists_network.py similarity index 100% rename from docs/tutorial/artists/try_artists_network.py rename to docs/userguide/tutorials/artists/try_artists_network.py diff --git a/docs/tutorial/artists/try_artists_shapes.py b/docs/userguide/tutorials/artists/try_artists_shapes.py similarity index 100% rename from docs/tutorial/artists/try_artists_shapes.py rename to docs/userguide/tutorials/artists/try_artists_shapes.py diff --git a/docs/tutorial/artists/try_artists_volmesh.py b/docs/userguide/tutorials/artists/try_artists_volmesh.py similarity index 100% rename from docs/tutorial/artists/try_artists_volmesh.py rename to docs/userguide/tutorials/artists/try_artists_volmesh.py diff --git a/docs/tutorial/assembly.rst b/docs/userguide/tutorials/assembly.rst similarity index 100% rename from docs/tutorial/assembly.rst rename to docs/userguide/tutorials/assembly.rst diff --git a/docs/tutorial/assembly_blocks.py b/docs/userguide/tutorials/assembly_blocks.py similarity index 99% rename from docs/tutorial/assembly_blocks.py rename to docs/userguide/tutorials/assembly_blocks.py index eacb37395d5..a0a580aca2a 100644 --- a/docs/tutorial/assembly_blocks.py +++ b/docs/userguide/tutorials/assembly_blocks.py @@ -20,6 +20,7 @@ def get_geometry(self, _=False): transformation = Transformation.from_frame(self.frame) return Box.from_width_height_depth(1, 1, 1).transformed(transformation) + assembly = Assembly() f1 = Frame([0, 0, 1], [1, 0, 0], [0, 1, 0]) diff --git a/docs/tutorial/assembly_robot.py b/docs/userguide/tutorials/assembly_robot.py similarity index 100% rename from docs/tutorial/assembly_robot.py rename to docs/userguide/tutorials/assembly_robot.py diff --git a/docs/tutorial/assembly_splines.py b/docs/userguide/tutorials/assembly_splines.py similarity index 100% rename from docs/tutorial/assembly_splines.py rename to docs/userguide/tutorials/assembly_splines.py diff --git a/docs/tutorial/brep.rst b/docs/userguide/tutorials/brep.rst similarity index 100% rename from docs/tutorial/brep.rst rename to docs/userguide/tutorials/brep.rst diff --git a/docs/tutorial/colors.rst b/docs/userguide/tutorials/colors.rst similarity index 100% rename from docs/tutorial/colors.rst rename to docs/userguide/tutorials/colors.rst diff --git a/docs/tutorial/curves-and-surfs.rst b/docs/userguide/tutorials/curves-and-surfs.rst similarity index 100% rename from docs/tutorial/curves-and-surfs.rst rename to docs/userguide/tutorials/curves-and-surfs.rst diff --git a/docs/tutorial/curves_and_surfaces/curve_closest_point.py b/docs/userguide/tutorials/curves_and_surfaces/curve_closest_point.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/curve_closest_point.py rename to docs/userguide/tutorials/curves_and_surfaces/curve_closest_point.py diff --git a/docs/tutorial/curves_and_surfaces/curve_comparison1.py b/docs/userguide/tutorials/curves_and_surfaces/curve_comparison1.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/curve_comparison1.py rename to docs/userguide/tutorials/curves_and_surfaces/curve_comparison1.py diff --git a/docs/tutorial/curves_and_surfaces/curve_comparison2.py b/docs/userguide/tutorials/curves_and_surfaces/curve_comparison2.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/curve_comparison2.py rename to docs/userguide/tutorials/curves_and_surfaces/curve_comparison2.py diff --git a/docs/tutorial/curves_and_surfaces/curve_from_circle.py b/docs/userguide/tutorials/curves_and_surfaces/curve_from_circle.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/curve_from_circle.py rename to docs/userguide/tutorials/curves_and_surfaces/curve_from_circle.py diff --git a/docs/tutorial/curves_and_surfaces/curve_from_ellipse.py b/docs/userguide/tutorials/curves_and_surfaces/curve_from_ellipse.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/curve_from_ellipse.py rename to docs/userguide/tutorials/curves_and_surfaces/curve_from_ellipse.py diff --git a/docs/tutorial/curves_and_surfaces/curve_from_interpolation.py b/docs/userguide/tutorials/curves_and_surfaces/curve_from_interpolation.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/curve_from_interpolation.py rename to docs/userguide/tutorials/curves_and_surfaces/curve_from_interpolation.py diff --git a/docs/tutorial/curves_and_surfaces/curve_from_line.py b/docs/userguide/tutorials/curves_and_surfaces/curve_from_line.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/curve_from_line.py rename to docs/userguide/tutorials/curves_and_surfaces/curve_from_line.py diff --git a/docs/tutorial/curves_and_surfaces/curve_from_parameters.py b/docs/userguide/tutorials/curves_and_surfaces/curve_from_parameters.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/curve_from_parameters.py rename to docs/userguide/tutorials/curves_and_surfaces/curve_from_parameters.py diff --git a/docs/tutorial/curves_and_surfaces/curve_from_points.py b/docs/userguide/tutorials/curves_and_surfaces/curve_from_points.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/curve_from_points.py rename to docs/userguide/tutorials/curves_and_surfaces/curve_from_points.py diff --git a/docs/tutorial/curves_and_surfaces/surface_aabb.py b/docs/userguide/tutorials/curves_and_surfaces/surface_aabb.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/surface_aabb.py rename to docs/userguide/tutorials/curves_and_surfaces/surface_aabb.py diff --git a/docs/tutorial/curves_and_surfaces/surface_frames.py b/docs/userguide/tutorials/curves_and_surfaces/surface_frames.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/surface_frames.py rename to docs/userguide/tutorials/curves_and_surfaces/surface_frames.py diff --git a/docs/tutorial/curves_and_surfaces/surface_from_meshgrid.py b/docs/userguide/tutorials/curves_and_surfaces/surface_from_meshgrid.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/surface_from_meshgrid.py rename to docs/userguide/tutorials/curves_and_surfaces/surface_from_meshgrid.py diff --git a/docs/tutorial/curves_and_surfaces/surface_from_parameters.py b/docs/userguide/tutorials/curves_and_surfaces/surface_from_parameters.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/surface_from_parameters.py rename to docs/userguide/tutorials/curves_and_surfaces/surface_from_parameters.py diff --git a/docs/tutorial/curves_and_surfaces/surface_from_points.py b/docs/userguide/tutorials/curves_and_surfaces/surface_from_points.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/surface_from_points.py rename to docs/userguide/tutorials/curves_and_surfaces/surface_from_points.py diff --git a/docs/tutorial/curves_and_surfaces/surface_isocurves.py b/docs/userguide/tutorials/curves_and_surfaces/surface_isocurves.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/surface_isocurves.py rename to docs/userguide/tutorials/curves_and_surfaces/surface_isocurves.py diff --git a/docs/tutorial/curves_and_surfaces/surface_jsondata.py b/docs/userguide/tutorials/curves_and_surfaces/surface_jsondata.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/surface_jsondata.py rename to docs/userguide/tutorials/curves_and_surfaces/surface_jsondata.py diff --git a/docs/tutorial/curves_and_surfaces/surface_random.py b/docs/userguide/tutorials/curves_and_surfaces/surface_random.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/surface_random.py rename to docs/userguide/tutorials/curves_and_surfaces/surface_random.py diff --git a/docs/tutorial/curves_and_surfaces/surface_spacepoints.py b/docs/userguide/tutorials/curves_and_surfaces/surface_spacepoints.py similarity index 100% rename from docs/tutorial/curves_and_surfaces/surface_spacepoints.py rename to docs/userguide/tutorials/curves_and_surfaces/surface_spacepoints.py diff --git a/docs/tutorial/data.rst b/docs/userguide/tutorials/data.rst similarity index 93% rename from docs/tutorial/data.rst rename to docs/userguide/tutorials/data.rst index efd924f41ad..bf9e28258d0 100644 --- a/docs/tutorial/data.rst +++ b/docs/userguide/tutorials/data.rst @@ -244,21 +244,3 @@ GH Components ============= *Coming soon...* - -Inheritance Diagrams -==================== - -.. currentmodule:: compas.geometry - -.. inheritance-diagram:: Bezier Circle Ellipse Frame Line Plane Point Polygon Polyline Quaternion Vector Box Capsule Cone Cylinder Polyhedron Sphere Torus Projection Reflection Rotation Shear Transformation Translation - :parts: 1 - -.. currentmodule:: compas.datastructures - -.. inheritance-diagram:: Mesh Network VolMesh - :parts: 1 - -.. currentmodule:: compas.robots - -.. inheritance-diagram:: RobotModel Joint Link ToolModel Configuration - :parts: 1 diff --git a/docs/tutorial/files/3_way_split.PNG b/docs/userguide/tutorials/files/3_way_split.PNG similarity index 100% rename from docs/tutorial/files/3_way_split.PNG rename to docs/userguide/tutorials/files/3_way_split.PNG diff --git a/docs/tutorial/files/box_w_plane.png b/docs/userguide/tutorials/files/box_w_plane.png similarity index 100% rename from docs/tutorial/files/box_w_plane.png rename to docs/userguide/tutorials/files/box_w_plane.png diff --git a/docs/tutorial/files/boxy_1.png b/docs/userguide/tutorials/files/boxy_1.png similarity index 100% rename from docs/tutorial/files/boxy_1.png rename to docs/userguide/tutorials/files/boxy_1.png diff --git a/docs/tutorial/files/boxy_2.png b/docs/userguide/tutorials/files/boxy_2.png similarity index 100% rename from docs/tutorial/files/boxy_2.png rename to docs/userguide/tutorials/files/boxy_2.png diff --git a/docs/tutorial/files/boxy_3.png b/docs/userguide/tutorials/files/boxy_3.png similarity index 100% rename from docs/tutorial/files/boxy_3.png rename to docs/userguide/tutorials/files/boxy_3.png diff --git a/docs/tutorial/files/coordinate_frames.jpg b/docs/userguide/tutorials/files/coordinate_frames.jpg similarity index 100% rename from docs/tutorial/files/coordinate_frames.jpg rename to docs/userguide/tutorials/files/coordinate_frames.jpg diff --git a/docs/tutorial/files/drinking_bird.png b/docs/userguide/tutorials/files/drinking_bird.png similarity index 100% rename from docs/tutorial/files/drinking_bird.png rename to docs/userguide/tutorials/files/drinking_bird.png diff --git a/docs/tutorial/files/drinking_bird.py b/docs/userguide/tutorials/files/drinking_bird.py similarity index 90% rename from docs/tutorial/files/drinking_bird.py rename to docs/userguide/tutorials/files/drinking_bird.py index 439a2cf82ef..1e839b3324b 100644 --- a/docs/tutorial/files/drinking_bird.py +++ b/docs/userguide/tutorials/files/drinking_bird.py @@ -36,16 +36,12 @@ beak = Cylinder(Circle(Plane([0, 1, -0.3], [0, 1, 0]), 0.3), 1.5) head_link = model.add_link("head", visual_meshes=[head, beak]) neck_joint_origin = Frame([0, 0, 4], [1, 0, 0], [0, 1, 0]) -model.add_joint( - "neck_joint", Joint.FIXED, torso_link, head_link, origin=neck_joint_origin -) +model.add_joint("neck_joint", Joint.FIXED, torso_link, head_link, origin=neck_joint_origin) tail = Sphere([0, 0, 0], 1) tail_link = model.add_link("tail", visual_meshes=[tail]) tail_joint_origin = Frame([0, 0, -4], [1, 0, 0], [0, 1, 0]) -model.add_joint( - "tail_joint", Joint.FIXED, torso_link, tail_link, origin=tail_joint_origin -) +model.add_joint("tail_joint", Joint.FIXED, torso_link, tail_link, origin=tail_joint_origin) hat = Cylinder(Circle(Plane([0, 0, 0], [0, 0, 1]), 0.8), 1.5) brim = Cylinder(Circle(Plane([0, 0, -1.5 / 2], [0, 0, 1]), 1.4), 0.1) diff --git a/docs/tutorial/files/jointy.png b/docs/userguide/tutorials/files/jointy.png similarity index 100% rename from docs/tutorial/files/jointy.png rename to docs/userguide/tutorials/files/jointy.png diff --git a/docs/tutorial/files/trimmed_box.png b/docs/userguide/tutorials/files/trimmed_box.png similarity index 100% rename from docs/tutorial/files/trimmed_box.png rename to docs/userguide/tutorials/files/trimmed_box.png diff --git a/docs/tutorial/geomaps.rst b/docs/userguide/tutorials/geomaps.rst similarity index 100% rename from docs/tutorial/geomaps.rst rename to docs/userguide/tutorials/geomaps.rst diff --git a/docs/tutorial/geometry.rst b/docs/userguide/tutorials/geometry.rst similarity index 100% rename from docs/tutorial/geometry.rst rename to docs/userguide/tutorials/geometry.rst diff --git a/docs/tutorial/meshes.rst b/docs/userguide/tutorials/meshes.rst similarity index 95% rename from docs/tutorial/meshes.rst rename to docs/userguide/tutorials/meshes.rst index 44159f87711..e973993caa5 100644 --- a/docs/tutorial/meshes.rst +++ b/docs/userguide/tutorials/meshes.rst @@ -145,15 +145,15 @@ To transparently convert non-contiguous sequences of identifiers to contiguous l :: - >>> key_index = mesh.key_index() + >>> vertex_index = mesh.vertex_index() >>> vertices = list(mesh.vertices()) - >>> edges = [(key_index[u], key_index[v]) for u, v in mesh.edges()] - >>> faces = [[key_index[key] for key in mesh.face_vertices(face)] for face in mesh.faces()] + >>> edges = [(vertex_index[u], vertex_index[v]) for u, v in mesh.edges()] + >>> faces = [[vertex_index[vertex] for vertex in mesh.face_vertices(face)] for face in mesh.faces()] The key/index map simply maps vertex identifiers to the corresponding index in the contiguous sequence that is created when converting a sequence of identifiers to a list. The ordering of these identifiers can be completely random, but is always consistent. :: - >>> key_index = {key: index for index, key in enumerate(mesh.vertices())} + >>> vertex_index = {vertex: index for index, vertex in enumerate(mesh.vertices())} Topology diff --git a/docs/tutorial/networks.rst b/docs/userguide/tutorials/networks.rst similarity index 100% rename from docs/tutorial/networks.rst rename to docs/userguide/tutorials/networks.rst diff --git a/docs/tutorial/numericaldata.rst b/docs/userguide/tutorials/numericaldata.rst similarity index 100% rename from docs/tutorial/numericaldata.rst rename to docs/userguide/tutorials/numericaldata.rst diff --git a/docs/tutorial/plotters.rst b/docs/userguide/tutorials/plotters.rst similarity index 100% rename from docs/tutorial/plotters.rst rename to docs/userguide/tutorials/plotters.rst diff --git a/docs/tutorial/plotters_dynamic.py b/docs/userguide/tutorials/plotters_dynamic.py similarity index 100% rename from docs/tutorial/plotters_dynamic.py rename to docs/userguide/tutorials/plotters_dynamic.py diff --git a/docs/tutorial/plotters_line-options.py b/docs/userguide/tutorials/plotters_line-options.py similarity index 100% rename from docs/tutorial/plotters_line-options.py rename to docs/userguide/tutorials/plotters_line-options.py diff --git a/docs/tutorial/plotters_point-options.py b/docs/userguide/tutorials/plotters_point-options.py similarity index 100% rename from docs/tutorial/plotters_point-options.py rename to docs/userguide/tutorials/plotters_point-options.py diff --git a/docs/tutorial/plotters_polygon-options.py b/docs/userguide/tutorials/plotters_polygon-options.py similarity index 56% rename from docs/tutorial/plotters_polygon-options.py rename to docs/userguide/tutorials/plotters_polygon-options.py index 83635cd8439..8d0c4dd016f 100644 --- a/docs/tutorial/plotters_polygon-options.py +++ b/docs/userguide/tutorials/plotters_polygon-options.py @@ -3,18 +3,12 @@ from compas_plotters import Plotter poly1 = Polygon.from_sides_and_radius_xy(5, 1.0) -poly2 = Polygon.from_sides_and_radius_xy(5, 1.0).transformed( - Translation.from_vector([0.5, -0.25, 0]) -) -poly3 = Polygon.from_sides_and_radius_xy(5, 1.0).transformed( - Translation.from_vector([0.75, +0.25, 0]) -) +poly2 = Polygon.from_sides_and_radius_xy(5, 1.0).transformed(Translation.from_vector([0.5, -0.25, 0])) +poly3 = Polygon.from_sides_and_radius_xy(5, 1.0).transformed(Translation.from_vector([0.75, +0.25, 0])) plotter = Plotter(figsize=(8, 5)) plotter.add(poly1, linewidth=3.0, facecolor=(0.8, 1.0, 0.8), edgecolor=(0.0, 1.0, 0.0)) -plotter.add( - poly2, linestyle="dashed", facecolor=(1.0, 0.8, 0.8), edgecolor=(1.0, 0.0, 0.0) -) +plotter.add(poly2, linestyle="dashed", facecolor=(1.0, 0.8, 0.8), edgecolor=(1.0, 0.0, 0.0)) plotter.add(poly3, alpha=0.5) plotter.zoom_extents() plotter.show() diff --git a/docs/tutorial/plotters_vector-options.py b/docs/userguide/tutorials/plotters_vector-options.py similarity index 100% rename from docs/tutorial/plotters_vector-options.py rename to docs/userguide/tutorials/plotters_vector-options.py diff --git a/docs/tutorial/robots.rst b/docs/userguide/tutorials/robots.rst similarity index 99% rename from docs/tutorial/robots.rst rename to docs/userguide/tutorials/robots.rst index fd642b0c2cb..1a23ad19e70 100644 --- a/docs/tutorial/robots.rst +++ b/docs/userguide/tutorials/robots.rst @@ -151,10 +151,9 @@ artists. The basic procedure is the same in any of the CAD software (aside from the import statement). Below you can find an example code for both Rhino and Blender. -.. tabs:: +.. tab-set:: .. tab-item:: Rhino - :active: Be sure to first install COMPAS for Rhino. While the following code is incomplete, it can be used as a scaffolding for code to be run in a Python script editor within Rhino. diff --git a/docs/tutorial/rpc.rst b/docs/userguide/tutorials/rpc.rst similarity index 100% rename from docs/tutorial/rpc.rst rename to docs/userguide/tutorials/rpc.rst diff --git a/docs/tutorial/volmeshes.rst b/docs/userguide/tutorials/volmeshes.rst similarity index 100% rename from docs/tutorial/volmeshes.rst rename to docs/userguide/tutorials/volmeshes.rst diff --git a/requirements-dev.txt b/requirements-dev.txt index 7bab6371852..cd95ce5f45d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -14,10 +14,19 @@ isort jinja2 >= 3.0 m2r2 nbsphinx +numpydoc +pydata-sphinx-theme pydocstyle pytest sphinx ==4.5 sphinx_compas_theme >=0.15.18 +sphinx-design +sphinx-inline-tabs +sphinx-togglebutton +sphinx-remove-toctrees +sphinx-copybutton +sphinxcontrib-bibtex +sphinxcontrib-youtube twine wheel -e . diff --git a/src/compas/__init__.py b/src/compas/__init__.py index 7e6592d27f0..9c2546691a1 100644 --- a/src/compas/__init__.py +++ b/src/compas/__init__.py @@ -1,29 +1,3 @@ -""" -******************************************************************************** -compas -******************************************************************************** - -.. currentmodule:: compas - -.. toctree:: - :maxdepth: 1 - :titlesonly: - - compas.artists - compas.colors - compas.data - compas.datastructures - compas.files - compas.geometry - compas.numerical - compas.plugins - compas.robots - compas.rpc - compas.topology - compas.utilities - - -""" from __future__ import print_function import os @@ -46,10 +20,9 @@ __author__ = "Tom Van Mele and many others (see AUTHORS.md)" -__copyright__ = "Copyright 2014-2019 - Block Research Group, ETH Zurich" +__copyright__ = "Copyright 2014-2022 - ETH Zurich, Copyright 2023 - COMPAS Association" __license__ = "MIT License" -__email__ = "vanmelet@ethz.ch" - +__email__ = "tom.v.mele@gmail.com" __version__ = "1.17.5" version = LooseVersion(compas.__version__) @@ -305,7 +278,6 @@ def get_bunny(localstorage=None): with tarfile.open(destination) as file: def is_within_directory(directory, target): - abs_directory = os.path.abspath(directory) abs_target = os.path.abspath(target) @@ -314,7 +286,6 @@ def is_within_directory(directory, target): return prefix == abs_directory def safe_extract(tar, path=".", members=None, numeric_owner=False): - for member in tar.getmembers(): member_path = os.path.join(path, member.name) if not is_within_directory(path, member_path): diff --git a/src/compas/artists/__init__.py b/src/compas/artists/__init__.py index 6ae6f056eaf..d36beda5403 100644 --- a/src/compas/artists/__init__.py +++ b/src/compas/artists/__init__.py @@ -1,59 +1,3 @@ -""" -******************************************************************************** -artists -******************************************************************************** - -.. currentmodule:: compas.artists - -.. rst-class:: lead - -For visualization of data objects such as geometry objects, robots, and data structures, COMPAS provides "artists". -Every data object type is paired with a corresponding artist type that is capable of visualizing the data. -This package provides base artist classes with pluggable methods -that receive an implementation from plugins defined by various visualization contexts. - - -Classes -======= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Artist - CurveArtist - RobotModelArtist - MeshArtist - NetworkArtist - PrimitiveArtist - ShapeArtist - SurfaceArtist - VolMeshArtist - - -Exceptions -========== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - DataArtistNotRegistered - NoArtistContextError - - -Pluggables -========== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - clear - redraw - register_artists - -""" from __future__ import print_function from __future__ import absolute_import from __future__ import division diff --git a/src/compas/artists/artist.py b/src/compas/artists/artist.py index a973a2edcf7..4792cb83b5d 100644 --- a/src/compas/artists/artist.py +++ b/src/compas/artists/artist.py @@ -73,8 +73,8 @@ def _get_artist_cls(data, **kwargs): class Artist(object): """Base class for all artists. - Class Attributes - ---------------- + Attributes + ---------- AVAILABLE_CONTEXTS : list[str] The available visualization contexts. CONTEXT : str | None diff --git a/src/compas/artists/curveartist.py b/src/compas/artists/curveartist.py index d7833bb098d..b29fae46f17 100644 --- a/src/compas/artists/curveartist.py +++ b/src/compas/artists/curveartist.py @@ -11,7 +11,7 @@ class CurveArtist(Artist): Parameters ---------- - curve: :class:`~compas.geometry.Curve` + curve : :class:`~compas.geometry.Curve` The curve geometry. color : tuple[float, float, float] | :class:`~compas.colors.Color`, optional The RGB color. @@ -22,12 +22,13 @@ class CurveArtist(Artist): The geometry of the curve. color : :class:`~compas.colors.Color` The color of the curve. - - Class Attributes - ---------------- default_color : :class:`~compas.colors.Color` The default color of the curve. + See Also + -------- + :class:`compas.artists.SurfaceArtist` + """ default_color = Color.from_hex("#0092D2") diff --git a/src/compas/artists/meshartist.py b/src/compas/artists/meshartist.py index 86afc77eec8..d85960025ef 100644 --- a/src/compas/artists/meshartist.py +++ b/src/compas/artists/meshartist.py @@ -53,12 +53,18 @@ class MeshArtist(Artist): vertex_color : dict[int, :class:`~compas.colors.Color`] Vertex colors. Missing vertices get the default vertex color :attr:`default_vertexcolor`. + default_vertexcolor : :class:`~compas.colors.Color` + The default color of the vertices of the mesh. edge_color : dict[tuple[int, int], :class:`~compas.colors.Color`] Edge colors. Missing edges get the default edge color :attr:`default_edgecolor`. + default_edgecolor : :class:`~compas.colors.Color` + The default color of the edges of the mesh. face_color : dict[int, :class:`~compas.colors.Color`] Face colors. Missing faces get the default face color :attr:`default_facecolor`. + default_facecolor : :class:`~compas.colors.Color` + The default color of the faces of the mesh. vertex_text : dict[int, str] Vertex labels. Defaults to the vertex identifiers. @@ -72,24 +78,20 @@ class MeshArtist(Artist): Vertex sizes. Defaults to 1. Visualization of vertices with variable size is not available for all visualization contexts. + default_vertexsize : float + The default size of the vertices of the mesh. edge_width : dict[tuple[int, int], float] Edge widths. Defaults to 1. Visualization of edges with variable width is not available for all visualization contexts. - - Class Attributes - ---------------- - default_vertexcolor : :class:`~compas.colors.Color` - The default color of the vertices of the mesh. - default_edgecolor : :class:`~compas.colors.Color` - The default color of the edges of the mesh. - default_facecolor : :class:`~compas.colors.Color` - The default color of the faces of the mesh. - default_vertexsize : float - The default size of the vertices of the mesh. default_edgewidth : float The default width of the edges of the mesh. + See Also + -------- + :class:`compas.artists.NetworkArtist` + :class:`compas.artists.VolMeshArtist` + """ color = Color.from_hex("#0092D2").lightened(50) diff --git a/src/compas/artists/networkartist.py b/src/compas/artists/networkartist.py index 02d8bf94813..dc7c399e857 100644 --- a/src/compas/artists/networkartist.py +++ b/src/compas/artists/networkartist.py @@ -43,9 +43,13 @@ class NetworkArtist(Artist): node_color : dict[hashable, :class:`~compas.colors.Color`] Mapping between nodes and RGB color values. Missing nodes get the default node color :attr:`default_nodecolor`. + default_nodecolor : :class:`~compas.colors.Color` + The default color for nodes that do not have a specified color. edge_color : dict[tuple[hashable, hashable], :class:`~compas.colors.Color`] Mapping between edges and colors. Missing edges get the default edge color :attr:`default_edgecolor`. + default_edgecolor : :class:`~compas.colors.Color` + The default color for edges that do not have a specified color. node_text : dict[hashable, str] Mapping between nodes and text labels. edge_text : dict[tuple[hashable, hashable], str] @@ -53,21 +57,19 @@ class NetworkArtist(Artist): node_size : dict[hashable, float] Mapping between nodes and sizes. Missing nodes get assigned the default node size :attr:`default_nodesize`. + default_nodesize : float + The default size for nodes that do not have a specified size. edge_width : dict[tuple[hashable, hashable], float] Mapping between edges and line widths. Missing edges get assigned the default edge width :attr:`default_edgewidth`. - - Class Attributes - ---------------- - default_nodecolor : :class:`~compas.colors.Color` - The default color for nodes that do not have a specified color. - default_edgecolor : :class:`~compas.colors.Color` - The default color for edges that do not have a specified color. - default_nodesize : float - The default size for nodes that do not have a specified size. default_edgewidth : float The default width for edges that do not have a specified width. + See Also + -------- + :class:`compas.artists.MeshArtist` + :class:`compas.artists.VolMeshArtist` + """ default_nodecolor = Color.from_hex("#0092D2") diff --git a/src/compas/artists/primitiveartist.py b/src/compas/artists/primitiveartist.py index 7bd721efc21..04edc87df94 100644 --- a/src/compas/artists/primitiveartist.py +++ b/src/compas/artists/primitiveartist.py @@ -11,7 +11,7 @@ class PrimitiveArtist(Artist): Parameters ---------- - primitive: :class:`~compas.geometry.Primitive` + primitive : :class:`~compas.geometry.Primitive` The geometry of the primitive. color : tuple[float, float, float] | :class:`~compas.colors.Color`, optional The RGB components of the base color of the primitive. @@ -22,12 +22,13 @@ class PrimitiveArtist(Artist): The geometric primitive associated with the artist. color : :class:`~compas.colors.Color` The color of the object. - - Class Attributes - ---------------- default_color : :class:`~compas.colors.Color` The default rgb color value of the primitive. + See Also + -------- + :class:`compas.artists.ShapeArtist` + """ default_color = Color.from_hex("#0092D2") diff --git a/src/compas/artists/robotmodelartist.py b/src/compas/artists/robotmodelartist.py index 539d1f88ab5..1206f207f37 100644 --- a/src/compas/artists/robotmodelartist.py +++ b/src/compas/artists/robotmodelartist.py @@ -30,10 +30,6 @@ def transform(self, geometry, transformation): def create_geometry(self, geometry, name=None, color=None): """Draw geometry in the respective CAD environment. - Note - ---- - This is an abstract method that needs to be implemented by derived classes. - Parameters ---------- geometry : :class:`~compas.datastructures.Mesh` @@ -46,6 +42,10 @@ def create_geometry(self, geometry, name=None, color=None): object CAD-specific geometry + Notes + ----- + This is an abstract method that needs to be implemented by derived classes. + """ raise NotImplementedError diff --git a/src/compas/artists/shapeartist.py b/src/compas/artists/shapeartist.py index f4092375375..c561e0ce357 100644 --- a/src/compas/artists/shapeartist.py +++ b/src/compas/artists/shapeartist.py @@ -11,7 +11,7 @@ class ShapeArtist(Artist): Parameters ---------- - shape: :class:`~compas.geometry.Shape` + shape : :class:`~compas.geometry.Shape` The geometry of the shape. color : tuple[float, float, float] | :class:`~compas.colors.Color`, optional The RGB color. @@ -22,15 +22,16 @@ class ShapeArtist(Artist): The geometry of the shape. color : :class:`~compas.colors.Color` The color of the shape. + default_color : :class:`~compas.colors.Color` + The default color of the shape. u : int The resolution in the U direction of the discrete shape representation. v : int The resolution in the V direction of the discrete shape representation. - Class Attributes - ---------------- - default_color : :class:`~compas.colors.Color` - The default color of the shape. + See Also + -------- + :class:`compas.artists.PrimitiveArtist` """ diff --git a/src/compas/artists/surfaceartist.py b/src/compas/artists/surfaceartist.py index d5af8cedd3c..3218c52f83b 100644 --- a/src/compas/artists/surfaceartist.py +++ b/src/compas/artists/surfaceartist.py @@ -11,7 +11,7 @@ class SurfaceArtist(Artist): Parameters ---------- - surface: :class:`~compas.geometry.Surface` + surface : :class:`~compas.geometry.Surface` The surface geometry. color : tuple[float, float, float] | :class:`~compas.colors.Color`, optional The RGB color. @@ -22,12 +22,13 @@ class SurfaceArtist(Artist): The geometry of the surface. color : :class:`~compas.colors.Color` The color of the surface. - - Class Attributes - ---------------- default_color : :class:`~compas.colors.Color` The default color of the surface. + See Also + -------- + :class:`compas.artists.CurveArtist` + """ default_color = Color.from_hex("#0092D2") diff --git a/src/compas/artists/volmeshartist.py b/src/compas/artists/volmeshartist.py index 86ba6e1f68f..adef25c3280 100644 --- a/src/compas/artists/volmeshartist.py +++ b/src/compas/artists/volmeshartist.py @@ -39,15 +39,23 @@ class VolMeshArtist(Artist): vertex_color : dict[int, :class:`~compas.colors.Color`] Mapping between vertices and colors. Missing vertices get the default vertex color: :attr:`default_vertexcolor`. + default_vertexcolor : :class:`~compas.colors.Color` + The default color of the vertices of the mesh that don't have a specified color. edge_color : dict[tuple[int, int], :class:`~compas.colors.Color`] Mapping between edges and colors. Missing edges get the default edge color: :attr:`default_edgecolor`. + default_edgecolor : :class:`~compas.colors.Color` + The default color of the edges of the mesh that don't have a specified color. face_color : dict[int, :class:`~compas.colors.Color`] Mapping between faces and colors. Missing faces get the default face color: :attr:`default_facecolor`. + default_facecolor : :class:`~compas.colors.Color` + The default color of the faces of the mesh that don't have a specified color. cell_color : dict[int, :class:`~compas.colors.Color`] Mapping between cells and colors. Missing cells get the default cell color: :attr:`default_facecolor`. + default_cellcolor : :class:`~compas.colors.Color` + The default color of the cells of the mesh that don't have a specified color. vertex_text : dict[int, str] Mapping between vertices and text labels. edge_text : dict[tuple[int, int], str] @@ -57,16 +65,10 @@ class VolMeshArtist(Artist): cell_text : dict[int, str] Mapping between cells and text lables. - Class Attributes - ---------------- - default_vertexcolor : :class:`~compas.colors.Color` - The default color of the vertices of the mesh that don't have a specified color. - default_edgecolor : :class:`~compas.colors.Color` - The default color of the edges of the mesh that don't have a specified color. - default_facecolor : :class:`~compas.colors.Color` - The default color of the faces of the mesh that don't have a specified color. - default_cellcolor : :class:`~compas.colors.Color` - The default color of the cells of the mesh that don't have a specified color. + See Also + -------- + :class:`compas.artists.NetworkArtist` + :class:`compas.artists.MeshArtist` """ diff --git a/src/compas/colors/__init__.py b/src/compas/colors/__init__.py index cff4c91a599..aad49209bd0 100644 --- a/src/compas/colors/__init__.py +++ b/src/compas/colors/__init__.py @@ -1,27 +1,3 @@ -""" -******************************************************************************** -colors -******************************************************************************** - -.. currentmodule:: compas.colors - -.. rst-class:: lead - -This package provides a class for working with colors in different color spaces, -and color maps for various color palettes. - - -Classes -======= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Color - ColorMap - -""" from __future__ import absolute_import from __future__ import division from __future__ import print_function diff --git a/src/compas/colors/color.py b/src/compas/colors/color.py index 64f05d9c9bf..6d7d3c6b251 100644 --- a/src/compas/colors/color.py +++ b/src/compas/colors/color.py @@ -98,6 +98,10 @@ class Color(Data): >>> Color.navy().is_light False + See Also + -------- + :class:`compas.colors.ColorMap` + """ def __init__(self, red, green, blue, alpha=1.0, **kwargs): @@ -360,8 +364,8 @@ def from_hls(cls, h, l, s): # noqa: E741 ------- :class:`~compas.colors.Color` - See Also - -------- + References + ---------- https://en.wikipedia.org/wiki/HSL_and_HSV """ @@ -385,8 +389,8 @@ def from_hsv(cls, h, s, v): ------- :class:`~compas.colors.Color` - See Also - -------- + References + ---------- https://en.wikipedia.org/wiki/HSL_and_HSV """ @@ -410,8 +414,8 @@ def from_yiq(cls, y, i, q): ------- :class:`~compas.colors.Color` - See Also - -------- + References + ---------- https://en.wikipedia.org/wiki/YIQ """ @@ -435,8 +439,8 @@ def from_yuv(cls, y, u, v): ------- :class:`~compas.colors.Color` - See Also - -------- + References + ---------- https://en.wikipedia.org/wiki/YUV """ @@ -474,11 +478,7 @@ def from_i(cls, i): elif i == 0.75: r, g, b = 255, 255, 0 elif 0.75 < i < 1.0: - r, g, b, = ( - 255, - int(255 - 255 * 4 * (i - 0.75)), - 0, - ) + (r, g, b) = (255, int(255 - 255 * 4 * (i - 0.75)), 0) elif i == 1.0: r, g, b = 255, 0, 0 else: @@ -518,9 +518,10 @@ def from_name(cls, name): ------- :class:`~compas.colors.Color` - See Also - -------- + References + ---------- https://www.w3.org/TR/css-color-3/#svg-color + """ rgb255 = HTML_TO_RGB255.get(name.lower()) if rgb255 is None: diff --git a/src/compas/colors/colormap.py b/src/compas/colors/colormap.py index 07a96fb9d87..5f9306848e4 100644 --- a/src/compas/colors/colormap.py +++ b/src/compas/colors/colormap.py @@ -50,6 +50,10 @@ class ColorMap(object): >>> cmap = ColorMap.from_color(Color.red(), rangetype='light') >>> cmap.plot() # doctest: +SKIP + See Also + -------- + :class:`compas.colors.Color` + """ def __init__(self, colors): diff --git a/src/compas/data/__init__.py b/src/compas/data/__init__.py index 136a0af4d57..44e1154e6e2 100644 --- a/src/compas/data/__init__.py +++ b/src/compas/data/__init__.py @@ -1,67 +1,3 @@ -""" -******************************************************************************** -data -******************************************************************************** - -.. currentmodule:: compas.data - -.. rst-class:: lead - -This package provides a base data class for all COMPAS data objects such as geometry objects, robots, and data structures, -and the infrastructure for data validation, conversion, coercion, and JSON serialisation. - - -Classes -======= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Data - DataEncoder - DataDecoder - - -Functions -========= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - json_load - json_loads - json_dump - json_dumps - - -Validators -========== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - is_sequence_of_int - is_sequence_of_uint - is_sequence_of_float - is_int3 - is_float3 - is_float4x4 - validate_data - - -Exceptions -========== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - DecoderError - -""" from __future__ import absolute_import from .exceptions import DecoderError @@ -71,6 +7,7 @@ from .validators import is_int3 from .validators import is_float3 from .validators import is_float4x4 +from .validators import is_item_iterable from .validators import validate_data from .encoders import DataEncoder from .encoders import DataDecoder @@ -89,6 +26,7 @@ "is_int3", "is_float3", "is_float4x4", + "is_item_iterable", "json_load", "json_loads", "json_dump", diff --git a/src/compas/data/data.py b/src/compas/data/data.py index bf51b686ec6..5d52603a023 100644 --- a/src/compas/data/data.py +++ b/src/compas/data/data.py @@ -2,7 +2,6 @@ from __future__ import absolute_import from __future__ import division -import os import json import hashlib from uuid import uuid4 @@ -11,9 +10,6 @@ import compas -from compas.data.encoders import DataEncoder -from compas.data.encoders import DataDecoder - # ============================================================================== # If you ever feel tempted to use ABCMeta in your code: don't, just DON'T. @@ -53,6 +49,11 @@ class Data(object): This name is not necessarily unique and can be set by the user. The default value is the object's class name: ``self.__class__.__name__``. + See Also + -------- + :class:`compas.data.DataEncoder` + :class:`compas.data.DataDecoder` + Notes ----- Objects created from classes that implement this data class @@ -103,12 +104,11 @@ class Data(object): """ + JSONSCHEMA = {} + def __init__(self, name=None): self._guid = None self._name = None - self._jsondefinitions = None - self._JSONSCHEMA = None - self._jsonvalidator = None if name: self.name = name @@ -128,45 +128,6 @@ def __setstate__(self, state): if "guid" in state: self._guid = UUID(state["guid"]) - @property - def DATASCHEMA(self): - """schema.Schema : The schema of the data of this object.""" - raise NotImplementedError - - @property - def JSONSCHEMANAME(self): - """str : The schema of the data of this object in JSON format.""" - raise NotImplementedError - - @property - def JSONSCHEMA(self): - """dict : The schema of the JSON representation of the data of this object.""" - if not self._JSONSCHEMA: - schema_filename = "{}.json".format(self.JSONSCHEMANAME.lower()) - schema_path = os.path.join(os.path.dirname(__file__), "schemas", schema_filename) - with open(schema_path, "r") as fp: - self._JSONSCHEMA = json.load(fp) - return self._JSONSCHEMA - - @property - def jsondefinitions(self): - """dict : Reusable schema definitions.""" - if not self._jsondefinitions: - schema_path = os.path.join(os.path.dirname(__file__), "schemas", "compas.json") - with open(schema_path, "r") as fp: - self._jsondefinitions = json.load(fp) - return self._jsondefinitions - - @property - def jsonvalidator(self): - """jsonschema.Draft7Validator : JSON schema validator for draft 7.""" - if not self._jsonvalidator: - from jsonschema import RefResolver, Draft7Validator - - resolver = RefResolver.from_schema(self.jsondefinitions) - self._jsonvalidator = Draft7Validator(self.JSONSCHEMA, resolver=resolver) - return self._jsonvalidator - @property def dtype(self): return "{}/{}".format(".".join(self.__class__.__module__.split(".")[:2]), self.__class__.__name__) @@ -259,7 +220,7 @@ def from_json(cls, filepath): data = compas.json_load(filepath) return cls.from_data(data) - def to_json(self, filepath, pretty=False): + def to_json(self, filepath, pretty=False, compact=False): """Serialize the data representation of an object to a JSON file. Parameters @@ -268,13 +229,15 @@ def to_json(self, filepath, pretty=False): The path or file-like object to the file containing the data. pretty : bool, optional If True, serialize to a "pretty", human-readable representation. + compact : bool, optional + If True, serialize to a compact representation without any whitespace. Returns ------- None """ - compas.json_dump(self.data, filepath, pretty) + compas.json_dump(self.data, filepath, pretty=pretty, compact=compact) @classmethod def from_jsonstring(cls, string): @@ -294,13 +257,15 @@ def from_jsonstring(cls, string): data = compas.json_loads(string) return cls.from_data(data) - def to_jsonstring(self, pretty=False): + def to_jsonstring(self, pretty=False, compact=False): """Serialize the data representation of an object to a JSON string. Parameters ---------- pretty : bool, optional If True serialize a pretty representation of the data. + compact : bool, optional + If True serialize a compact representation of the data. Returns ------- @@ -308,7 +273,7 @@ def to_jsonstring(self, pretty=False): The object's data dict in JSON string format. """ - return compas.json_dumps(self.data, pretty) + return compas.json_dumps(self.data, pretty=pretty, compact=compact) def copy(self, cls=None): """Make an independent copy of the data object. @@ -329,51 +294,69 @@ def copy(self, cls=None): cls = type(self) return cls.from_data(deepcopy(self.data)) - def validate_data(self): - """Validate the object's data against its data schema. + @classmethod + def validate_json(cls, filepath): + """Validate the data contained in the JSON document against the object's JSON data schema. + + Parameters + ---------- + filepath : path string | file-like object | URL string + The path, file or URL to the file for validation. Returns ------- - dict - The validated data. - - Raises - ------ - schema.SchemaError + Any """ - import schema + from jsonschema import Draft202012Validator - try: - data = self.DATASCHEMA.validate(self.data) - except schema.SchemaError as e: - print("Validation against the data schema of this object failed.") - raise e - return data + validator = Draft202012Validator(cls.JSONSCHEMA) # type: ignore + jsondata = json.load(filepath) + validator.validate(jsondata) + return jsondata + + @classmethod + def validate_jsonstring(cls, jsonstring): + """Validate the data contained in the JSON string against the objects's JSON data schema. - def validate_json(self): - """Validate the object's data against its json schema. + Parameters + ---------- + jsonstring : str + The JSON string for validation. Returns ------- - str - The validated JSON representation of the data. + Any + + """ + from jsonschema import Draft202012Validator - Raises - ------ - jsonschema.exceptions.ValidationError + validator = Draft202012Validator(cls.JSONSCHEMA) # type: ignore + jsondata = json.loads(jsonstring) + validator.validate(jsondata) + return jsondata + + @classmethod + def validate_jsondata(cls, jsondata): + """Validate the JSON data against the objects's JSON data schema. + + The JSON data is the result of parsing a JSON string or a JSON document. + + Parameters + ---------- + jsondata : Any + The JSON data for validation. + + Returns + ------- + Any """ - import jsonschema - - jsonstring = json.dumps(self.data, cls=DataEncoder) - jsondata = json.loads(jsonstring, cls=DataDecoder) - try: - self.jsonvalidator.validate(jsondata) - except jsonschema.exceptions.ValidationError as e: - print("Validation against the JSON schema of this object failed.") - raise e - return jsonstring + from jsonschema import Draft202012Validator + + validator = Draft202012Validator(cls.JSONSCHEMA) # type: ignore + validator.validate(jsondata) + return jsondata def sha256(self, as_string=False): """Compute a hash of the data for comparison during version control using the sha256 algorithm. diff --git a/src/compas/data/encoders.py b/src/compas/data/encoders.py index da75480e338..f14c449af65 100644 --- a/src/compas/data/encoders.py +++ b/src/compas/data/encoders.py @@ -110,6 +110,18 @@ def default(self, o): The serialized object. """ + if hasattr(o, "to_jsondata"): + value = o.to_jsondata() + if hasattr(o, "dtype"): + dtype = o.dtype + else: + dtype = "{}/{}".format( + ".".join(o.__class__.__module__.split(".")[:-1]), + o.__class__.__name__, + ) + + return {"dtype": dtype, "value": value, "guid": str(o.guid)} + if hasattr(o, "to_data"): value = o.to_data() if hasattr(o, "dtype"): @@ -237,7 +249,11 @@ def object_hook(self, o): if IDictionary and isinstance(o, IDictionary[str, object]): obj_value = {key: obj_value[key] for key in obj_value.Keys} - obj = cls.from_data(obj_value) + if hasattr(cls, "from_jsondata"): + obj = cls.from_jsondata(obj_value) + else: + obj = cls.from_data(obj_value) + if "guid" in o: obj._guid = uuid.UUID(o["guid"]) diff --git a/src/compas/data/json.py b/src/compas/data/json.py index 0f1245e73af..cb226d70815 100644 --- a/src/compas/data/json.py +++ b/src/compas/data/json.py @@ -8,7 +8,7 @@ from compas.data import DataDecoder -def json_dump(data, fp, pretty=False): +def json_dump(data, fp, pretty=False, compact=False): """Write a collection of COMPAS object data to a JSON file. Parameters @@ -20,11 +20,19 @@ def json_dump(data, fp, pretty=False): A writeable file-like object or the path to a file. pretty : bool, optional If True, format the output with newlines and indentation. + compact : bool, optional + If True, format the output without any whitespace. Returns ------- None + See Also + -------- + :class:`compas.data.json_dumps` + :class:`compas.data.json_load` + :class:`compas.data.json_loads` + Examples -------- >>> import compas @@ -37,11 +45,17 @@ def json_dump(data, fp, pretty=False): """ with _iotools.open_file(fp, "w") as f: - kwargs = dict(sort_keys=True, indent=4) if pretty else {} + kwargs = {} + if pretty: + kwargs["sort_keys"] = True + kwargs["indent"] = 4 + if compact: + kwargs["indent"] = None + kwargs["separators"] = (",", ":") return json.dump(data, f, cls=DataEncoder, **kwargs) -def json_dumps(data, pretty=False): +def json_dumps(data, pretty=False, compact=False): """Write a collection of COMPAS objects to a JSON string. Parameters @@ -51,11 +65,19 @@ def json_dumps(data, pretty=False): This includes any (combination of) COMPAS object(s). pretty : bool, optional If True, format the output with newlines and indentation. + compact : bool, optional + If True, format the output without any whitespace. Returns ------- str + See Also + -------- + :class:`compas.data.json_dump` + :class:`compas.data.json_load` + :class:`compas.data.json_loads` + Examples -------- >>> import compas @@ -67,7 +89,13 @@ def json_dumps(data, pretty=False): True """ - kwargs = dict(sort_keys=True, indent=4) if pretty else {} + kwargs = {} + if pretty: + kwargs["sort_keys"] = True + kwargs["indent"] = 4 + if compact: + kwargs["indent"] = None + kwargs["separators"] = (",", ":") return json.dumps(data, cls=DataEncoder, **kwargs) @@ -84,6 +112,12 @@ def json_load(fp): object The (COMPAS) data contained in the file. + See Also + -------- + :class:`compas.data.json_dump` + :class:`compas.data.json_dumps` + :class:`compas.data.json_loads` + Examples -------- >>> import compas @@ -112,6 +146,12 @@ def json_loads(s): obj The (COMPAS) data contained in the string. + See Also + -------- + :class:`compas.data.json_dump` + :class:`compas.data.json_dumps` + :class:`compas.data.json_load` + Examples -------- >>> import compas @@ -124,3 +164,47 @@ def json_loads(s): """ return json.loads(s, cls=DataDecoder) + + +def json_validate(filepath, schema): + """Validates a JSON document with respect to a schema and return the JSON object instance if it is valid. + + Parameters + ---------- + filepath : path string | file-like object | URL string + The filepath of the JSON document. + schema : string + The JSON schema. + + Raises + ------ + jsonschema.exceptions.SchemaError + If the schema itself is invalid. + jsonschema.exceptions.ValidationError + If the document is invalid with respect to the schema. + + Returns + ------- + object + The JSON object contained in the document. + + """ + import jsonschema + import jsonschema.exceptions + + data = json_load(filepath) + + try: + jsonschema.validate(data, schema) + except jsonschema.exceptions.SchemaError as e: + print("The provided schema is invalid:\n\n{}\n\n".format(schema)) + raise e + except jsonschema.exceptions.ValidationError as e: + print( + "The provided JSON document is invalid compared to the provided schema:\n\n{}\n\n{}\n\n".format( + schema, data + ) + ) + raise e + + return data diff --git a/src/compas/data/schemas/box.json b/src/compas/data/schemas/box.json deleted file mode 100644 index 3fd28e139ca..00000000000 --- a/src/compas/data/schemas/box.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "box.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "frame": { - "$ref": "compas.json#/definitions/frame" - }, - "xsize": { - "type": "number", - "exclusiveMinimum": 0 - }, - "ysize": { - "type": "number", - "exclusiveMinimum": 0 - }, - "zsize": { - "type": "number", - "exclusiveMinimum": 0 - } - }, - "required": [ - "frame", - "xsize", - "ysize", - "zsize" - ] -} diff --git a/src/compas/data/schemas/brep.json b/src/compas/data/schemas/brep.json deleted file mode 100644 index 9bd377d9a6b..00000000000 --- a/src/compas/data/schemas/brep.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "brep.json", - "$compas": "1.16.0", - "type": "object", - "properties": { - "faces": { - "type": "array", - "minItems": 1, - "items": {} - } - } -} diff --git a/src/compas/data/schemas/capsule.json b/src/compas/data/schemas/capsule.json deleted file mode 100644 index efaebb5d523..00000000000 --- a/src/compas/data/schemas/capsule.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "capsule.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "line": { - "$ref": "compas.json#/definitions/line" - }, - "radius": { - "type": "number", - "exclusiveMinimum": 0 - } - }, - "required": [ - "line", - "radius" - ] -} diff --git a/src/compas/data/schemas/circle.json b/src/compas/data/schemas/circle.json deleted file mode 100644 index 01390ecea12..00000000000 --- a/src/compas/data/schemas/circle.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "circle.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "plane": {"$ref": "compas.json#/definitions/plane"}, - "radius": { - "type": "number", - "exclusiveMinimum": 0 - } - }, - "required": [ - "plane", - "radius" - ] -} diff --git a/src/compas/data/schemas/compas.json b/src/compas/data/schemas/compas.json deleted file mode 100644 index 415d72453cf..00000000000 --- a/src/compas/data/schemas/compas.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "compas.json", - "$compas": "1.7.1", - "definitions": { - "point": { - "type": "array", - "minItems": 3, - "maxItems": 3, - "items": { - "type": "number" - } - }, - "vector": { - "type": "array", - "minItems": 3, - "maxItems": 3, - "items": { - "type": "number" - } - }, - "line": { - "type": "object", - "properties": { - "start": { - "$ref": "#/definitions/point" - }, - "end": { - "$ref": "#/definitions/point" - } - }, - "required": [ - "start", - "end" - ] - }, - "plane": { - "type": "object", - "properties": { - "point": { - "$ref": "#/definitions/point" - }, - "normal": { - "$ref": "#/definitions/vector" - } - }, - "required": [ - "point", - "normal" - ] - }, - "circle": { - "type": "object", - "properties": { - "plane": { - "$ref": "#/definitions/plane" - }, - "radius": { - "type": "number", - "exclusiveMinimum": 0 - } - }, - "required": [ - "plane", - "radius" - ] - }, - "frame": { - "type": "object", - "properties": { - "point": { - "$ref": "#/definitions/point" - }, - "xaxis": { - "$ref": "#/definitions/vector" - }, - "yaxis": { - "$ref": "#/definitions/vector" - } - }, - "required": [ - "point", - "xaxis", - "yaxis" - ] - } - } -} diff --git a/src/compas/data/schemas/cone.json b/src/compas/data/schemas/cone.json deleted file mode 100644 index cc1957fdfbc..00000000000 --- a/src/compas/data/schemas/cone.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "cone.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "circle": { - "$ref": "compas.json#/definitions/circle" - }, - "height": { - "type": "number", - "exclusiveMinimum": 0 - } - }, - "required": [ - "circle", - "height" - ] -} diff --git a/src/compas/data/schemas/cylinder.json b/src/compas/data/schemas/cylinder.json deleted file mode 100644 index 341c5926855..00000000000 --- a/src/compas/data/schemas/cylinder.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "cylinder.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "circle": { - "$ref": "compas.json#/definitions/circle" - }, - "height": { - "type": "number", - "exclusiveMinimum": 0 - } - }, - "required": [ - "circle", - "height" - ] -} diff --git a/src/compas/data/schemas/ellipse.json b/src/compas/data/schemas/ellipse.json deleted file mode 100644 index 23c6f56f71d..00000000000 --- a/src/compas/data/schemas/ellipse.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "ellipse.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "plane": {"$ref": "compas.json#/definitions/plane"}, - "major": { - "type": "number", - "exclusiveMinimum": 0 - }, - "minor": { - "type": "number", - "exclusiveMinimum": 0 - } - }, - "required": [ - "plane", - "major", - "minor" - ] -} diff --git a/src/compas/data/schemas/frame.json b/src/compas/data/schemas/frame.json deleted file mode 100644 index 5dd382fbe24..00000000000 --- a/src/compas/data/schemas/frame.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "frame.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "point": { - "$ref": "compas.json#/definitions/point" - }, - "xaxis": { - "$ref": "compas.json#/definitions/vector" - }, - "yaxis": { - "$ref": "compas.json#/definitions/vector" - } - }, - "required": [ - "point", - "xaxis", - "yaxis" - ] -} diff --git a/src/compas/data/schemas/graph.json b/src/compas/data/schemas/graph.json deleted file mode 100644 index f9d3944bebb..00000000000 --- a/src/compas/data/schemas/graph.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "graph.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "attributes": { - "type": "object" - }, - "dna": { - "type": "object" - }, - "dea": { - "type": "object" - }, - "node": { - "type": "object" - }, - "edge": { - "type": "object" - }, - "adjacency": { - "type": "object" - }, - "max_node": { - "type": "integer", - "minimum": -1 - } - }, - "required": [ - "attributes", - "dna", - "dea", - "node", - "edge", - "adjacency", - "max_node" - ] -} diff --git a/src/compas/data/schemas/halfedge.json b/src/compas/data/schemas/halfedge.json deleted file mode 100644 index 0b973c9ee8e..00000000000 --- a/src/compas/data/schemas/halfedge.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "halfedge.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "attributes": { - "type": "object" - }, - "dva": { - "type": "object" - }, - "dea": { - "type": "object" - }, - "dfa": { - "type": "object" - }, - "vertex": { - "type": "object", - "propertyNames": { - "pattern": "^[0-9]+$" - }, - "patternProperties": { - "^[0-9]+$": { - "type": "object", - "properties": { - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "z": { - "type": "number" - } - }, - "additionalProperties": true - } - } - }, - "face": { - "type": "object", - "propertyNames": { - "pattern": "^[0-9]+$" - }, - "patternProperties": { - "^[0-9]+$": { - "type": "array", - "items": { - "type": "integer", - "minimum": 0 - }, - "minItems": 3, - "uniqueItems": true - } - } - }, - "facedata": { - "type": "object", - "propertyNames": { - "pattern": "^[0-9]+$" - }, - "patternProperties": { - "^[0-9]+$": { - "type": "object" - } - } - }, - "edgedata": { - "type": "object", - "propertyNames": { - "pattern": "^([0-9]+-[0-9]+)$" - }, - "patternProperties": { - "^([0-9]+-[0-9]+)$": { - "type": "object" - } - } - }, - "max_vertex": { - "type": "integer", - "minimum": -1 - }, - "max_face": { - "type": "integer", - "minimum": -1 - } - }, - "required": [ - "attributes", - "dva", - "dea", - "dfa", - "vertex", - "face", - "facedata", - "edgedata", - "max_vertex", - "max_face" - ] -} diff --git a/src/compas/data/schemas/halfface.json b/src/compas/data/schemas/halfface.json deleted file mode 100644 index 89d2def20fe..00000000000 --- a/src/compas/data/schemas/halfface.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "halfface.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "attributes": { - "type": "object" - }, - "dva": { - "type": "object" - }, - "dea": { - "type": "object" - }, - "dfa": { - "type": "object" - }, - "dca": { - "type": "object" - }, - "vertex": { - "type": "object", - "propertyNames": { - "pattern": "^[0-9]+$" - }, - "patternProperties": { - "^[0-9]+$": { - "type": "object", - "properties": { - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "z": { - "type": "number" - } - }, - "additionalProperties": true - } - } - }, - "cell": { - "type": "object", - "propertyNames": { - "pattern": "^[0-9]+$" - }, - "patternProperties": { - "^[0-9]+$": { - "type": "object", - "propertyNames": { - "pattern": "^[0-9]+$" - }, - "patternProperties": { - "^[0-9]+$": { - "type": "object", - "propertyNames": { - "pattern": "^[0-9]+$" - }, - "patternProperties": { - "^[0-9]+$": { - "type": "array", - "items": { - "type": "integer", - "minimum": 0 - }, - "minItems": 3, - "uniqueItems": true - } - } - } - } - } - } - }, - "face_data": { - "type": "object", - "propertyNames": { - "pattern": "^[0-9]+(-[0-9]+)+$" - }, - "patternProperties": { - "^[0-9]+(-[0-9]+)+$": { - "type": "object" - } - } - }, - "edge_data": { - "type": "object", - "propertyNames": { - "pattern": "^[0-9]+-[0-9]+$" - }, - "patternProperties": { - "^[0-9]+-[0-9]+$": { - "type": "object" - } - } - }, - "cell_data": { - "type": "object", - "propertyNames": { - "pattern": "^[0-9]+$" - }, - "patternProperties": { - "^[0-9]+$": { - "type": "object" - } - } - }, - "max_vertex": { - "type": "integer", - "minimum": -1 - }, - "max_face": { - "type": "integer", - "minimum": -1 - }, - "max_cell": { - "type": "integer", - "minimum": -1 - } - }, - "required": [ - "attributes", - "dva", - "dea", - "dfa", - "dca", - "vertex", - "cell", - "face_data", - "edge_data", - "cell_data", - "max_vertex", - "max_face", - "max_cell" - ] -} diff --git a/src/compas/data/schemas/line.json b/src/compas/data/schemas/line.json deleted file mode 100644 index 26ff9cca834..00000000000 --- a/src/compas/data/schemas/line.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "line.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "start": { - "$ref": "compas.json#/definitions/point" - }, - "end": { - "$ref": "compas.json#/definitions/point" - } - }, - "required": [ - "start", - "end" - ] -} diff --git a/src/compas/data/schemas/plane.json b/src/compas/data/schemas/plane.json deleted file mode 100644 index 05e32b686cf..00000000000 --- a/src/compas/data/schemas/plane.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "plane.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "point": { - "$ref": "compas.json#/definitions/point" - }, - "normal": { - "$ref": "compas.json#/definitions/vector" - } - }, - "required": [ - "point", - "normal" - ] -} diff --git a/src/compas/data/schemas/point.json b/src/compas/data/schemas/point.json deleted file mode 100644 index 231e9b8f99e..00000000000 --- a/src/compas/data/schemas/point.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "point.json", - "$compas": "1.7.1", - "type": "array", - "minItems": 3, - "maxItems": 3, - "items": { - "type": "number" - } -} diff --git a/src/compas/data/schemas/pointcloud.json b/src/compas/data/schemas/pointcloud.json deleted file mode 100644 index e83caf25465..00000000000 --- a/src/compas/data/schemas/pointcloud.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "pointcloud.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "points": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "compas.json#/definitions/point" - } - } - }, - "required": [ - "points" - ] -} diff --git a/src/compas/data/schemas/polygon.json b/src/compas/data/schemas/polygon.json deleted file mode 100644 index 4a7acec348b..00000000000 --- a/src/compas/data/schemas/polygon.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "polygon.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "points": { - "type": "array", - "minItems": 2, - "items": { - "$ref": "compas.json#/definitions/point" - } - } - }, - "required": [ - "points" - ] -} diff --git a/src/compas/data/schemas/polyhedron.json b/src/compas/data/schemas/polyhedron.json deleted file mode 100644 index 52b0bffbdf5..00000000000 --- a/src/compas/data/schemas/polyhedron.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "polyhedron.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "vertices": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "number" - }, - "minItems": 3, - "maxItems": 3 - }, - "minItems": 4 - }, - "faces": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "integer" - }, - "minItems": 3, - "uniqueItems": true, - "minimum": 0 - }, - "minItems": 4 - } - }, - "required": [ - "vertices", - "faces" - ] -} diff --git a/src/compas/data/schemas/polyline.json b/src/compas/data/schemas/polyline.json deleted file mode 100644 index fd51046a3ad..00000000000 --- a/src/compas/data/schemas/polyline.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "polyline.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "points": { - "type": "array", - "minItems": 2, - "items": { - "$ref": "compas.json#/definitions/point" - } - } - }, - "required": [ - "points" - ] -} diff --git a/src/compas/data/schemas/quaternion.json b/src/compas/data/schemas/quaternion.json deleted file mode 100644 index 7647b8321ad..00000000000 --- a/src/compas/data/schemas/quaternion.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "quaternion.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "w": { - "type": "number" - }, - "x": { - "type": "number" - }, - "y": { - "type": "number" - }, - "z": { - "type": "number" - } - }, - "required": [ - "w", - "x", - "y", - "z" - ] -} diff --git a/src/compas/data/schemas/sphere.json b/src/compas/data/schemas/sphere.json deleted file mode 100644 index 0940c509c96..00000000000 --- a/src/compas/data/schemas/sphere.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "sphere.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "point": { - "$ref": "compas.json#/definitions/point" - }, - "radius": { - "type": "number", - "exclusiveMinimum": 0 - } - }, - "required": [ - "point", - "radius" - ] -} diff --git a/src/compas/data/schemas/torus.json b/src/compas/data/schemas/torus.json deleted file mode 100644 index 5f1c53d11e7..00000000000 --- a/src/compas/data/schemas/torus.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "torus.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "plane": { - "$ref": "compas.json#/definitions/plane" - }, - "radius_axis": { - "type": "number", - "exclusiveMinimum": 0 - }, - "radius_pipe": { - "type": "number", - "exclusiveMinimum": 0 - } - }, - "required": [ - "plane", - "radius_axis", - "radius_pipe" - ] -} diff --git a/src/compas/data/schemas/transformation.json b/src/compas/data/schemas/transformation.json deleted file mode 100644 index bf87532a20b..00000000000 --- a/src/compas/data/schemas/transformation.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "transformation.json", - "$compas": "1.7.1", - "type": "object", - "properties": { - "matrix": { - "type": "array", - "minItems": 4, - "maxItems": 4, - "items": { - "type": "array", - "minItems": 4, - "maxItems": 4, - "items": { - "type": "number" - } - } - } - }, - "required": [ - "matrix" - ] -} diff --git a/src/compas/data/schemas/vector.json b/src/compas/data/schemas/vector.json deleted file mode 100644 index 620fc67bcca..00000000000 --- a/src/compas/data/schemas/vector.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "vector.json", - "$compas": "1.7.1", - "type": "array", - "minItems": 3, - "maxItems": 3, - "items": { - "type": "number" - } -} diff --git a/src/compas/datastructures/__init__.py b/src/compas/datastructures/__init__.py index 085a6f0b7ce..32a084d67b2 100644 --- a/src/compas/datastructures/__init__.py +++ b/src/compas/datastructures/__init__.py @@ -1,239 +1,66 @@ -""" -******************************************************************************** -datastructures -******************************************************************************** - -.. currentmodule:: compas.datastructures - -Classes -======= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Datastructure - Graph - HalfEdge - HalfFace - Mesh - Network - VolMesh - Assembly - Part - Feature - GeometricFeature - ParametricFeature - - -Exceptions -========== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - AssemblyError - FeatureError - - -Functions -========= - -Network -------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - network_complement - network_count_crossings - network_disconnected_edges - network_disconnected_nodes - network_embed_in_plane_proxy - network_embed_in_plane - network_explode - network_find_crossings - network_find_cycles - network_is_connected - network_is_crossed - network_is_planar_embedding - network_is_planar - network_is_xy - network_join_edges - network_polylines - network_shortest_path - network_smooth_centroid - network_split_edge - network_transform - network_transformed - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - network_adjacency_matrix - network_connectivity_matrix - network_degree_matrix - network_laplacian_matrix - - -Mesh ----- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - mesh_add_vertex_to_face_edge - mesh_bounding_box_xy - mesh_bounding_box - mesh_collapse_edge - mesh_connected_components - mesh_conway_ambo - mesh_conway_bevel - mesh_conway_dual - mesh_conway_expand - mesh_conway_gyro - mesh_conway_join - mesh_conway_kis - mesh_conway_meta - mesh_conway_needle - mesh_conway_ortho - mesh_conway_snub - mesh_conway_truncate - mesh_conway_zip - mesh_delete_duplicate_vertices - mesh_disconnected_faces - mesh_disconnected_vertices - mesh_dual - mesh_explode - mesh_face_adjacency - mesh_flatness - mesh_flip_cycles - mesh_insert_vertex_on_edge - mesh_is_connected - mesh_merge_faces - mesh_offset - mesh_planarize_faces - mesh_quads_to_triangles - mesh_slice_plane - mesh_smooth_area - mesh_smooth_centerofmass - mesh_smooth_centroid - mesh_split_edge - mesh_split_face - mesh_split_strip - mesh_subdivide_catmullclark - mesh_subdivide_corner - mesh_subdivide_doosabin - mesh_subdivide_frames - mesh_subdivide_quad - mesh_subdivide_tri - mesh_subdivide - mesh_substitute_vertex_in_faces - mesh_thicken - mesh_transform - mesh_transformed - mesh_unify_cycles - mesh_unweld_edges - mesh_unweld_vertices - mesh_weld - meshes_join_and_weld - meshes_join - trimesh_collapse_edge - trimesh_face_circle - trimesh_gaussian_curvature - trimesh_mean_curvature - trimesh_remesh - trimesh_split_edge - trimesh_subdivide_loop - trimesh_swap_edge - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - mesh_adjacency_matrix - mesh_connectivity_matrix - mesh_contours_numpy - mesh_degree_matrix - mesh_face_matrix - mesh_geodesic_distances_numpy - mesh_isolines_numpy - mesh_laplacian_matrix - mesh_oriented_bounding_box_numpy - mesh_oriented_bounding_box_xy_numpy - mesh_transform_numpy - mesh_transformed_numpy - trimesh_cotangent_laplacian_matrix - trimesh_descent - trimesh_pull_points_numpy - trimesh_samplepoints_numpy - trimesh_smooth_laplacian_cotangent - trimesh_vertexarea_matrix - - -VolMesh -------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - volmesh_bounding_box - volmesh_transform - volmesh_transformed - - -Assembly --------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - -""" from __future__ import absolute_import import compas from .datastructure import Datastructure -from .graph import Graph -from .network import ( - Network, - network_complement, +# ============================================================================= +# Graphs +# ============================================================================= + +# ============================================================================= +# Networks +# ============================================================================= + +from .network.operations.join import network_join_edges, network_polylines +from .network.operations.split import network_split_edge + +from .network.combinatorics import network_is_connected +from .network.complementarity import network_complement +from .network.duality import network_find_cycles +from .network.explode import network_disconnected_edges, network_disconnected_nodes, network_explode +from .network.planarity import ( network_count_crossings, - network_disconnected_edges, - network_disconnected_nodes, - network_embed_in_plane_proxy, network_embed_in_plane, - network_explode, + network_embed_in_plane_proxy, network_find_crossings, - network_find_cycles, - network_is_connected, network_is_crossed, - network_is_planar_embedding, network_is_planar, + network_is_planar_embedding, network_is_xy, - network_join_edges, - network_polylines, - network_shortest_path, - network_smooth_centroid, - network_split_edge, - network_transform, - network_transformed, ) -from .halfedge import HalfEdge -from .mesh import ( - Mesh, - mesh_add_vertex_to_face_edge, - mesh_bounding_box_xy, - mesh_bounding_box, - mesh_collapse_edge, - mesh_connected_components, +from .network.smoothing import network_smooth_centroid +from .network.transformations import network_transform, network_transformed +from .network.traversal import network_shortest_path + +if not compas.IPY: + from .network.matrices import ( + network_adjacency_matrix, + network_connectivity_matrix, + network_degree_matrix, + network_laplacian_matrix, + ) + +# ============================================================================= +# Halfedges +# ============================================================================= + +# ============================================================================= +# Meshes +# ============================================================================= + +from .mesh.operations.collapse import mesh_collapse_edge, trimesh_collapse_edge +from .mesh.operations.insert import mesh_add_vertex_to_face_edge, mesh_insert_vertex_on_edge +from .mesh.operations.merge import mesh_merge_faces +from .mesh.operations.split import mesh_split_edge, mesh_split_face, mesh_split_strip, trimesh_split_edge +from .mesh.operations.substitute import mesh_substitute_vertex_in_faces +from .mesh.operations.swap import trimesh_swap_edge +from .mesh.operations.weld import mesh_unweld_edges, mesh_unweld_vertices + +from .mesh.bbox import mesh_bounding_box, mesh_bounding_box_xy # this needs to be moved to geometry +from .mesh.clean import mesh_delete_duplicate_vertices +from .mesh.combinatorics import mesh_connected_components, mesh_is_connected +from .mesh.conway import ( mesh_conway_ambo, mesh_conway_bevel, mesh_conway_dual, @@ -247,98 +74,88 @@ mesh_conway_snub, mesh_conway_truncate, mesh_conway_zip, - mesh_delete_duplicate_vertices, - mesh_disconnected_faces, - mesh_disconnected_vertices, - mesh_dual, - mesh_explode, - mesh_face_adjacency, - mesh_flatness, - mesh_flip_cycles, - mesh_insert_vertex_on_edge, - mesh_is_connected, - mesh_merge_faces, - mesh_offset, - mesh_planarize_faces, - mesh_quads_to_triangles, - mesh_slice_plane, - mesh_smooth_area, - mesh_smooth_centerofmass, - mesh_smooth_centroid, - mesh_split_edge, - mesh_split_face, - mesh_split_strip, +) +from .mesh.curvature import trimesh_gaussian_curvature, trimesh_mean_curvature # this needs to be moved to geometry +from .mesh.duality import mesh_dual +from .mesh.explode import mesh_disconnected_faces, mesh_disconnected_vertices, mesh_explode +from .mesh.geometry import trimesh_face_circle # this needs to be moved to geometry +from .mesh.join import mesh_weld, meshes_join, meshes_join_and_weld # used by offset +from .mesh.orientation import mesh_face_adjacency, mesh_flip_cycles, mesh_unify_cycles # used by offset +from .mesh.offset import mesh_offset, mesh_thicken +from .mesh.planarisation import mesh_flatness, mesh_planarize_faces # this needs to be moved to geometry +from .mesh.remesh import trimesh_remesh +from .mesh.slice import mesh_slice_plane +from .mesh.smoothing import mesh_smooth_area, mesh_smooth_centerofmass, mesh_smooth_centroid +from .mesh.subdivision import ( + mesh_subdivide, mesh_subdivide_catmullclark, mesh_subdivide_corner, mesh_subdivide_doosabin, mesh_subdivide_frames, mesh_subdivide_quad, mesh_subdivide_tri, - mesh_subdivide, - mesh_substitute_vertex_in_faces, - mesh_thicken, - mesh_transform, - mesh_transformed, - mesh_unify_cycles, - mesh_unweld_edges, - mesh_unweld_vertices, - mesh_weld, - meshes_join_and_weld, - meshes_join, - trimesh_collapse_edge, - trimesh_face_circle, - trimesh_gaussian_curvature, - trimesh_mean_curvature, - trimesh_remesh, - trimesh_split_edge, trimesh_subdivide_loop, - trimesh_swap_edge, -) -from .halfface import HalfFace -from .volmesh import ( - VolMesh, - volmesh_bounding_box, - volmesh_transform, - volmesh_transformed, -) - -from .assembly import ( - Assembly, - Part, - AssemblyError, - FeatureError, - Feature, - GeometricFeature, - ParametricFeature, ) +from .mesh.transformations import mesh_transform, mesh_transformed # this needs to be moved to geometry +from .mesh.triangulation import mesh_quads_to_triangles if not compas.IPY: - from .network import ( - network_adjacency_matrix, - network_connectivity_matrix, - network_degree_matrix, - network_laplacian_matrix, - ) - from .mesh import ( + from .mesh.matrices import ( mesh_adjacency_matrix, mesh_connectivity_matrix, - mesh_contours_numpy, mesh_degree_matrix, mesh_face_matrix, - mesh_geodesic_distances_numpy, - mesh_isolines_numpy, mesh_laplacian_matrix, + trimesh_cotangent_laplacian_matrix, + trimesh_vertexarea_matrix, + ) + + from .mesh.bbox_numpy import ( mesh_oriented_bounding_box_numpy, mesh_oriented_bounding_box_xy_numpy, + ) # this needs to be moved to geometry + from .mesh.contours_numpy import mesh_isolines_numpy, mesh_contours_numpy # this needs to be moved to geometry + from .mesh.descent_numpy import trimesh_descent # this needs to be moved to geometry + from .mesh.geodesics_numpy import mesh_geodesic_distances_numpy + from .mesh.pull_numpy import trimesh_pull_points_numpy # this needs to be moved to geometry + from .mesh.smoothing_numpy import trimesh_smooth_laplacian_cotangent + from .mesh.transformations_numpy import ( mesh_transform_numpy, mesh_transformed_numpy, - trimesh_cotangent_laplacian_matrix, - trimesh_descent, - trimesh_pull_points_numpy, - trimesh_samplepoints_numpy, - trimesh_smooth_laplacian_cotangent, - trimesh_vertexarea_matrix, - ) + ) # this needs to be moved to geometry + from .mesh.trimesh_samplepoints_numpy import trimesh_samplepoints_numpy + +# ============================================================================= +# Halffaces +# ============================================================================= + +# ============================================================================= +# Volmeshes +# ============================================================================= + +from .volmesh.bbox import volmesh_bounding_box # this needs to be moved to geometry +from .volmesh.transformations import volmesh_transform, volmesh_transformed # this needs to be moved to geometry + +# ============================================================================= +# Volmeshes +# ============================================================================= + +# ============================================================================= +# Class APIs +# ============================================================================= + +from .graph.graph import Graph +from .network.network import Network + +from .halfedge.halfedge import HalfEdge +from .mesh.mesh import Mesh + +from .halfface.halfface import HalfFace +from .volmesh.volmesh import VolMesh + +from .assembly.exceptions import AssemblyError, FeatureError +from .assembly.assembly import Assembly +from .assembly.part import Feature, GeometricFeature, ParametricFeature, Part BaseNetwork = Network BaseMesh = Mesh diff --git a/src/compas/datastructures/assembly/__init__.py b/src/compas/datastructures/assembly/__init__.py index 3b79b6cdcf7..e69de29bb2d 100644 --- a/src/compas/datastructures/assembly/__init__.py +++ b/src/compas/datastructures/assembly/__init__.py @@ -1,22 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from .exceptions import AssemblyError -from .exceptions import FeatureError -from .assembly import Assembly -from .part import Part -from .part import Feature -from .part import GeometricFeature -from .part import ParametricFeature - - -__all__ = [ - "AssemblyError", - "FeatureError", - "Assembly", - "Part", - "Feature", - "GeometricFeature", - "ParametricFeature", -] diff --git a/src/compas/datastructures/assembly/assembly.py b/src/compas/datastructures/assembly/assembly.py index 1d4b2a48db1..2407b346999 100644 --- a/src/compas/datastructures/assembly/assembly.py +++ b/src/compas/datastructures/assembly/assembly.py @@ -2,8 +2,8 @@ from __future__ import absolute_import from __future__ import division -from ..datastructure import Datastructure -from ..graph import Graph +from compas.datastructures import Datastructure +from compas.datastructures import Graph from .exceptions import AssemblyError @@ -22,9 +22,11 @@ class Assembly(Datastructure): graph : :class:`~compas.datastructures.Graph` The graph that is used under the hood to store the parts and their connections. - Examples + See Also -------- - >>> + :class:`compas.datastructures.Network` + :class:`compas.datastructures.Mesh` + :class:`compas.datastructures.VolMesh` """ diff --git a/src/compas/datastructures/graph/__init__.py b/src/compas/datastructures/graph/__init__.py index b040d910420..e69de29bb2d 100644 --- a/src/compas/datastructures/graph/__init__.py +++ b/src/compas/datastructures/graph/__init__.py @@ -1 +0,0 @@ -from .graph import Graph # noqa: F401 diff --git a/src/compas/datastructures/graph/graph.py b/src/compas/datastructures/graph/graph.py index 3c006debaf4..7d780acda85 100644 --- a/src/compas/datastructures/graph/graph.py +++ b/src/compas/datastructures/graph/graph.py @@ -3,7 +3,6 @@ from __future__ import division from random import sample -from random import choice from ast import literal_eval from compas.datastructures.datastructure import Datastructure @@ -36,12 +35,49 @@ class Graph(Datastructure): It is recommended to add a default to this dictionary using :meth:`update_default_edge_attributes` for every edge attribute used in the data structure. - Examples + See Also -------- - >>> + :class:`compas.datastructures.Network` """ + JSONSCHEMA = { + "type": "object", + "properties": { + "attributes": {"type": "object"}, + "dna": {"type": "object"}, + "dea": {"type": "object"}, + "node": { + "type": "object", + "additionalProperties": {"type": "object"}, + }, + "edge": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": {"type": "object"}, + }, + }, + "adjacency": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": {"type": "null"}, + }, + }, + "max_node": {"type": "integer", "minimum": -1}, + }, + "required": [ + "attributes", + "dna", + "dea", + "node", + "edge", + "adjacency", + "max_node", + ], + } + def __init__(self, name=None, default_node_attributes=None, default_edge_attributes=None): super(Graph, self).__init__() self._max_node = -1 @@ -56,41 +92,62 @@ def __init__(self, name=None, default_node_attributes=None, default_edge_attribu if default_edge_attributes: self.default_edge_attributes.update(default_edge_attributes) + def __str__(self): + tpl = "" + return tpl.format(self.number_of_nodes(), self.number_of_edges()) + # -------------------------------------------------------------------------- # data # -------------------------------------------------------------------------- - @property - def DATASCHEMA(self): - import schema - - return schema.Schema( - { - "attributes": dict, - "dna": dict, - "dea": dict, - "node": dict, - "edge": dict, - "adjacency": dict, - "max_node": schema.And(int, lambda x: x >= -1), - } - ) - - @property - def JSONSCHEMANAME(self): - return "graph" - @property def data(self): data = { "attributes": self.attributes, "dna": self.default_node_attributes, "dea": self.default_edge_attributes, - "node": {}, - "edge": {}, - "adjacency": {}, + "node": self.node, + "edge": self.edge, "max_node": self._max_node, } + return data + + @data.setter + def data(self, data): + self.node = {} + self.edge = {} + self.adjacency = {} + self._max_node = -1 + self.attributes.update(data.get("attributes") or {}) + self.default_node_attributes.update(data.get("dna") or {}) + self.default_edge_attributes.update(data.get("dea") or {}) + node = data.get("node") or {} + edge = data.get("edge") or {} + for node, attr in iter(node.items()): + self.add_node(key=node, attr_dict=attr) + for u, nbrs in iter(edge.items()): + for v, attr in iter(nbrs.items()): + self.add_edge(u, v, attr_dict=attr) + self._max_node = data.get("max_node", self._max_node) + + def to_jsondata(self): + """Returns a dictionary of structured data representing the graph that can be serialised to JSON format. + + This is effectively a post-processing step for the :meth:`to_data` method. + + Returns + ------- + dict + The serialisable structured data dictionary. + + See Also + -------- + :meth:`from_jsondata` + + """ + data = self.data + data["node"] = {} + data["edge"] = {} for key in self.node: data["node"][repr(key)] = self.node[key] for u in self.edge: @@ -99,53 +156,46 @@ def data(self): for v in self.edge[u]: rv = repr(v) data["edge"][ru][rv] = self.edge[u][v] - for u in self.adjacency: - ru = repr(u) - data["adjacency"][ru] = {} - for v in self.adjacency[u]: - rv = repr(v) - data["adjacency"][ru][rv] = None return data - @data.setter - def data(self, data): - if "data" in data: - data = data["data"] - attributes = data.get("attributes") or {} - default_node_attributes = data.get("dna") or {} - default_edge_attributes = data.get("dea") or {} - node = data.get("node") or {} - edge = data.get("edge") or {} - adjacency = data.get("adjacency") or {} - if "max_int_key" in data: - max_node = data["max_int_key"] - else: - max_node = data.get("max_node") - self._max_node = max_node - self.attributes.update(attributes) - self.default_node_attributes.update(default_node_attributes) - self.default_edge_attributes.update(default_edge_attributes) - # add the nodes - self.node = {literal_eval(key): attr for key, attr in iter(node.items())} - # add the edges - self.edge = {} - for u, nbrs in iter(edge.items()): + @classmethod + def from_jsondata(cls, data): + """Construct a graph from structured data representing the graph in JSON format. + + This is effectively a pre-processing step for the :meth:`from_data` method. + + Parameters + ---------- + data : dict + The structured data dictionary. + + Returns + ------- + :class:`~compas.datastructures.Graph` + The constructed graph. + + See Also + -------- + :meth:`to_jsondata` + + """ + _node = data["node"] or {} + _edge = data["edge"] or {} + # process the nodes + node = {literal_eval(key): attr for key, attr in iter(_node.items())} + data["node"] = node + # process the edges + edge = {} + for u, nbrs in iter(_edge.items()): nbrs = nbrs or {} u = literal_eval(u) - self.edge[u] = {} + edge[u] = {} for v, attr in iter(nbrs.items()): attr = attr or {} v = literal_eval(v) - self.edge[u][v] = attr - # add the adjacency - self.adjacency = {} - for u, nbrs in iter(adjacency.items()): - nbrs = nbrs or {} - u = literal_eval(u) - self.adjacency[u] = {} - for v, _ in iter(nbrs.items()): - v = literal_eval(v) - self.adjacency[u][v] = None + edge[u][v] = attr + data["edge"] = edge + return cls.from_data(data) # -------------------------------------------------------------------------- # properties @@ -159,14 +209,6 @@ def name(self): def name(self, value): self.attributes["name"] = value - # -------------------------------------------------------------------------- - # customization - # -------------------------------------------------------------------------- - - def __str__(self): - tpl = "" - return tpl.format(self.number_of_nodes(), self.number_of_edges()) - # -------------------------------------------------------------------------- # constructors # -------------------------------------------------------------------------- @@ -184,6 +226,10 @@ def from_edges(cls, edges): ------- :class:`~compas.datastructures.Graph` + See Also + -------- + :meth:`from_networkx` + """ graph = cls() for u, v in edges: @@ -206,6 +252,11 @@ def from_networkx(cls, graph): ------- :class:`~compas.datastructures.Graph` + See Also + -------- + :meth:`to_networkx` + :meth:`from_edges` + """ g = cls() g.attributes.update(graph.graph) @@ -226,19 +277,23 @@ def to_networkx(self): networkx.DiGraph A newly created NetworkX DiGraph. + See Also + -------- + :meth:`from_networkx` + """ import networkx as nx - graph = nx.DiGraph() - graph.graph.update(self.attributes) + G = nx.DiGraph() + G.graph.update(self.attributes) # type: ignore for node, attr in self.nodes(data=True): - graph.add_node(node, **attr) + G.add_node(node, **attr) # type: ignore for edge, attr in self.edges(data=True): - graph.add_edge(*edge, **attr) + G.add_edge(*edge, **attr) - return graph + return G # -------------------------------------------------------------------------- # helpers @@ -259,78 +314,6 @@ def clear(self): self.edge = {} self.adjacency = {} - def get_any_node(self): - """Get the identifier of a random node. - - .. deprecated:: 1.13.3 - Use :meth:`node_sample` instead. - - Returns - ------- - hashable - The identifier of the node. - - """ - return self.get_any_nodes(1)[0] - - def get_any_nodes(self, n, exclude_leaves=False): - """Get a list of identifiers of a random set of n nodes. - - .. deprecated:: 1.13.3 - Use :meth:`node_sample` instead. - - Parameters - ---------- - n : int - The number of random nodes. - exclude_leaves : bool, optional - If True, exclude the leaves (nodes with only one connected edge) from the set. - - Returns - ------- - list[hashable] - The identifiers of the nodes. - - """ - if exclude_leaves: - nodes = set(self.nodes()) - set(self.leaves()) - else: - nodes = self.nodes() - return sample(list(nodes), n) - - def get_any_edge(self): - """Get the identifier of a random edge. - - .. deprecated:: 1.13.3 - Use :meth:`edge_sample` instead. - - Returns - ------- - tuple[hashable, hashable] - The identifier of the edge in the form of a pair of vertex identifiers. - - """ - return choice(list(self.edges())) - - def get_any_edges(self, n): - """Get the identifiers of a set of random edges. - - .. deprecated:: 1.13.3 - Use :meth:`edge_sample` instead. - - Parameters - ---------- - n : int - The number of edges in the set. - - Returns - ------- - list[tuple[hashable, hashable]] - The identifiers of the random edges. - - """ - return sample(list(self.edges()), n) - def node_sample(self, size=1): """Get a list of identifiers of a random set of n nodes. @@ -344,6 +327,10 @@ def node_sample(self, size=1): list[hashable] The identifiers of the nodes. + See Also + -------- + :meth:`edge_sample` + """ return sample(list(self.nodes()), size) @@ -360,33 +347,47 @@ def edge_sample(self, size=1): list[tuple[hashable, hashable]] The identifiers of the random edges. + See Also + -------- + :meth:`node_sample` + """ return sample(list(self.edges()), size) - def key_index(self): + def node_index(self): """Returns a dictionary that maps node identifiers to their corresponding index in a node list or array. Returns ------- dict[hashable, int] - A dictionary of key-index pairs. + A dictionary of node-index pairs. + + See Also + -------- + :meth:`index_node` + :meth:`edge_index` """ return {key: index for index, key in enumerate(self.nodes())} - def index_key(self): + def index_node(self): """Returns a dictionary that maps the indices of a node list to keys in a node dictionary. Returns ------- dict[int, hashable] - A dictionary of index-key pairs. + A dictionary of index-node pairs. + + See Also + -------- + :meth:`node_index` + :meth:`index_edge` """ return dict(enumerate(self.nodes())) - def uv_index(self): - """Returns a dictionary that maps edge keys (i.e. pairs of vertex keys) + def edge_index(self): + """Returns a dictionary that maps edge identifiers (i.e. pairs of vertex identifiers) to the corresponding edge index in a list or array of edges. Returns @@ -394,18 +395,28 @@ def uv_index(self): dict[tuple[hashable, hashable], int] A dictionary of uv-index pairs. + See Also + -------- + :meth:`index_edge` + :meth:`node_index` + """ return {(u, v): index for index, (u, v) in enumerate(self.edges())} - def index_uv(self): + def index_edge(self): """Returns a dictionary that maps edges in a list to the corresponding - vertex key pairs. + vertex identifier pairs. Returns ------- dict[int, tuple[hashable, hashable]] A dictionary of index-uv pairs. + See Also + -------- + :meth:`edge_index` + :meth:`index_node` + """ return dict(enumerate(self.edges())) @@ -431,6 +442,11 @@ def add_node(self, key=None, attr_dict=None, **kwattr): hashable The identifier of the node. + See Also + -------- + :meth:`add_edge` + :meth:`delete_node` + Notes ----- If no key is provided for the node, one is generated @@ -479,7 +495,12 @@ def add_edge(self, u, v, attr_dict=None, **kwattr): Returns ------- tuple[hashable, hashable] - The identifiers of the edge nodes. + The identifier of the edge. + + See Also + -------- + :meth:`add_node` + :meth:`delete_edge` Examples -------- @@ -517,6 +538,11 @@ def delete_node(self, key): ------- None + See Also + -------- + :meth:`delete_edge` + :meth:`add_node` + Examples -------- >>> @@ -537,25 +563,29 @@ def delete_node(self, key): if v == key: del self.adjacency[u][v] - def delete_edge(self, u, v): + def delete_edge(self, edge): """Delete an edge from the network. Parameters ---------- - u : hashable - The identifier of the first node. - v : hashable - The identifier of the second node. + edge : tuple[hashable, hashable] + The identifier of the edge as a pair of node identifiers. Returns ------- None + See Also + -------- + :meth:`delete_node` + :meth:`add_edge` + Examples -------- >>> """ + u, v = edge del self.adjacency[u][v] del self.adjacency[v][u] if u in self.edge and v in self.edge[u]: @@ -594,6 +624,10 @@ def number_of_nodes(self): int The number of nodes. + See Also + -------- + :meth:`number_of_edges` + """ return len(list(self.nodes())) @@ -605,6 +639,10 @@ def number_of_edges(self): int The number of edges. + See Also + -------- + :meth:`number_of_nodes` + """ return len(list(self.edges())) @@ -626,6 +664,11 @@ def nodes(self, data=False): If `data` is False, the next node identifier. If `data` is True, the next node as a (key, attr) tuple. + See Also + -------- + :meth:`nodes_where`, :meth:`nodes_where_predicate` + :meth:`edges`, :meth:`edges_where`, :meth:`edges_where_predicate` + """ for key in self.node: if not data: @@ -651,6 +694,11 @@ def nodes_where(self, conditions=None, data=False, **kwargs): If `data` is False, the next node that matches the condition. If `data` is True, the next node and its attributes. + See Also + -------- + :meth:`nodes`, :meth:`nodes_where_predicate` + :meth:`edges`, :meth:`edges_where`, :meth:`edges_where_predicate` + """ conditions = conditions or {} conditions.update(kwargs) @@ -720,6 +768,11 @@ def nodes_where_predicate(self, predicate, data=False): If `data` is False, the next node that matches the condition. If `data` is True, the next node and its attributes. + See Also + -------- + :meth:`nodes`, :meth:`nodes_where` + :meth:`edges`, :meth:`edges_where`, :meth:`edges_where_predicate` + Examples -------- >>> @@ -746,6 +799,11 @@ def edges(self, data=False): If `data` is False, the next edge identifier (u, v). If `data` is True, the next edge identifier and its attributes as a ((u, v), attr) tuple. + See Also + -------- + :meth:`edges_where`, :meth:`edges_where_predicate` + :meth:`nodes`, :meth:`nodes_where`, :meth:`nodes_where_predicate` + """ for u, nbrs in iter(self.edge.items()): for v, attr in iter(nbrs.items()): @@ -774,6 +832,11 @@ def edges_where(self, conditions=None, data=False, **kwargs): If `data` is False, the next edge identifier (u, v). If `data` is True, the next edge identifier and its attributes as a ((u, v), attr) tuple. + See Also + -------- + :meth:`edges`, :meth:`edges_where_predicate` + :meth:`nodes`, :meth:`nodes_where`, :meth:`nodes_where_predicate` + """ conditions = conditions or {} conditions.update(kwargs) @@ -833,6 +896,11 @@ def edges_where_predicate(self, predicate, data=False): If `data` is False, the next edge identifier (u, v). If `data` is True, the next edge identifier and its attributes as a ((u, v), attr) tuple. + See Also + -------- + :meth:`edges`, :meth:`edges_where` + :meth:`nodes`, :meth:`nodes_where`, :meth:`nodes_where_predicate` + Examples -------- >>> @@ -863,6 +931,10 @@ def update_default_node_attributes(self, attr_dict=None, **kwattr): ------- None + See Also + -------- + :meth:`update_default_edge_attributes` + """ if not attr_dict: attr_dict = {} @@ -883,6 +955,10 @@ def update_default_edge_attributes(self, attr_dict=None, **kwattr): ------- None + See Also + -------- + :meth:`update_default_node_attributes` + """ if not attr_dict: attr_dict = {} @@ -919,6 +995,12 @@ def node_attribute(self, key, name, value=None): KeyError If the node does not exist. + See Also + -------- + :meth:`unset_node_attribute` + :meth:`node_attributes`, :meth:`nodes_attribute`, :meth:`nodes_attributes` + :meth:`edge_attribute`, :meth:`edge_attributes`, :meth:`edges_attribute`, :meth:`edges_attributes` + """ if key not in self.node: raise KeyError(key) @@ -946,6 +1028,10 @@ def unset_node_attribute(self, key, name): KeyError If the node does not exist. + See Also + -------- + :meth:`node_attribute` + Notes ----- Unsetting the value of a node attribute implicitly sets it back to the value @@ -981,6 +1067,11 @@ def node_attributes(self, key, names=None, values=None): KeyError If the node does not exist. + See Also + -------- + :meth:`node_attribute`, :meth:`nodes_attribute`, :meth:`nodes_attributes` + :meth:`edge_attribute`, :meth:`edge_attributes`, :meth:`edges_attribute`, :meth:`edges_attributes` + """ if key not in self.node: raise KeyError(key) @@ -1026,6 +1117,11 @@ def nodes_attribute(self, name, value=None, keys=None): KeyError If any of the nodes does not exist. + See Also + -------- + :meth:`node_attribute`, :meth:`node_attributes`, :meth:`nodes_attributes` + :meth:`edge_attribute`, :meth:`edge_attributes`, :meth:`edges_attribute`, :meth:`edges_attributes` + """ if not keys: keys = self.nodes() @@ -1061,6 +1157,11 @@ def nodes_attributes(self, names=None, values=None, keys=None): KeyError If any of the nodes does not exist. + See Also + -------- + :meth:`node_attribute`, :meth:`node_attributes`, :meth:`nodes_attribute` + :meth:`edge_attribute`, :meth:`edge_attributes`, :meth:`edges_attribute`, :meth:`edges_attributes` + """ if not keys: keys = self.nodes() @@ -1096,6 +1197,12 @@ def edge_attribute(self, key, name, value=None): KeyError If the edge does not exist. + See Also + -------- + :meth:`unset_edge_attribute` + :meth:`edge_attributes`, :meth:`edges_attribute`, :meth:`edges_attributes` + :meth:`node_attribute`, :meth:`node_attributes`, :meth:`nodes_attribute`, :meth:`nodes_attributes` + """ u, v = key if u not in self.edge or v not in self.edge[u]: @@ -1128,6 +1235,10 @@ def unset_edge_attribute(self, key, name): KeyError If the edge does not exist. + See Also + -------- + :meth:`edge_attribute` + Notes ----- Unsetting the value of an edge attribute implicitly sets it back to the value @@ -1165,6 +1276,11 @@ def edge_attributes(self, key, names=None, values=None): KeyError If the edge does not exist. + See Also + -------- + :meth:`edge_attribute`, :meth:`edges_attribute`, :meth:`edges_attributes` + :meth:`node_attribute`, :meth:`node_attributes`, :meth:`nodes_attribute`, :meth:`nodes_attributes` + """ u, v = key if u not in self.edge or v not in self.edge[u]: @@ -1208,6 +1324,11 @@ def edges_attribute(self, name, value=None, keys=None): KeyError If any of the edges does not exist. + See Also + -------- + :meth:`edge_attribute`, :meth:`edge_attributes`, :meth:`edges_attributes` + :meth:`node_attribute`, :meth:`node_attributes`, :meth:`nodes_attribute`, :meth:`nodes_attributes` + """ if not keys: keys = self.edges() @@ -1243,6 +1364,11 @@ def edges_attributes(self, names=None, values=None, keys=None): KeyError If any of the edges does not exist. + See Also + -------- + :meth:`edge_attribute`, :meth:`edge_attributes`, :meth:`edges_attribute` + :meth:`node_attribute`, :meth:`node_attributes`, :meth:`nodes_attribute`, :meth:`nodes_attributes` + """ if not keys: keys = self.edges() @@ -1269,6 +1395,10 @@ def has_node(self, key): bool True or False. + See Also + -------- + :meth:`has_edge` + """ return key in self.node @@ -1285,6 +1415,11 @@ def is_leaf(self, key): bool True or False. + See Also + -------- + :meth:`leaves` + :meth:`is_node_connected` + Notes ----- A node is a *leaf* if it has only one neighbor. @@ -1316,6 +1451,10 @@ def is_node_connected(self, key): bool True or False. + See Also + -------- + :meth:`is_leaf` + """ return self.degree(key) > 0 @@ -1332,6 +1471,11 @@ def neighbors(self, key): list[hashable] A list of node identifiers. + See Also + -------- + :meth:`neighbors_out`, :meth:`neighbors_in` + :meth:`neighborhood` + """ return list(self.adjacency[key]) @@ -1350,6 +1494,10 @@ def neighborhood(self, key, ring=1): list[hashable] A list of node identifiers. + See Also + -------- + :meth:`neighbors` + """ nbrs = set(self.neighbors(key)) i = 1 @@ -1378,6 +1526,10 @@ def neighbors_out(self, key): list[hashable] A list of node identifiers. + See Also + -------- + :meth:`neighbors`, :meth:`neighbors_in` + """ return list(self.edge[key]) @@ -1394,6 +1546,10 @@ def neighbors_in(self, key): list[hashable] A list of node identifiers. + See Also + -------- + :meth:`neighbors`, :meth:`neighbors_out` + """ return list(set(self.adjacency[key]) - set(self.edge[key])) @@ -1410,6 +1566,10 @@ def degree(self, key): int The number of neighbors of the node. + See Also + -------- + :meth:`degree_out`, :meth:`degree_in` + """ return len(self.neighbors(key)) @@ -1426,6 +1586,10 @@ def degree_out(self, key): int The number of outgoing neighbors of the node. + See Also + -------- + :meth:`degree`, :meth:`degree_in` + """ return len(self.neighbors_out(key)) @@ -1442,6 +1606,10 @@ def degree_in(self, key): int The number of incoming neighbors of the node. + See Also + -------- + :meth:`degree`, :meth:`degree_out` + """ return len(self.neighbors_in(key)) @@ -1471,15 +1639,13 @@ def connected_edges(self, key): # edge topology # -------------------------------------------------------------------------- - def has_edge(self, u, v, directed=True): + def has_edge(self, edge, directed=True): """Verify if the network contains a specific edge. Parameters ---------- - u : hashable - The identifier of the first node of the edge. - v : hashable - The identifier of the second node of the edge. + edge : tuple[hashable, hashable] + The identifier of the edge as a pair of node identifiers. directed : bool, optional If True, the direction of the edge is taken into account. @@ -1488,7 +1654,12 @@ def has_edge(self, u, v, directed=True): bool True if the edge is present, False otherwise. + See Also + -------- + :meth:`has_node` + """ + u, v = edge if directed: return u in self.edge and v in self.edge[u] return (u in self.edge and v in self.edge[u]) or (v in self.edge and u in self.edge[v]) diff --git a/src/compas/datastructures/halfedge/__init__.py b/src/compas/datastructures/halfedge/__init__.py index be40e19a910..e69de29bb2d 100644 --- a/src/compas/datastructures/halfedge/__init__.py +++ b/src/compas/datastructures/halfedge/__init__.py @@ -1 +0,0 @@ -from .halfedge import HalfEdge # noqa: F401 diff --git a/src/compas/datastructures/halfedge/halfedge.py b/src/compas/datastructures/halfedge/halfedge.py index b36c0ad9073..1c7f91adce6 100644 --- a/src/compas/datastructures/halfedge/halfedge.py +++ b/src/compas/datastructures/halfedge/halfedge.py @@ -3,7 +3,6 @@ from __future__ import print_function from random import sample -from random import choice from compas.datastructures.datastructure import Datastructure from compas.datastructures.attributes import VertexAttributeView @@ -45,8 +44,62 @@ class HalfEdge(Datastructure): It is recommended to add a default to this dictionary using :meth:`update_default_face_attributes` for every face attribute used in the data structure. + See Also + -------- + :class:`compas.datastructures.Mesh` + """ + JSONSCHEMA = { + "type": "object", + "properties": { + "attributes": {"type": "object"}, + "dva": {"type": "object"}, + "dea": {"type": "object"}, + "dfa": {"type": "object"}, + "vertex": { + "type": "object", + "patternProperties": {"^[0-9]+$": {"type": "object"}}, + "additionalProperties": False, + }, + "face": { + "type": "object", + "patternProperties": { + "^[0-9]+$": { + "type": "array", + "items": {"type": "integer", "minimum": 0}, + "minItems": 3, + } + }, + "additionalProperties": False, + }, + "facedata": { + "type": "object", + "patternProperties": {"^[0-9]+$": {"type": "object"}}, + "additionalProperties": False, + }, + "edgedata": { + "type": "object", + "patternProperties": {"^\\([0-9]+,[0-9]+\\)$": {"type": "object"}}, + "additionalProperties": False, + }, + "max_vertex": {"type": "integer", "minimum": -1}, + "max_face": {"type": "integer", "minimum": -1}, + }, + "required": [ + "attributes", + "dva", + "dea", + "dfa", + "vertex", + "face", + "facedata", + "edgedata", + "max_vertex", + "max_face", + ], + } + def __init__( self, name=None, @@ -94,49 +147,22 @@ def adjacency(self): return self.halfedge @property - def DATASCHEMA(self): - import schema - from compas.data import is_sequence_of_uint - - return schema.Schema( - { - "attributes": dict, - "dva": dict, - "dea": dict, - "dfa": dict, - "vertex": schema.And( - dict, - is_sequence_of_uint, - ), - "face": schema.And( - dict, - is_sequence_of_uint, - lambda x: all(all(isinstance(item, int) for item in value) for value in x.values()), - lambda x: all(all(item >= 0 for item in value) for value in x.values()), - lambda x: all(len(value) > 2 for value in x.values()), - lambda x: all(len(value) == len(set(value)) for value in x.values()), - ), - "facedata": schema.And( - dict, - is_sequence_of_uint, - lambda x: all(isinstance(value, dict) for value in x.values()), - ), - "edgedata": schema.And( - dict, - lambda x: all(isinstance(key, str) for key in x), - lambda x: all(isinstance(value, dict) for value in x.values()), - ), - "max_vertex": schema.And(int, lambda x: x >= -1), - "max_face": schema.And(int, lambda x: x >= -1), - } - ) + def data(self): + """Returns a dictionary of structured data representing the data structure. - @property - def JSONSCHEMANAME(self): - return "halfedge" + Note that some of the data stored internally is not included in the dictionary representation of the data structure. + This is the case for data that is considered private and/or redundant. + Specifially, the half-edge dictionary is not included in the dictionary representation of the data structure. + This is because the half-edge dictionary can be reconstructed from the face dictionary. + The face dictionary contains the same information as the half-edge dictionary, but in a more compact form. + Therefore, to keep the dictionary representation of the data structure as compact as possible, the half-edge dictionary is not included. - @property - def data(self): + Returns + ------- + dict + The data dictionary. + + """ return { "attributes": self.attributes, "dva": self.default_vertex_attributes, @@ -152,30 +178,28 @@ def data(self): @data.setter def data(self, data): - if "data" in data: - data = data["data"] - self.attributes.update(data.get("attributes") or {}) - self.default_vertex_attributes.update(data.get("dva") or {}) - self.default_face_attributes.update(data.get("dfa") or {}) - self.default_edge_attributes.update(data.get("dea") or {}) self.vertex = {} - self.face = {} self.halfedge = {} + self.face = {} self.facedata = {} self.edgedata = {} + self._max_vertex = -1 + self._max_face = -1 + self.attributes.update(data.get("attributes") or {}) + self.default_vertex_attributes.update(data.get("dva") or {}) + self.default_face_attributes.update(data.get("dfa") or {}) + self.default_edge_attributes.update(data.get("dea") or {}) vertex = data.get("vertex") or {} face = data.get("face") or {} facedata = data.get("facedata") or {} - edgedata = data.get("edgedata") or {} for key, attr in iter(vertex.items()): - self.add_vertex(int(key), attr_dict=attr) + self.add_vertex(key=key, attr_dict=attr) for fkey, vertices in iter(face.items()): attr = facedata.get(fkey) or {} - self.add_face(vertices, fkey=int(fkey), attr_dict=attr) - for uv, attr in iter(edgedata.items()): - self.edgedata[uv] = attr or {} - self._max_vertex = data.get("max_vertex", -1) - self._max_face = data.get("max_face", -1) + self.add_face(vertices, fkey=fkey, attr_dict=attr) + self.edgedata.update(data.get("edgedata") or {}) + self._max_vertex = data.get("max_vertex", self._max_vertex) + self._max_face = data.get("max_face", self._max_face) # -------------------------------------------------------------------------- # helpers @@ -202,59 +226,6 @@ def clear(self): self._max_vertex = -1 self._max_face = -1 - def get_any_vertex(self): - """Get the identifier of a random vertex. - - .. deprecated:: 1.13.3 - Use :meth:`vertex_sample` instead. - - Returns - ------- - int - The identifier of the vertex. - - """ - return self.get_any_vertices(1)[0] - - def get_any_vertices(self, n, exclude_leaves=False): - """Get a list of identifiers of a random set of n vertices. - - .. deprecated:: 1.13.3 - Use :meth:`vertex_sample` instead. - - Parameters - ---------- - n : int - The number of random vertices. - exclude_leaves : bool, optional - If True, exclude the leaves (vertices with only one connected edge) from the set. - - Returns - ------- - list[int] - The identifiers of the vertices. - - """ - if exclude_leaves: - vertices = set(self.vertices()) - set(self.leaves()) - else: - vertices = self.vertices() - return sample(list(vertices), n) - - def get_any_face(self): - """Get the identifier of a random face. - - .. deprecated:: 1.13.3 - Use :meth:`face_sample` instead. - - Returns - ------- - int - The identifier of the face. - - """ - return choice(list(self.faces())) - def vertex_sample(self, size=1): """A random sample of the vertices. @@ -268,6 +239,10 @@ def vertex_sample(self, size=1): list[int] The identifiers of the vertices. + See Also + -------- + :meth:`edge_sample`, :meth:`face_sample` + """ return sample(list(self.vertices()), size) @@ -284,6 +259,10 @@ def edge_sample(self, size=1): list[tuple[int, int]] The identifiers of the edges. + See Also + -------- + :meth:`vertex_sample`, :meth:`face_sample` + """ return sample(list(self.edges()), size) @@ -300,37 +279,45 @@ def face_sample(self, size=1): list[int] The identifiers of the faces. + See Also + -------- + :meth:`vertex_sample`, :meth:`edge_sample` + """ return sample(list(self.faces()), size) - def key_index(self): - """Returns a dictionary that maps vertex dictionary keys to the + def vertex_index(self): + """Returns a dictionary that maps vertex identifiers to the corresponding index in a vertex list or array. Returns ------- dict[int, int] - A dictionary of key-index pairs. + A dictionary of vertex-index pairs. + + See Also + -------- + :meth:`index_vertex` """ return {key: index for index, key in enumerate(self.vertices())} - vertex_index = key_index - - def index_key(self): + def index_vertex(self): """Returns a dictionary that maps the indices of a vertex list to - keys in a vertex dictionary. + the corresponding vertex identifiers. Returns ------- dict[int, int] - A dictionary of index-key pairs. + A dictionary of index-vertex pairs. + + See Also + -------- + :meth:`vertex_index` """ return dict(enumerate(self.vertices())) - index_vertex = index_key - # -------------------------------------------------------------------------- # builders # -------------------------------------------------------------------------- @@ -352,6 +339,11 @@ def add_vertex(self, key=None, attr_dict=None, **kwattr): int The identifier of the vertex. + See Also + -------- + :meth:`add_face` + :meth:`delete_vertex`, :meth:`delete_face` + Notes ----- If no key is provided for the vertex, one is generated @@ -377,9 +369,9 @@ def add_vertex(self, key=None, attr_dict=None, **kwattr): """ if key is None: key = self._max_vertex = self._max_vertex + 1 + key = int(key) if key > self._max_vertex: self._max_vertex = key - key = int(key) if key not in self.vertex: self.vertex[key] = {} self.halfedge[key] = {} @@ -400,6 +392,11 @@ def add_face(self, vertices, fkey=None, attr_dict=None, **kwattr): **kwattr : dict[str, Any], optional A dictionary of additional attributes compiled of remaining named arguments. + See Also + -------- + :meth:`add_vertex` + :meth:`delete_face`, :meth:`delete_vertex` + Returns ------- int @@ -428,6 +425,7 @@ def add_face(self, vertices, fkey=None, attr_dict=None, **kwattr): return if fkey is None: fkey = self._max_face = self._max_face + 1 + fkey = int(fkey) if fkey > self._max_face: self._max_face = fkey attr = attr_dict or {} @@ -456,6 +454,11 @@ def delete_vertex(self, key): ------- None + See Also + -------- + :meth:`delete_face` + :meth:`add_vertex`, :meth:`add_face` + Notes ----- In some cases, disconnected vertices can remain after application of this @@ -501,6 +504,11 @@ def delete_face(self, fkey): ------- None + See Also + -------- + :meth:`delete_vertex` + :meth:`add_vertex`, :meth:`add_face` + Notes ----- In some cases, disconnected vertices can remain after application of this @@ -527,6 +535,10 @@ def remove_unused_vertices(self): ------- None + See Also + -------- + :meth:`delete_vertex` + """ for u in list(self.vertices()): if u not in self.halfedge: @@ -556,6 +568,11 @@ def vertices(self, data=False): If `data` is False, the next vertex identifier. If `data` is True, the next vertex as a (key, attr) tuple. + See Also + -------- + :meth:`faces`, :meth:`edges` + :meth:`vertices_where`, :meth:`edges_where`, :meth:`faces_where` + """ for key in self.vertex: if not data: @@ -577,6 +594,11 @@ def faces(self, data=False): If `data` is False, the next face identifier. If `data` is True, the next face as a (fkey, attr) tuple. + See Also + -------- + :meth:`vertices`, :meth:`edges` + :meth:`vertices_where`, :meth:`edges_where`, :meth:`faces_where` + """ for key in self.face: if not data: @@ -598,8 +620,13 @@ def edges(self, data=False): If `data` is False, the next edge as a (u, v) tuple. If `data` is True, the next edge as a ((u, v), data) tuple. + See Also + -------- + :meth:`vertices`, :meth:`faces` + :meth:`vertices_where`, :meth:`edges_where`, :meth:`faces_where` + Notes - ---- + ----- Mesh edges have no topological meaning. They are only used to store data. Edges are not automatically created when vertices and faces are added to the mesh. Instead, they are created when data is stored on them, or when @@ -610,10 +637,6 @@ def edges(self, data=False): edges is *as they come out*. However, as long as the toplogy remains unchanged, the order is consistent. - Examples - -------- - >>> - """ seen = set() for u in self.halfedge: @@ -649,6 +672,11 @@ def vertices_where(self, conditions=None, data=False, **kwargs): If `data` is False, the next vertex that matches the condition. If `data` is True, the next vertex and its attributes. + See Also + -------- + :meth:`faces_where`, :meth:`edges_where` + :meth:`vertices_where_predicate`, :meth:`edges_where_predicate`, :meth:`faces_where_predicate` + """ conditions = conditions or {} conditions.update(kwargs) @@ -723,9 +751,10 @@ def vertices_where_predicate(self, predicate, data=False): If `data` is False, the next vertex that matches the condition. If `data` is True, the next vertex and its attributes. - Examples + See Also -------- - >>> + :meth:`faces_where_predicate`, :meth:`edges_where_predicate` + :meth:`vertices_where`, :meth:`edges_where`, :meth:`faces_where` """ for key, attr in self.vertices(True): @@ -755,6 +784,11 @@ def edges_where(self, conditions=None, data=False, **kwargs): If `data` is False, the next edge as a (u, v) tuple. If `data` is True, the next edge as a (u, v, data) tuple. + See Also + -------- + :meth:`vertices_where`, :meth:`faces_where` + :meth:`vertices_where_predicate`, :meth:`edges_where_predicate`, :meth:`faces_where_predicate` + """ conditions = conditions or {} conditions.update(kwargs) @@ -814,6 +848,11 @@ def edges_where_predicate(self, predicate, data=False): If `data` is False, the next edge as a (u, v) tuple. If `data` is True, the next edge as a (u, v, data) tuple. + See Also + -------- + :meth:`faces_where_predicate`, :meth:`vertices_where_predicate` + :meth:`vertices_where`, :meth:`edges_where`, :meth:`faces_where` + """ for key, attr in self.edges(True): if predicate(key, attr): @@ -842,6 +881,11 @@ def faces_where(self, conditions=None, data=False, **kwargs): If `data` is False, the next face that matches the condition. If `data` is True, the next face and its attributes. + See Also + -------- + :meth:`vertices_where`, :meth:`edges_where` + :meth:`vertices_where_predicate`, :meth:`edges_where_predicate`, :meth:`faces_where_predicate` + """ conditions = conditions or {} conditions.update(kwargs) @@ -900,6 +944,11 @@ def faces_where_predicate(self, predicate, data=False): If `data` is False, the next face that matches the condition. If `data` is True, the next face and its attributes. + See Also + -------- + :meth:`edges_where_predicate`, :meth:`vertices_where_predicate` + :meth:`vertices_where`, :meth:`edges_where`, :meth:`faces_where` + """ for fkey, attr in self.faces(True): if predicate(fkey, attr): @@ -926,6 +975,11 @@ def update_default_vertex_attributes(self, attr_dict=None, **kwattr): ------- None + See Also + -------- + :meth:`update_default_edge_attributes` + :meth:`update_default_face_attributes` + Notes ----- Named arguments overwrite corresponding key-value pairs in the attribute dictionary. @@ -959,6 +1013,13 @@ def vertex_attribute(self, key, name, value=None): KeyError If the vertex does not exist. + See Also + -------- + :meth:`vertex_attributes`, :meth:`vertices_attribute`, :meth:`vertices_attributes` + :meth:`unset_vertex_attribute` + :meth:`edge_attribute` + :meth:`face_attribute` + """ if key not in self.vertex: raise KeyError(key) @@ -990,6 +1051,12 @@ def unset_vertex_attribute(self, key, name): KeyError If the vertex does not exist. + See Also + -------- + :meth:`vertex_attribute`, :meth:`vertex_attributes`, :meth:`vertices_attribute`, :meth:`vertices_attributes` + :meth:`unset_edge_attribute` + :meth:`unset_face_attribute` + Notes ----- Unsetting the value of a vertex attribute implicitly sets it back to the value @@ -1025,6 +1092,12 @@ def vertex_attributes(self, key, names=None, values=None): KeyError If the vertex does not exist. + See Also + -------- + :meth:`vertex_attribute`, :meth:`vertices_attribute`, :meth:`vertices_attributes` + :meth:`edge_attributes` + :meth:`face_attributes` + """ if key not in self.vertex: raise KeyError(key) @@ -1071,6 +1144,12 @@ def vertices_attribute(self, name, value=None, keys=None): KeyError If any of the vertices does not exist. + See Also + -------- + :meth:`vertex_attribute`, :meth:`vertex_attributes`, :meth:`vertices_attributes` + :meth:`edges_attribute` + :meth:`faces_attribute` + """ if not keys: keys = self.vertices() @@ -1106,6 +1185,12 @@ def vertices_attributes(self, names=None, values=None, keys=None): KeyError If any of the vertices does not exist. + See Also + -------- + :meth:`vertex_attribute`, :meth:`vertex_attributes`, :meth:`vertices_attribute` + :meth:`edges_attributes` + :meth:`faces_attributes` + """ if not keys: keys = self.vertices() @@ -1129,8 +1214,13 @@ def update_default_face_attributes(self, attr_dict=None, **kwattr): ------- None + See Also + -------- + :meth:`update_default_vertex_attributes` + :meth:`update_default_edge_attributes` + Notes - ---- + ----- Named arguments overwrite corresponding key-value pairs in the attribute dictionary. """ @@ -1161,6 +1251,13 @@ def face_attribute(self, key, name, value=None): KeyError If the face does not exist. + See Also + -------- + :meth:`face_attributes`, :meth:`faces_attribute`, :meth:`faces_attributes` + :meth:`unset_face_attribute` + :meth:`edge_attribute` + :meth:`vertex_attribute` + """ if key not in self.face: raise KeyError(key) @@ -1193,6 +1290,12 @@ def unset_face_attribute(self, key, name): KeyError If the face does not exist. + See Also + -------- + :meth:`face_attribute`, :meth:`face_attributes`, :meth:`faces_attribute`, :meth:`faces_attributes` + :meth:`unset_edge_attribute` + :meth:`unset_vertex_attribute` + Notes ----- Unsetting the value of a face attribute implicitly sets it back to the value @@ -1231,6 +1334,12 @@ def face_attributes(self, key, names=None, values=None): KeyError If the face does not exist. + See Also + -------- + :meth:`face_attribute`, :meth:`faces_attribute`, :meth:`faces_attributes` + :meth:`edge_attributes` + :meth:`vertex_attributes` + """ if key not in self.face: raise KeyError(key) @@ -1274,6 +1383,12 @@ def faces_attribute(self, name, value=None, keys=None): KeyError If any of the faces does not exist. + See Also + -------- + :meth:`face_attribute`, :meth:`face_attributes`, :meth:`faces_attributes` + :meth:`edges_attribute` + :meth:`vertices_attribute` + """ if not keys: keys = self.faces() @@ -1311,6 +1426,12 @@ def faces_attributes(self, names=None, values=None, keys=None): KeyError If any of the faces does not exist. + See Also + -------- + :meth:`face_attribute`, :meth:`face_attributes`, :meth:`faces_attribute` + :meth:`edges_attributes` + :meth:`vertices_attributes` + """ if not keys: keys = self.faces() @@ -1334,8 +1455,13 @@ def update_default_edge_attributes(self, attr_dict=None, **kwattr): ------- None + See Also + -------- + :meth:`update_default_vertex_attributes` + :meth:`update_default_face_attributes` + Notes - ---- + ----- Named arguments overwrite corresponding key-value pairs in the attribute dictionary. """ @@ -1367,6 +1493,13 @@ def edge_attribute(self, edge, name, value=None): KeyError If the edge does not exist. + See Also + -------- + :meth:`edge_attributes`, :meth:`edges_attribute`, :meth:`edges_attributes` + :meth:`unset_edge_attribute` + :meth:`vertex_attribute` + :meth:`face_attribute` + """ u, v = edge if u not in self.halfedge or v not in self.halfedge[u]: @@ -1401,6 +1534,12 @@ def unset_edge_attribute(self, edge, name): KeyError If the edge does not exist. + See Also + -------- + :meth:`edge_attribute`, :meth:`edge_attributes`, :meth:`edges_attribute`, :meth:`edges_attributes` + :meth:`unset_vertex_attribute` + :meth:`unset_face_attribute` + Notes ----- Unsetting the value of an edge attribute implicitly sets it back to the value @@ -1440,6 +1579,12 @@ def edge_attributes(self, edge, names=None, values=None): KeyError If the edge does not exist. + See Also + -------- + :meth:`edge_attribute`, :meth:`edges_attribute`, :meth:`edges_attributes` + :meth:`vertex_attributes` + :meth:`face_attributes` + """ u, v = edge if u not in self.halfedge or v not in self.halfedge[u]: @@ -1485,6 +1630,12 @@ def edges_attribute(self, name, value=None, keys=None): KeyError If any of the edges does not exist. + See Also + -------- + :meth:`edge_attribute`, :meth:`edge_attributes`, :meth:`edges_attributes` + :meth:`vertex_attributes` + :meth:`face_attributes` + """ edges = keys or self.edges() if value is not None: @@ -1521,6 +1672,12 @@ def edges_attributes(self, names=None, values=None, keys=None): KeyError If any of the edges does not exist. + See Also + -------- + :meth:`edge_attribute`, :meth:`edge_attributes`, :meth:`edges_attribute` + :meth:`vertex_attributes` + :meth:`face_attributes` + """ edges = keys or self.edges() if values is not None: @@ -1565,6 +1722,11 @@ def number_of_vertices(self): ------- int + See Also + -------- + :meth:`number_of_edges` + :meth:`number_of_faces` + """ return len(list(self.vertices())) @@ -1575,6 +1737,11 @@ def number_of_edges(self): ------- int + See Also + -------- + :meth:`number_of_vertices` + :meth:`number_of_faces` + """ return len(list(self.edges())) @@ -1585,6 +1752,11 @@ def number_of_faces(self): ------- int + See Also + -------- + :meth:`number_of_vertices` + :meth:`number_of_edges` + """ return len(list(self.faces())) @@ -1604,6 +1776,10 @@ def is_valid(self): True, if the mesh is valid. False, otherwise. + See Also + -------- + :meth:`is_regular`, :meth:`is_manifold`, :meth:`is_orientable`, :meth:`is_empty`, :meth:`is_closed`, :meth:`is_trimesh`, :meth:`is_quadmesh` + """ for key in self.vertices(): if key not in self.halfedge: @@ -1650,18 +1826,22 @@ def is_regular(self): True, if the mesh is regular. False, otherwise. + See Also + -------- + :meth:`is_valid`, :meth:`is_manifold`, :meth:`is_orientable`, :meth:`is_empty`, :meth:`is_closed`, :meth:`is_trimesh`, :meth:`is_quadmesh` + """ if not self.vertex or not self.face: return False - vkey = self.get_any_vertex() + vkey = self.vertex_sample(size=1)[0] degree = self.vertex_degree(vkey) for vkey in self.vertices(): if self.vertex_degree(vkey) != degree: return False - fkey = self.get_any_face() + fkey = self.face_sample(size=1)[0] vcount = len(self.face_vertices(fkey)) for fkey in self.faces(): @@ -1685,12 +1865,15 @@ def is_manifold(self): True, if the mesh is manifold. False, otherwise. + See Also + -------- + :meth:`is_valid`, :meth:`is_regular`, :meth:`is_orientable`, :meth:`is_empty`, :meth:`is_closed`, :meth:`is_trimesh`, :meth:`is_quadmesh` + """ if not self.vertex: return False for key in self.vertices(): - if list(self.halfedge[key].values()).count(None) > 1: return False @@ -1725,6 +1908,10 @@ def is_orientable(self): True, if the mesh is orientable. False, otherwise. + See Also + -------- + :meth:`is_valid`, :meth:`is_regular`, :meth:`is_manifold`, :meth:`is_empty`, :meth:`is_closed`, :meth:`is_trimesh`, :meth:`is_quadmesh` + """ raise NotImplementedError @@ -1737,6 +1924,10 @@ def is_trimesh(self): True, if the mesh is a triangle mesh. False, otherwise. + See Also + -------- + :meth:`is_valid`, :meth:`is_regular`, :meth:`is_manifold`, :meth:`is_orientable`, :meth:`is_empty`, :meth:`is_closed`, :meth:`is_quadmesh` + """ if not self.face: return False @@ -1751,6 +1942,10 @@ def is_quadmesh(self): True, if the mesh is a quad mesh. False, otherwise. + See Also + -------- + :meth:`is_valid`, :meth:`is_regular`, :meth:`is_manifold`, :meth:`is_orientable`, :meth:`is_empty`, :meth:`is_closed`, :meth:`is_trimesh` + """ if not self.face: return False @@ -1765,6 +1960,10 @@ def is_empty(self): True if the mesh has no vertices. False otherwise. + See Also + -------- + :meth:`is_valid`, :meth:`is_regular`, :meth:`is_manifold`, :meth:`is_orientable`, :meth:`is_closed`, :meth:`is_trimesh`, :meth:`is_quadmesh` + """ if self.number_of_vertices() == 0: return True @@ -1779,11 +1978,15 @@ def is_closed(self): True if the mesh is not empty and has no naked edges. False otherwise. + See Also + -------- + :meth:`is_valid`, :meth:`is_regular`, :meth:`is_manifold`, :meth:`is_orientable`, :meth:`is_empty`, :meth:`is_trimesh`, :meth:`is_quadmesh` + """ if self.is_empty(): return False for edge in self.edges(): - if self.is_edge_on_boundary(*edge): + if self.is_edge_on_boundary(edge): return False return True @@ -1795,6 +1998,10 @@ def euler(self): int The Euler characteristic. + See Also + -------- + :meth:`genus` + """ V = len([vkey for vkey in self.vertices() if len(self.vertex_neighbors(vkey)) != 0]) E = self.number_of_edges() @@ -1809,6 +2016,10 @@ def genus(self): int The genus. + See Also + -------- + :meth:`euler` + References ---------- .. [1] Wolfram MathWorld. *Genus*. @@ -2082,15 +2293,13 @@ def has_halfedge(self, key): u, v = key return u in self.halfedge and v in self.halfedge[u] - def edge_faces(self, u, v): + def edge_faces(self, edge): """Find the two faces adjacent to an edge. Parameters ---------- - u : int - The identifier of the first vertex. - v : int - The identifier of the second vertex. + edge : tuple[int, int] + The identifier of the edge. Returns ------- @@ -2099,17 +2308,16 @@ def edge_faces(self, u, v): If the edge is on the boundary, one of the identifiers is None. """ + u, v = edge return self.halfedge[u][v], self.halfedge[v][u] - def halfedge_face(self, u, v): + def halfedge_face(self, edge): """Find the face corresponding to a halfedge. Parameters ---------- - u : int - The identifier of the first vertex. - v : int - The identifier of the second vertex. + edge : tuple[int, int] + The identifier of the halfedge. Returns ------- @@ -2123,17 +2331,16 @@ def halfedge_face(self, u, v): If the halfedge does not exist. """ + u, v = edge return self.halfedge[u][v] - def is_edge_on_boundary(self, u, v): + def is_edge_on_boundary(self, edge): """Verify that an edge is on the boundary. Parameters ---------- - u : int - The identifier of the first vertex. - v : int - The identifier of the second vertex. + edge : tuple[int, int] + The identifier of the edge. Returns ------- @@ -2142,6 +2349,7 @@ def is_edge_on_boundary(self, u, v): False otherwise. """ + u, v = edge return self.halfedge[v][u] is None or self.halfedge[u][v] is None # -------------------------------------------------------------------------- @@ -2184,10 +2392,10 @@ def halfedge_loop(self, edge): The edges on the same loop as the given edge. """ - u, v = edge - if self.is_edge_on_boundary(u, v): + if self.is_edge_on_boundary(edge): return self._halfedge_loop_on_boundary(edge) - edges = [(u, v)] + edges = [edge] + u, v = edge while True: nbrs = self.vertex_neighbors(v, ordered=True) if len(nbrs) != 4: @@ -2214,8 +2422,8 @@ def _halfedge_loop_on_boundary(self, edge): The edges on the same loop as the given edge. """ + edges = [edge] u, v = edge - edges = [(u, v)] while True: nbrs = self.vertex_neighbors(v) if len(nbrs) == 2: @@ -2224,7 +2432,7 @@ def _halfedge_loop_on_boundary(self, edge): for temp in nbrs: if temp == u: continue - if self.is_edge_on_boundary(v, temp): + if self.is_edge_on_boundary((v, temp)): nbr = temp break if nbr is None: @@ -2268,7 +2476,7 @@ def edge_strip(self, edge, return_faces=False): strip = vu_strip[:-1] + uv_strip if not return_faces: return strip - faces = [self.halfedge_face(u, v) for u, v in strip[:-1]] + faces = [self.halfedge_face(edge) for edge in strip[:-1]] return strip, faces def halfedge_strip(self, edge): @@ -2286,7 +2494,7 @@ def halfedge_strip(self, edge): """ u, v = edge - edges = [(u, v)] + edges = [edge] while True: face = self.halfedge[u][v] if face is None: @@ -2587,15 +2795,13 @@ def is_face_on_boundary(self, key): face_vertex_after = face_vertex_descendant face_vertex_before = face_vertex_ancestor - def halfedge_after(self, u, v): + def halfedge_after(self, edge): """Find the halfedge after the given halfedge in the same face. Parameters ---------- - u : int - The first vertex of the halfedge. - v : int - The second vertex of the halfedge. + edge : tuple[int, int] + The identifier of the starting halfedge. Returns ------- @@ -2603,7 +2809,8 @@ def halfedge_after(self, u, v): The next halfedge. """ - face = self.halfedge_face(u, v) + u, v = edge + face = self.halfedge_face(edge) if face is not None: w = self.face_vertex_after(face, v) return v, w @@ -2611,15 +2818,13 @@ def halfedge_after(self, u, v): w = nbrs[0] return v, w - def halfedge_before(self, u, v): + def halfedge_before(self, edge): """Find the halfedge before the given halfedge in the same face. Parameters ---------- - u : int - The first vertex of the halfedge. - v : int - The second vertex of the halfedge. + edge : tuple[int, int] + The identifier of the starting halfedge. Returns ------- @@ -2627,7 +2832,8 @@ def halfedge_before(self, u, v): The previous halfedge. """ - face = self.halfedge_face(u, v) + u, v = edge + face = self.halfedge_face(edge) if face is not None: t = self.face_vertex_before(face, u) return t, u @@ -2654,3 +2860,36 @@ def vertex_edges(self, vertex): else: edges.append((nbr, vertex)) return edges + + def halfedge_loop_vertices(self, edge): + """Find all vertices on the same loop as a given halfedge. + + Parameters + ---------- + edge : tuple[int, int] + The identifier of the starting halfedge. + Returns + ------- + list[int] + The vertices on the same loop as the given halfedge. + + """ + loop = self.halfedge_loop(edge) + return [loop[0][0]] + [edge[1] for edge in loop] + + def halfedge_strip_faces(self, edge): + """Find all faces on the same strip as a given halfedge. + + Parameters + ---------- + edge : tuple[int, int] + The identifier of the starting halfedge. + + Returns + ------- + list[int] + The faces on the same strip as the given halfedge. + + """ + strip = self.halfedge_strip(edge) + return [self.halfedge_face(edge) for edge in strip] diff --git a/src/compas/datastructures/halfface/__init__.py b/src/compas/datastructures/halfface/__init__.py index 8fea78fb4a7..e69de29bb2d 100644 --- a/src/compas/datastructures/halfface/__init__.py +++ b/src/compas/datastructures/halfface/__init__.py @@ -1 +0,0 @@ -from .halfface import HalfFace # noqa: F401 diff --git a/src/compas/datastructures/halfface/halfface.py b/src/compas/datastructures/halfface/halfface.py index 7d703fd7813..dea977b7bce 100644 --- a/src/compas/datastructures/halfface/halfface.py +++ b/src/compas/datastructures/halfface/halfface.py @@ -2,7 +2,7 @@ from __future__ import division from __future__ import print_function -from random import choice, sample +from random import sample from compas.datastructures.datastructure import Datastructure from compas.datastructures.attributes import VertexAttributeView @@ -42,8 +42,60 @@ class HalfFace(Datastructure): default_cell_attributes: dict[str, Any] Default values for cell attributes. + See Also + -------- + :class:`compas.datastructures.VolMesh` + """ + JSONSCHEMA = { + "type": "object", + "properties": { + "attributes": {"type": "object"}, + "dva": {"type": "object"}, + "dea": {"type": "object"}, + "dfa": {"type": "object"}, + "dca": {"type": "object"}, + "vertex": { + "type": "object", + "patternProperties": {"^[0-9]+$": {"type": "object"}}, + "additionalProperties": False, + }, + "cell": { + "type": "object", + "patternProperties": { + "^[0-9]+$": { + "type": "array", + "minItems": 3, + "items": {"type": "integer", "minimum": 0}, + } + }, + "additionalProperties": False, + }, + "edge_data": {"type": "object"}, + "face_data": {"type": "object"}, + "cell_data": {"type": "object"}, + "max_vertex": {"type": "number"}, + "max_face": {"type": "number"}, + "max_cell": {"type": "number"}, + }, + "required": [ + "attributes", + "dva", + "dea", + "dfa", + "dca", + "vertex", + "cell", + "edge_data", + "face_data", + "cell_data", + "max_vertex", + "max_face", + "max_cell", + ], + } + def __init__( self, name=None, @@ -99,41 +151,31 @@ def name(self, value): self.attributes["name"] = value @property - def DATASCHEMA(self): - import schema - - return schema.Schema( - { - "attributes": dict, - "dva": dict, - "dea": dict, - "dfa": dict, - "dca": dict, - "vertex": dict, - "cell": dict, - "edge_data": dict, - "face_data": dict, - "cell_data": dict, - "max_vertex": schema.And(int, lambda x: x >= -1), - "max_face": schema.And(int, lambda x: x >= -1), - "max_cell": schema.And(int, lambda x: x >= -1), - } - ) + def data(self): + """Returns a dictionary of structured data representing the volmesh data object. - @property - def JSONSCHEMANAME(self): - return "halfface" + Note that some of the data stored internally in the data structure object is not included in the dictionary representation of the object. + This is the case for data that is considered private and/or redundant. + Specifically, the halfface dictionary and the plane dictionary are not included. + This is because the information in these dictionaries can be reconstructed from the other data. + Therefore, to keep the dictionary representation as compact as possible, these dictionaries are not included. - @property - def data(self): + To reconstruct the complete object representation from the compact data, the setter of the data property uses the vertex and cell builder methods (:meth:`add_vertex`, :meth:`add_cell`). + + Returns + ------- + dict + The structured data representing the volmesh. + + """ cell = {} for c in self._cell: - cell[c] = {} - for u in self._cell[c]: - cell[c].setdefault(u, {}) - for v in self._cell[c][u]: - cell[c][u][v] = self._halfface[self._cell[c][u][v]] - data = { + faces = [] + for u in sorted(self._cell[c]): + for v in sorted(self._cell[c][u]): + faces.append(self._halfface[self._cell[c][u][v]]) + cell[c] = faces + return { "attributes": self.attributes, "dva": self.default_vertex_attributes, "dea": self.default_edge_attributes, @@ -148,33 +190,9 @@ def data(self): "max_face": self._max_face, "max_cell": self._max_cell, } - return data @data.setter def data(self, data): - attributes = data.get("attributes") or {} - dva = data.get("dva") or {} - dea = data.get("dea") or {} - dfa = data.get("dfa") or {} - dca = data.get("dca") or {} - vertex = data.get("vertex") or {} - cell = data.get("cell") or {} - edge_data = data.get("edge_data") or {} - face_data = data.get("face_data") or {} - cell_data = data.get("cell_data") or {} - max_vertex = data.get("max_vertex", -1) - max_face = data.get("max_face", -1) - max_cell = data.get("max_cell", -1) - - if not vertex or not cell: - return - - self.attributes.update(attributes) - self.default_vertex_attributes.update(dva) - self.default_edge_attributes.update(dea) - self.default_face_attributes.update(dfa) - self.default_cell_attributes.update(dca) - self._vertex = {} self._halfface = {} self._cell = {} @@ -182,28 +200,31 @@ def data(self, data): self._edge_data = {} self._face_data = {} self._cell_data = {} - - for v in vertex: - attr = vertex[v] or {} - self.add_vertex(int(v), attr_dict=attr) - - for c in cell: - attr = cell_data.get(c) or {} - faces = [] - for u in cell[c]: - for v in cell[c][u]: - faces.append(cell[c][u][v]) - self.add_cell(faces, ckey=int(c), attr_dict=attr) - - for e in edge_data: - self._edge_data[e] = edge_data[e] or {} - - for f in face_data: - self._face_data[f] = face_data[f] or {} - - self._max_vertex = max_vertex - self._max_face = max_face - self._max_cell = max_cell + self._max_vertex = -1 + self._max_face = -1 + self._max_cell = -1 + vertex = data.get("vertex") or {} + cell = data.get("cell") or {} + edge_data = data.get("edge_data") or {} + face_data = data.get("face_data") or {} + cell_data = data.get("cell_data") or {} + self.attributes.update(data.get("attributes") or {}) + self.default_vertex_attributes.update(data.get("dva") or {}) + self.default_edge_attributes.update(data.get("dea") or {}) + self.default_face_attributes.update(data.get("dfa") or {}) + self.default_cell_attributes.update(data.get("dca") or {}) + for key, attr in iter(vertex.items()): + self.add_vertex(key=key, attr_dict=attr) + for ckey, faces in iter(cell.items()): + attr = cell_data.get(ckey) or {} + self.add_cell(faces, ckey=ckey, attr_dict=attr) + for edge in edge_data: + self._edge_data[edge] = edge_data[edge] or {} + for face in face_data: + self._face_data[face] = face_data[face] or {} + self._max_vertex = data.get("max_vertex", self._max_vertex) + self._max_face = data.get("max_face", self._max_face) + self._max_cell = data.get("max_cell", self._max_cell) # -------------------------------------------------------------------------- # helpers @@ -235,34 +256,6 @@ def clear(self): self._max_face = -1 self._max_cell = -1 - def get_any_vertex(self): - """Get the identifier of a random vertex. - - .. deprecated:: 1.13.3 - Use :meth:`vertex_sample` instead. - - Returns - ------- - int - The identifier of the vertex. - - """ - return choice(list(self.vertices())) - - def get_any_face(self): - """Get the identifier of a random face. - - .. deprecated:: 1.13.3 - Use :meth:`face_sample` instead. - - Returns - ------- - int - The identifier of the face. - - """ - return choice(list(self.faces())) - def vertex_sample(self, size=1): """Get the identifiers of a set of random vertices. @@ -276,6 +269,10 @@ def vertex_sample(self, size=1): list[int] The identifiers of the vertices. + See Also + -------- + :meth:`edge_sample`, :meth:`face_sample`, :meth:`cell_sample` + """ return sample(list(self.vertices()), size) @@ -292,6 +289,10 @@ def edge_sample(self, size=1): list[tuple[int, int]] The identifiers of the edges. + See Also + -------- + :meth:`vertex_sample`, :meth:`face_sample`, :meth:`cell_sample` + """ return sample(list(self.edges()), size) @@ -308,6 +309,10 @@ def face_sample(self, size=1): list[int] The identifiers of the faces. + See Also + -------- + :meth:`vertex_sample`, :meth:`edge_sample`, :meth:`cell_sample` + """ return sample(list(self.faces()), size) @@ -324,6 +329,10 @@ def cell_sample(self, size=1): list[int] The identifiers of the cells. + See Also + -------- + :meth:`vertex_sample`, :meth:`edge_sample`, :meth:`face_sample` + """ return sample(list(self.cells()), size) @@ -336,6 +345,10 @@ def vertex_index(self): dict[int, int] A dictionary of vertex-index pairs. + See Also + -------- + :meth:`index_vertex` + """ return {key: index for index, key in enumerate(self.vertices())} @@ -348,6 +361,10 @@ def index_vertex(self): dict[int, int] A dictionary of index-vertex pairs. + See Also + -------- + :meth:`vertex_index` + """ return dict(enumerate(self.vertices())) @@ -372,6 +389,10 @@ def add_vertex(self, key=None, attr_dict=None, **kwattr): int The identifier of the vertex. + See Also + -------- + :meth:`add_halfface`, :meth:`add_cell` + Notes ----- If no key is provided for the vertex, one is generated @@ -384,9 +405,9 @@ def add_vertex(self, key=None, attr_dict=None, **kwattr): """ if key is None: key = self._max_vertex = self._max_vertex + 1 + key = int(key) if key > self._max_vertex: self._max_vertex = key - key = int(key) if key not in self._vertex: self._vertex[key] = {} self._plane[key] = {} @@ -415,6 +436,10 @@ def add_halfface(self, vertices, fkey=None, attr_dict=None, **kwattr): int The key of the face. + See Also + -------- + :meth:`add_vertex`, :meth:`add_cell` + Notes ----- If no key is provided for the face, one is generated @@ -432,9 +457,9 @@ def add_halfface(self, vertices, fkey=None, attr_dict=None, **kwattr): vertices = [int(key) for key in vertices] if fkey is None: fkey = self._max_face = self._max_face + 1 + fkey = int(fkey) if fkey > self._max_face: self._max_face = fkey - fkey = int(fkey) attr = attr_dict or {} attr.update(kwattr) self._halfface[fkey] = vertices @@ -482,6 +507,10 @@ def add_cell(self, faces, ckey=None, attr_dict=None, **kwattr): TypeError If the provided cell key is of an unhashable type. + See also + -------- + :meth:`add_vertex`, :meth:`add_halfface` + Notes ----- If no key is provided for the cell, one is generated @@ -494,9 +523,9 @@ def add_cell(self, faces, ckey=None, attr_dict=None, **kwattr): """ if ckey is None: ckey = self._max_cell = self._max_cell + 1 + ckey = int(ckey) if ckey > self._max_cell: self._max_cell = ckey - ckey = int(ckey) attr = attr_dict or {} attr.update(kwattr) self._cell[ckey] = {} @@ -531,6 +560,10 @@ def delete_vertex(self, vertex): ------- None + See Also + -------- + :meth:`delete_halfface`, :meth:`delete_cell` + """ for cell in self.vertex_cells(vertex): self.delete_cell(cell) @@ -547,6 +580,10 @@ def delete_cell(self, cell): ------- None + See Also + -------- + :meth:`delete_vertex`, :meth:`delete_halfface` + """ cell_vertices = self.cell_vertices(cell) cell_faces = self.cell_faces(cell) @@ -614,6 +651,10 @@ def vertices(self, data=False): If `data` is False, the next vertex identifier. If `data` is True, the next vertex as a (vertex, attr) a tuple. + See Also + -------- + :meth:`edges`, :meth:`faces`, :meth:`cells` + """ for vertex in self._vertex: if not data: @@ -635,6 +676,10 @@ def edges(self, data=False): If `data` is False, the next edge as a (u, v) tuple. If `data` is True, the next edge as a ((u, v), attr) tuple. + See Also + -------- + :meth:`vertices`, :meth:`faces`, :meth:`cells` + """ seen = set() for face in self._halfface: @@ -662,6 +707,11 @@ def halffaces(self, data=False): int | tuple[int, dict[str, Any]] If `data` is False, the next halfface identifier. If `data` is True, the next halfface as a (halfface, attr) tuple. + + See Also + -------- + :meth:`vertices`, :meth:`edges`, :meth:`cells` + """ for hface in self._halfface: if not data: @@ -683,6 +733,10 @@ def faces(self, data=False): If `data` is False, the next face identifier. If `data` is True, the next face as a (face, attr) tuple. + See Also + -------- + :meth:`vertices`, :meth:`edges`, :meth:`cells` + Notes ----- Volmesh faces have no topological meaning (analogous to an edge of a mesh). @@ -719,6 +773,10 @@ def cells(self, data=False): If `data` is False, the next cell identifier. If `data` is True, the next cell as a (cell, attr) tuple. + See Also + -------- + :meth:`vertices`, :meth:`edges`, :meth:`faces` + """ for cell in self._cell: if not data: @@ -746,6 +804,11 @@ def vertices_where(self, conditions=None, data=False, **kwargs): If `data` is False, the next vertex that matches the condition. If `data` is True, the next vertex and its attributes. + See Also + -------- + :meth:`vertices_where_predicate` + :meth:`edges_where`, :meth:`faces_where`, :meth:`cells_where` + """ conditions = conditions or {} conditions.update(kwargs) @@ -819,6 +882,11 @@ def vertices_where_predicate(self, predicate, data=False): If `data` is False, the next vertex that matches the condition. If `data` is True, the next vertex and its attributes. + See Also + -------- + :meth:`vertices_where` + :meth:`edges_where_predicate`, :meth:`faces_where_predicate`, :meth:`cells_where_predicate` + """ for key, attr in self.vertices(True): if predicate(key, attr): @@ -847,6 +915,11 @@ def edges_where(self, conditions=None, data=False, **kwargs): If `data` is False, the next edge as a (u, v) tuple. If `data` is True, the next edge as a (u, v, data) tuple. + See Also + -------- + :meth:`edges_where_predicate` + :meth:`vertices_where`, :meth:`faces_where`, :meth:`cells_where` + """ conditions = conditions or {} conditions.update(kwargs) @@ -904,6 +977,11 @@ def edges_where_predicate(self, predicate, data=False): If `data` is False, the next edge as a (u, v) tuple. If `data` is True, the next edge as a (u, v, data) tuple. + See Also + -------- + :meth:`edges_where` + :meth:`vertices_where_predicate`, :meth:`faces_where_predicate`, :meth:`cells_where_predicate` + """ for key, attr in self.edges(True): if predicate(key, attr): @@ -932,6 +1010,11 @@ def faces_where(self, conditions=None, data=False, **kwargs): If `data` is False, the next face that matches the condition. If `data` is True, the next face and its attributes. + See Also + -------- + :meth:`faces_where_predicate` + :meth:`vertices_where`, :meth:`edges_where`, :meth:`cells_where` + """ conditions = conditions or {} conditions.update(kwargs) @@ -989,6 +1072,11 @@ def faces_where_predicate(self, predicate, data=False): If `data` is False, the next face that matches the condition. If `data` is True, the next face and its attributes. + See Also + -------- + :meth:`faces_where` + :meth:`vertices_where_predicate`, :meth:`edges_where_predicate`, :meth:`cells_where_predicate` + """ for fkey, attr in self.faces(True): if predicate(fkey, attr): @@ -1017,6 +1105,11 @@ def cells_where(self, conditions=None, data=False, **kwargs): If `data` is False, the next cell that matches the condition. If `data` is True, the next cell and its attributes. + See Also + -------- + :meth:`cells_where_predicate` + :meth:`vertices_where`, :meth:`edges_where`, :meth:`faces_where` + """ conditions = conditions or {} conditions.update(kwargs) @@ -1074,6 +1167,11 @@ def cells_where_predicate(self, predicate, data=False): If `data` is False, the next cell that matches the condition. If `data` is True, the next cell and its attributes. + See Also + -------- + :meth:`cells_where` + :meth:`vertices_where_predicate`, :meth:`edges_where_predicate`, :meth:`faces_where_predicate` + """ for ckey, attr in self.cells(True): if predicate(ckey, attr): @@ -1100,6 +1198,10 @@ def update_default_vertex_attributes(self, attr_dict=None, **kwattr): ------- None + See Also + -------- + :meth:`update_default_edge_attributes`, :meth:`update_default_face_attributes`, :meth:`update_default_cell_attributes` + Notes ----- Named arguments overwrite correpsonding name-value pairs in the attribute dictionary. @@ -1133,6 +1235,12 @@ def vertex_attribute(self, vertex, name, value=None): KeyError If the vertex does not exist. + See Also + -------- + :meth:`unset_vertex_attribute` + :meth:`vertex_attributes`, :meth:`vertices_attribute`, :meth:`vertices_attributes` + :meth:`edge_attribute`, :meth:`face_attribute`, :meth:`cell_attribute` + """ if vertex not in self._vertex: raise KeyError(vertex) @@ -1164,6 +1272,10 @@ def unset_vertex_attribute(self, vertex, name): KeyError If the vertex does not exist. + See Also + -------- + :meth:`vertex_attribute` + Notes ----- Unsetting the value of a vertex attribute implicitly sets it back to the value @@ -1199,6 +1311,11 @@ def vertex_attributes(self, vertex, names=None, values=None): KeyError If the vertex does not exist. + See Also + -------- + :meth:`vertex_attribute`, :meth:`vertices_attribute`, :meth:`vertices_attributes` + :meth:`edge_attributes`, :meth:`face_attributes`, :meth:`cell_attributes` + """ if vertex not in self._vertex: raise KeyError(vertex) @@ -1245,6 +1362,11 @@ def vertices_attribute(self, name, value=None, keys=None): KeyError If any of the vertices does not exist. + See Also + -------- + :meth:`vertex_attribute`, :meth:`vertex_attributes`, :meth:`vertices_attributes` + :meth:`edges_attribute`, :meth:`faces_attribute`, :meth:`cells_attribute` + """ vertices = keys or self.vertices() if value is not None: @@ -1281,6 +1403,11 @@ def vertices_attributes(self, names=None, values=None, keys=None): KeyError If any of the vertices does not exist. + See Also + -------- + :meth:`vertex_attribute`, :meth:`vertex_attributes`, :meth:`vertices_attribute` + :meth:`edges_attributes`, :meth:`faces_attributes`, :meth:`cells_attributes` + """ vertices = keys or self.vertices() if values: @@ -1307,6 +1434,10 @@ def update_default_edge_attributes(self, attr_dict=None, **kwattr): ------- None + See Also + -------- + :meth:`update_default_vertex_attributes`, :meth:`update_default_face_attributes`, :meth:`update_default_cell_attributes` + Notes ----- Named arguments overwrite correpsonding key-value pairs in the attribute dictionary. @@ -1339,6 +1470,12 @@ def edge_attribute(self, edge, name, value=None): KeyError If the edge does not exist. + See Also + -------- + :meth:`unset_edge_attribute` + :meth:`edge_attributes`, :meth:`edges_attribute`, :meth:`edges_attributes` + :meth:`vertex_attribute`, :meth:`face_attribute`, :meth:`cell_attribute` + """ u, v = edge if u not in self._plane or v not in self._plane[u]: @@ -1373,6 +1510,10 @@ def unset_edge_attribute(self, edge, name): ------- None + See Also + -------- + :meth:`edge_attribute` + Notes ----- Unsetting the value of an edge attribute implicitly sets it back to the value @@ -1410,6 +1551,11 @@ def edge_attributes(self, edge, names=None, values=None): KeyError If the edge does not exist. + See Also + -------- + :meth:`edge_attribute`, :meth:`edges_attribute`, :meth:`edges_attributes` + :meth:`vertex_attributes`, :meth:`face_attributes`, :meth:`cell_attributes` + """ u, v = edge if u not in self._plane or v not in self._plane[u]: @@ -1454,6 +1600,11 @@ def edges_attribute(self, name, value=None, edges=None): KeyError If any of the edges does not exist. + See Also + -------- + :meth:`edge_attribute`, :meth:`edge_attributes`, :meth:`edges_attributes` + :meth:`vertex_attribute`, :meth:`face_attribute`, :meth:`cell_attribute` + """ edges = edges or self.edges() if value is not None: @@ -1488,6 +1639,11 @@ def edges_attributes(self, names=None, values=None, edges=None): KeyError If any of the edges does not exist. + See Also + -------- + :meth:`edge_attribute`, :meth:`edge_attributes`, :meth:`edges_attribute` + :meth:`vertex_attributes`, :meth:`face_attributes`, :meth:`cell_attributes` + """ edges = edges or self.edges() if values: @@ -1514,6 +1670,10 @@ def update_default_face_attributes(self, attr_dict=None, **kwattr): ------- None + See Also + -------- + :meth:`update_default_vertex_attributes`, :meth:`update_default_edge_attributes`, :meth:`update_default_cell_attributes` + Notes ----- Named arguments overwrite correpsonding key-value pairs in the attribute dictionary. @@ -1546,6 +1706,12 @@ def face_attribute(self, face, name, value=None): KeyError If the face does not exist. + See Also + -------- + :meth:`unset_face_attribute` + :meth:`face_attributes`, :meth:`faces_attribute`, :meth:`faces_attributes` + :meth:`vertex_attribute`, :meth:`edge_attribute`, :meth:`cell_attribute` + """ if face not in self._halfface: raise KeyError(face) @@ -1579,6 +1745,10 @@ def unset_face_attribute(self, face, name): ------- None + See Also + -------- + :meth:`face_attribute` + Notes ----- Unsetting the value of a face attribute implicitly sets it back to the value @@ -1615,6 +1785,11 @@ def face_attributes(self, face, names=None, values=None): KeyError If the face does not exist. + See Also + -------- + :meth:`face_attribute`, :meth:`faces_attribute`, :meth:`faces_attributes` + :meth:`vertex_attributes`, :meth:`edge_attributes`, :meth:`cell_attributes` + """ if face not in self._halfface: raise KeyError(face) @@ -1657,6 +1832,11 @@ def faces_attribute(self, name, value=None, faces=None): KeyError If any of the faces does not exist. + See Also + -------- + :meth:`face_attribute`, :meth:`face_attributes`, :meth:`faces_attributes` + :meth:`vertex_attribute`, :meth:`edge_attribute`, :meth:`cell_attribute` + """ faces = faces or self.faces() if value is not None: @@ -1693,6 +1873,11 @@ def faces_attributes(self, names=None, values=None, faces=None): KeyError If any of the faces does not exist. + See Also + -------- + :meth:`face_attribute`, :meth:`face_attributes`, :meth:`faces_attribute` + :meth:`vertex_attributes`, :meth:`edge_attributes`, :meth:`cell_attributes` + """ faces = faces or self.faces() if values: @@ -1719,8 +1904,12 @@ def update_default_cell_attributes(self, attr_dict=None, **kwattr): ------- None + See Also + -------- + :meth:`update_default_vertex_attributes`, :meth:`update_default_edge_attributes`, :meth:`update_default_face_attributes` + Notes - ---- + ----- Named arguments overwrite corresponding cell-value pairs in the attribute dictionary. """ @@ -1751,6 +1940,12 @@ def cell_attribute(self, cell, name, value=None): KeyError If the cell does not exist. + See Also + -------- + :meth:`unset_cell_attribute` + :meth:`cell_attributes`, :meth:`cells_attribute`, :meth:`cells_attributes` + :meth:`vertex_attribute`, :meth:`edge_attribute`, :meth:`face_attribute` + """ if cell not in self._cell: raise KeyError(cell) @@ -1783,6 +1978,10 @@ def unset_cell_attribute(self, cell, name): KeyError If the cell does not exist. + See Also + -------- + :meth:`cell_attribute` + Notes ----- Unsetting the value of a cell attribute implicitly sets it back to the value @@ -1819,6 +2018,11 @@ def cell_attributes(self, cell, names=None, values=None): KeyError If the cell does not exist. + See Also + -------- + :meth:`cell_attribute`, :meth:`cells_attribute`, :meth:`cells_attributes` + :meth:`vertex_attributes`, :meth:`edge_attributes`, :meth:`face_attributes` + """ if cell not in self._cell: raise KeyError(cell) @@ -1859,6 +2063,11 @@ def cells_attribute(self, name, value=None, cells=None): KeyError If any of the cells does not exist. + See Also + -------- + :meth:`cell_attribute`, :meth:`cell_attributes`, :meth:`cells_attributes` + :meth:`vertex_attribute`, :meth:`edge_attribute`, :meth:`face_attribute` + """ if not cells: cells = self.cells() @@ -1896,6 +2105,11 @@ def cells_attributes(self, names=None, values=None, cells=None): KeyError If any of the faces does not exist. + See Also + -------- + :meth:`cell_attribute`, :meth:`cell_attributes`, :meth:`cells_attribute` + :meth:`vertex_attributes`, :meth:`edge_attributes`, :meth:`face_attributes` + """ if not cells: cells = self.cells() @@ -1917,6 +2131,10 @@ def number_of_vertices(self): int The number of vertices. + See Also + -------- + :meth:`number_of_edges`, :meth:`number_of_faces`, :meth:`number_of_cells` + """ return len(list(self.vertices())) @@ -1928,6 +2146,10 @@ def number_of_edges(self): int The number of edges. + See Also + -------- + :meth:`number_of_vertices`, :meth:`number_of_faces`, :meth:`number_of_cells` + """ return len(list(self.edges())) @@ -1939,6 +2161,10 @@ def number_of_faces(self): int The number of faces. + See Also + -------- + :meth:`number_of_vertices`, :meth:`number_of_edges`, :meth:`number_of_cells` + """ return len(list(self.faces())) @@ -1950,11 +2176,24 @@ def number_of_cells(self): int The number of cells. + See Also + -------- + :meth:`number_of_vertices`, :meth:`number_of_edges`, :meth:`number_of_faces` + """ return len(list(self.cells())) def is_valid(self): - NotImplementedError + """Verify that the volmesh is valid. + + Returns + ------- + bool + True if the volmesh is valid. + False otherwise. + + """ + raise NotImplementedError # -------------------------------------------------------------------------- # vertex topology @@ -1974,6 +2213,10 @@ def has_vertex(self, vertex): True if the vertex is in the volmesh. False otherwise. + See Also + -------- + :meth:`has_edge`, :meth:`has_face`, :meth:`has_cell` + """ return vertex in self._vertex @@ -1990,6 +2233,12 @@ def vertex_neighbors(self, vertex): list[int] The list of neighboring vertices. + See Also + -------- + :meth:`vertex_degree`, :meth:`vertex_min_degree`, :meth:`vertex_max_degree` + :meth:`vertex_faces`, :meth:`vertex_halffaces`, :meth:`vertex_cells` + :meth:`vertex_neighborhood` + """ return self._plane[vertex].keys() @@ -2008,6 +2257,10 @@ def vertex_neighborhood(self, vertex, ring=1): list[int] The vertices in the neighborhood. + See Also + -------- + :meth:`vertex_neighbors` + Notes ----- The vertices in the neighborhood are unordered. @@ -2038,6 +2291,10 @@ def vertex_degree(self, vertex): int The degree of the vertex. + See Also + -------- + :meth:`vertex_neighbors`, :meth:`vertex_min_degree`, :meth:`vertex_max_degree` + """ return len(self.vertex_neighbors(vertex)) @@ -2049,6 +2306,10 @@ def vertex_min_degree(self): int The lowest degree of all vertices. + See Also + -------- + :meth:`vertex_degree`, :meth:`vertex_max_degree` + """ if not self._vertex: return 0 @@ -2062,6 +2323,10 @@ def vertex_max_degree(self): int The highest degree of all vertices. + See Also + -------- + :meth:`vertex_degree`, :meth:`vertex_min_degree` + """ if not self._vertex: return 0 @@ -2080,6 +2345,10 @@ def vertex_halffaces(self, vertex): list[int] The list of halffaces connected to a vertex. + See Also + -------- + :meth:`vertex_neighbors`, :meth:`vertex_faces`, :meth:`vertex_cells` + """ cells = self.vertex_cells(vertex) nbrs = self.vertex_neighbors(vertex) @@ -2104,6 +2373,10 @@ def vertex_cells(self, vertex): list[int] The list of cells connected to a vertex. + See Also + -------- + :meth:`vertex_neighbors`, :meth:`vertex_faces`, :meth:`vertex_halffaces` + """ cells = set() for nbr in self._plane[vertex]: @@ -2126,6 +2399,10 @@ def is_vertex_on_boundary(self, vertex): True if the vertex is on the boundary. False otherwise. + See Also + -------- + :meth:`is_edge_on_boundary`, :meth:`is_face_on_boundary`, :meth:`is_cell_on_boundary` + """ halffaces = self.vertex_halffaces(vertex) for halfface in halffaces: @@ -2151,6 +2428,10 @@ def has_edge(self, edge): True if the edge exists. False otherwise. + See Also + -------- + :meth:`has_vertex`, :meth:`has_face`, :meth:`has_cell` + """ return edge in set(self.edges()) @@ -2167,6 +2448,10 @@ def edge_halffaces(self, edge): list[int] Ordered list of halfface identifiers. + See Also + -------- + :meth:`edge_cells` + """ u, v = edge cells = [cell for cell in self._plane[u][v].values() if cell is not None] @@ -2197,6 +2482,10 @@ def edge_cells(self, edge): list[int] Ordered list of keys identifying the ordered cells. + See Also + -------- + :meth:`edge_halffaces` + """ halffaces = self.edge_halffaces(edge) return [self.halfface_cell(halfface) for halfface in halffaces] @@ -2215,6 +2504,10 @@ def is_edge_on_boundary(self, edge): True if the edge is on the boundary. False otherwise. + See Also + -------- + :meth:`is_vertex_on_boundary`, :meth:`is_face_on_boundary`, :meth:`is_cell_on_boundary` + Note ---- This method simply checks if u-v or v-u is on the edge of the volmesh. @@ -2242,6 +2535,10 @@ def has_halfface(self, halfface): True if the face exists. False otherwise. + See Also + -------- + :meth:`has_vertex`, :meth:`has_edge`, :meth:`has_cell` + """ return halfface in self._halfface @@ -2258,6 +2555,10 @@ def halfface_vertices(self, halfface): list[int] Ordered vertex identifiers. + See Also + -------- + :meth:`halfface_edges`, :meth:`halfface_halfedges` + """ return self._halfface[halfface] @@ -2274,6 +2575,10 @@ def halfface_halfedges(self, halfface): list[tuple[int, int]] The halfedges of a halfface. + See Also + -------- + :meth:`halfface_edges`, :meth:`halfface_vertices` + """ vertices = self.halfface_vertices(halfface) return list(pairwise(vertices + vertices[0:1])) @@ -2291,6 +2596,10 @@ def halfface_cell(self, halfface): int Identifier of the cell. + See Also + -------- + :meth:`halfface_opposite_cell` + """ u, v, w = self._halfface[halfface][0:3] return self._plane[u][v][w] @@ -2308,6 +2617,10 @@ def halfface_opposite_cell(self, halfface): int Identifier of the cell. + See Also + -------- + :meth:`halfface_cell` + """ u, v, w = self._halfface[halfface][0:3] return self._plane[w][v][u] @@ -2325,6 +2638,10 @@ def halfface_opposite_halfface(self, halfface): int Identifier of the opposite face. + See Also + -------- + :meth:`halfface_adjacent_halfface` + Notes ----- A face and its opposite face share the same vertices, but in reverse order. @@ -2352,6 +2669,10 @@ def halfface_adjacent_halfface(self, halfface, halfedge): int | None The identifier of the adjacent half-face, or None if `halfedge` is on the boundary. + See Also + -------- + :meth:`halfface_opposite_halfface` + Notes ----- The adjacent face belongs a to one of the cell neighbors over faces of the initial cell. @@ -2361,7 +2682,7 @@ def halfface_adjacent_halfface(self, halfface, halfedge): u, v = halfedge cell = self.halfface_cell(halfface) nbr_halfface = self._cell[cell][v][u] - w = self.face_vertex_ancestor(nbr_halfface, v) + w = self.halfface_vertex_ancestor(nbr_halfface, v) nbr_cell = self._plane[u][v][w] if nbr_cell is None: return None @@ -2387,6 +2708,10 @@ def halfface_vertex_ancestor(self, halfface, vertex): ValueError If the vertex is not part of the face. + See Also + -------- + :meth:`halfface_vertex_descendent` + """ i = self._halfface[halfface].index(vertex) return self._halfface[halfface][i - 1] @@ -2411,6 +2736,10 @@ def halfface_vertex_descendent(self, halfface, vertex): ValueError If the vertex is not part of the face. + See Also + -------- + :meth:`halfface_vertex_ancestor` + """ if self._halfface[halfface][-1] == vertex: return self._halfface[halfface][0] @@ -2418,6 +2747,27 @@ def halfface_vertex_descendent(self, halfface, vertex): return self._halfface[halfface][i + 1] def halfface_manifold_neighbors(self, halfface): + """Return the halfface neighbors of a halfface that are on the same manifold. + + Parameters + ---------- + halfface : int + The identifier of the halfface. + + Returns + ------- + list[int] + The list of neighboring halffaces. + + See Also + -------- + :meth:`halfface_manifold_neighborhood` + + Notes + ----- + Neighboring halffaces on the same cell are not included. + + """ nbrs = [] cell = self.halfface_cell(halfface) for u, v in self.halfface_halfedges(halfface): @@ -2429,12 +2779,12 @@ def halfface_manifold_neighbors(self, halfface): nbrs.append(nbr) return nbrs - def halfface_manifold_neighborhood(self, hfkey, ring=1): + def halfface_manifold_neighborhood(self, halfface, ring=1): """Return the halfface neighborhood of a halfface across their edges. Parameters ---------- - key : int + halfface : int The identifier of the halfface. Returns @@ -2442,22 +2792,26 @@ def halfface_manifold_neighborhood(self, hfkey, ring=1): list[int] The list of neighboring halffaces. + See Also + -------- + :meth:`halfface_manifold_neighbors` + Notes ----- Neighboring halffaces on the same cell are not included. """ - nbrs = set(self.halfface_manifold_neighbors(hfkey)) + nbrs = set(self.halfface_manifold_neighbors(halfface)) i = 1 while True: if i == ring: break temp = [] - for nbr_hfkey in nbrs: - temp += self.halfface_manifold_neighbors(nbr_hfkey) + for nbr in nbrs: + temp += self.halfface_manifold_neighbors(nbr) nbrs.update(temp) i += 1 - return list(nbrs - set([hfkey])) + return list(nbrs - set([halfface])) def is_halfface_on_boundary(self, halfface): """Verify that a face is on the boundary. @@ -2473,6 +2827,10 @@ def is_halfface_on_boundary(self, halfface): True if the face is on the boundary. False otherwise. + See Also + -------- + :meth:`is_vertex_on_boundary`, :meth:`is_edge_on_boundary`, :meth:`is_cell_on_boundary` + """ u, v, w = self._halfface[halfface][0:3] return self._plane[w][v][u] is None @@ -2494,6 +2852,10 @@ def cell_vertices(self, cell): list[int] The vertex identifiers of a cell. + See Also + -------- + :meth:`cell_edges`, :meth:`cell_faces`, :meth:`cell_halfedges` + Notes ----- This method is similar to :meth:`~compas.datastructures.HalfEdge.vertices`, @@ -2515,6 +2877,10 @@ def cell_halfedges(self, cell): list[tuple[int, int]] The halfedges of a cell. + See Also + -------- + :meth:`cell_edges`, :meth:`cell_faces`, :meth:`cell_vertices` + Notes ----- This method is similar to :meth:`~compas.datastructures.HalfEdge.halfedges`, @@ -2539,6 +2905,10 @@ def cell_edges(self, cell): list[tuple[int, int]] The edges of the cell. + See Also + -------- + :meth:`cell_halfedges`, :meth:`cell_faces`, :meth:`cell_vertices` + Notes ----- This method is similar to :meth:`~compas.datastructures.HalfEdge.edges`, @@ -2560,6 +2930,10 @@ def cell_faces(self, cell): list[int] The faces of a cell. + See Also + -------- + :meth:`cell_halfedges`, :meth:`cell_edges`, :meth:`cell_vertices` + Notes ----- This method is similar to :meth:`~compas.datastructures.HalfEdge.faces`, @@ -2586,6 +2960,10 @@ def cell_vertex_neighbors(self, cell, vertex): list[int] The list of neighboring vertices. + See Also + -------- + :meth:`cell_vertex_faces` + Notes ----- All of the returned vertices are part of the cell. @@ -2620,6 +2998,10 @@ def cell_vertex_faces(self, cell, vertex): list[int] The ordered list of faces connected to a vertex of a cell. + See Also + -------- + :meth:`cell_vertex_neighbors` + Notes ----- All of the returned faces should are part of the same cell. @@ -2653,6 +3035,10 @@ def cell_halfedge_face(self, cell, halfedge): int The identifier of the face. + See Also + -------- + :meth:`cell_halfedge_opposite_face` + Notes ----- This method is similar to :meth:`~compas.datastructures.HalfEdge.halfedge_face`, @@ -2677,6 +3063,10 @@ def cell_halfedge_opposite_face(self, cell, halfedge): int The identifier of the face. + See Also + -------- + :meth:`cell_halfedge_face` + """ u, v = halfedge return self._cell[cell][v][u] @@ -2696,6 +3086,10 @@ def cell_face_neighbors(self, cell, face): int The identifier of the face. + See Also + -------- + :meth:`cell_neighbors` + Notes ----- This method is similar to :meth:`~compas.datastructures.HalfEdge.face_neighbors`, @@ -2722,6 +3116,10 @@ def cell_neighbors(self, cell): list[int] The identifiers of the adjacent cells. + See Also + -------- + :meth:`cell_face_neighbors` + """ nbrs = [] for face in self.cell_faces(cell): @@ -2744,6 +3142,10 @@ def is_cell_on_boundary(self, cell): True if the face is on the boundary. False otherwise. + See Also + -------- + :meth:`is_vertex_on_boundary`, :meth:`is_edge_on_boundary`, :meth:`is_face_on_boundary` + """ faces = self.cell_faces(cell) for face in faces: @@ -2763,6 +3165,10 @@ def vertices_on_boundaries(self): list[int] The vertices of the boundary. + See Also + -------- + :meth:`faces_on_boundaries`, :meth:`cells_on_boundaries` + """ vertices = set() for face in self._halfface: @@ -2778,6 +3184,10 @@ def halffaces_on_boundaries(self): list[int] The faces of the boundary. + See Also + -------- + :meth:`vertices_on_boundaries`, :meth:`cells_on_boundaries` + """ faces = set() for face in self._halfface: @@ -2793,6 +3203,10 @@ def cells_on_boundaries(self): list[int] The cells of the boundary. + See Also + -------- + :meth:`vertices_on_boundaries`, :meth:`faces_on_boundaries` + """ cells = set() for face in self.halffaces_on_boundaries(): diff --git a/src/compas/datastructures/mesh/__init__.py b/src/compas/datastructures/mesh/__init__.py index 8f660e54fe3..e69de29bb2d 100644 --- a/src/compas/datastructures/mesh/__init__.py +++ b/src/compas/datastructures/mesh/__init__.py @@ -1,47 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from compas import IPY - -if not IPY: - from .matrices import * # noqa: F401 F403 - -from .operations import * # noqa: F401 F403 -from .clean import * # noqa: F401 F403 - -from .bbox import * # noqa: F401 F403 -from .combinatorics import * # noqa: F401 F403 -from .conway import * # noqa: F401 F403 -from .curvature import * # noqa: F401 F403 -from .duality import * # noqa: F401 F403 -from .explode import * # noqa: F401 F403 -from .geometry import * # noqa: F401 F403 -from .join import * # noqa: F401 F403 -from .offset import * # noqa: F401 F403 -from .orientation import * # noqa: F401 F403 -from .planarisation import * # noqa: F401 F403 -from .slice import * # noqa: F401 F403 - -# has to be imported before remeshing -from .smoothing import * # noqa: F401 F403 -from .remesh import * # noqa: F401 F403 -from .subdivision import * # noqa: F401 F403 -from .transformations import * # noqa: F401 F403 -from .triangulation import * # noqa: F401 F403 -from .trimming import * # noqa: F401 F403 - -if not IPY: - from .bbox_numpy import * # noqa: F401 F403 - from .contours_numpy import * # noqa: F401 F403 - from .descent_numpy import * # noqa: F401 F403 - from .geodesics_numpy import * # noqa: F401 F403 - from .pull_numpy import * # noqa: F401 F403 - from .smoothing_numpy import * # noqa: F401 F403 - from .transformations_numpy import * # noqa: F401 F403 - from .trimesh_samplepoints_numpy import * # noqa: F401 F403 - -from .mesh import Mesh # noqa: F401 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/datastructures/mesh/bbox.py b/src/compas/datastructures/mesh/bbox.py index 73ff7718fbd..93b8a158292 100644 --- a/src/compas/datastructures/mesh/bbox.py +++ b/src/compas/datastructures/mesh/bbox.py @@ -2,17 +2,10 @@ from __future__ import division from __future__ import print_function - from compas.geometry import bounding_box from compas.geometry import bounding_box_xy -__all__ = [ - "mesh_bounding_box", - "mesh_bounding_box_xy", -] - - def mesh_bounding_box(mesh): """Compute the (axis aligned) bounding box of a mesh. @@ -26,6 +19,12 @@ def mesh_bounding_box(mesh): list[list[float]] The 8 corners of the bounding box of the mesh. + See Also + -------- + :func:`compas.geometry.mesh_oriented_bounding_box_numpy` + :func:`compas.geometry.mesh_oriented_bounding_box_xy_numpy` + :func:`compas.geometry.mesh_bounding_box_xy` + Examples -------- >>> from compas.datastructures import Mesh @@ -51,6 +50,12 @@ def mesh_bounding_box_xy(mesh): list[list[float]] The 4 corners of the bounding polygon in the XY plane. + See Also + -------- + :func:`compas.geometry.mesh_bounding_box` + :func:`compas.geometry.mesh_oriented_bounding_box_numpy` + :func:`compas.geometry.mesh_oriented_bounding_box_xy_numpy` + Examples -------- >>> from compas.datastructures import Mesh diff --git a/src/compas/datastructures/mesh/bbox_numpy.py b/src/compas/datastructures/mesh/bbox_numpy.py index 8bc05144ef8..6d592bc2870 100644 --- a/src/compas/datastructures/mesh/bbox_numpy.py +++ b/src/compas/datastructures/mesh/bbox_numpy.py @@ -2,17 +2,10 @@ from __future__ import division from __future__ import print_function - from compas.geometry import oriented_bounding_box_numpy from compas.geometry import oriented_bounding_box_xy_numpy -__all__ = [ - "mesh_oriented_bounding_box_numpy", - "mesh_oriented_bounding_box_xy_numpy", -] - - def mesh_oriented_bounding_box_numpy(mesh): """Compute the (axis aligned) bounding box of a mesh. diff --git a/src/compas/datastructures/mesh/clean.py b/src/compas/datastructures/mesh/clean.py index 4e47478ae86..f09c43322e7 100644 --- a/src/compas/datastructures/mesh/clean.py +++ b/src/compas/datastructures/mesh/clean.py @@ -5,9 +5,6 @@ from compas.utilities import geometric_key -__all__ = ["mesh_delete_duplicate_vertices"] - - def mesh_delete_duplicate_vertices(mesh, precision=None): """Cull all duplicate vertices of a mesh and sanitize affected faces. diff --git a/src/compas/datastructures/mesh/combinatorics.py b/src/compas/datastructures/mesh/combinatorics.py index 04d1cea8a92..92833a6e701 100644 --- a/src/compas/datastructures/mesh/combinatorics.py +++ b/src/compas/datastructures/mesh/combinatorics.py @@ -6,9 +6,6 @@ from compas.topology import connected_components -__all__ = ["mesh_is_connected", "mesh_connected_components"] - - def mesh_is_connected(mesh): """Verify that the mesh is connected. @@ -45,7 +42,7 @@ def mesh_is_connected(mesh): """ if not mesh.vertex: return False - nodes = breadth_first_traverse(mesh.adjacency, mesh.get_any_vertex()) + nodes = breadth_first_traverse(mesh.adjacency, mesh.vertex_sample(size=1)[0]) return len(nodes) == mesh.number_of_vertices() diff --git a/src/compas/datastructures/mesh/contours_numpy.py b/src/compas/datastructures/mesh/contours_numpy.py index c1feb571e9a..4b8648d1e9f 100644 --- a/src/compas/datastructures/mesh/contours_numpy.py +++ b/src/compas/datastructures/mesh/contours_numpy.py @@ -15,12 +15,6 @@ from compas.numerical import scalarfield_contours_numpy -__all__ = [ - "mesh_isolines_numpy", - "mesh_contours_numpy", -] - - def mesh_isolines_numpy(mesh, attr_name, N=50): """Compute the isolines of a specified attribute of the vertices of a mesh. diff --git a/src/compas/datastructures/mesh/conway.py b/src/compas/datastructures/mesh/conway.py index 9b72c3912ff..8b7f5b58ccf 100644 --- a/src/compas/datastructures/mesh/conway.py +++ b/src/compas/datastructures/mesh/conway.py @@ -3,23 +3,6 @@ from __future__ import division -__all__ = [ - "mesh_conway_dual", - "mesh_conway_join", - "mesh_conway_ambo", - "mesh_conway_kis", - "mesh_conway_needle", - "mesh_conway_zip", - "mesh_conway_truncate", - "mesh_conway_ortho", - "mesh_conway_expand", - "mesh_conway_gyro", - "mesh_conway_snub", - "mesh_conway_meta", - "mesh_conway_bevel", -] - - def mesh_conway_dual(mesh): """Generates the dual mesh from a seed mesh. @@ -115,7 +98,7 @@ def mesh_conway_join(mesh): fkey_index[mesh.halfedge[u][v]], ] for u, v in mesh.edges() - if not mesh.is_edge_on_boundary(u, v) + if not mesh.is_edge_on_boundary((u, v)) ] join_mesh = cls.from_vertices_and_faces(vertices, faces) # is this necessary? @@ -439,7 +422,7 @@ def mesh_conway_gyro(mesh): cls = type(mesh) vertices = [mesh.vertex_coordinates(vkey) for vkey in mesh.vertices()] vertices += [mesh.face_centroid(fkey) for fkey in mesh.faces()] - vertices += [mesh.edge_point(u, v, t=0.33) for u in mesh.vertices() for v in mesh.halfedge[u]] + vertices += [mesh.edge_point((u, v), t=0.33) for u in mesh.vertices() for v in mesh.halfedge[u]] V = mesh.number_of_vertices() F = mesh.number_of_faces() vkey_index = {vkey: i for i, vkey in enumerate(mesh.vertices())} diff --git a/src/compas/datastructures/mesh/curvature.py b/src/compas/datastructures/mesh/curvature.py index fbac4cb695e..20c3160f11b 100644 --- a/src/compas/datastructures/mesh/curvature.py +++ b/src/compas/datastructures/mesh/curvature.py @@ -7,9 +7,6 @@ from compas.geometry import angle_points -__all__ = ["trimesh_mean_curvature", "trimesh_gaussian_curvature"] - - def trimesh_mean_curvature(mesh): pass diff --git a/src/compas/datastructures/mesh/descent_numpy.py b/src/compas/datastructures/mesh/descent_numpy.py index e96f39d8766..c73b6697dd1 100644 --- a/src/compas/datastructures/mesh/descent_numpy.py +++ b/src/compas/datastructures/mesh/descent_numpy.py @@ -6,9 +6,6 @@ from compas.numerical import grad -__all__ = ["trimesh_descent"] - - def trimesh_descent(trimesh): """Compute the gradient per face of the heightfield of the vertices of the mesh. diff --git a/src/compas/datastructures/mesh/duality.py b/src/compas/datastructures/mesh/duality.py index f57959ac928..f64565d309a 100644 --- a/src/compas/datastructures/mesh/duality.py +++ b/src/compas/datastructures/mesh/duality.py @@ -5,8 +5,6 @@ from math import pi from compas.utilities import flatten -__all__ = ["mesh_dual"] - PI2 = 2.0 * pi diff --git a/src/compas/datastructures/mesh/explode.py b/src/compas/datastructures/mesh/explode.py index 9d4f584daad..3a17d0ea90c 100644 --- a/src/compas/datastructures/mesh/explode.py +++ b/src/compas/datastructures/mesh/explode.py @@ -4,12 +4,6 @@ from compas.topology import connected_components -__all__ = [ - "mesh_disconnected_vertices", - "mesh_disconnected_faces", - "mesh_explode", -] - def mesh_disconnected_vertices(mesh): """Get the disconnected vertex groups in a mesh. diff --git a/src/compas/datastructures/mesh/geodesics_numpy.py b/src/compas/datastructures/mesh/geodesics_numpy.py index a88daf7c86b..eccafb1d85a 100644 --- a/src/compas/datastructures/mesh/geodesics_numpy.py +++ b/src/compas/datastructures/mesh/geodesics_numpy.py @@ -20,9 +20,6 @@ from .matrices import trimesh_cotangent_laplacian_matrix -__all__ = ["mesh_geodesic_distances_numpy"] - - def mesh_geodesic_distances_numpy(mesh, sources, m=1.0): """Compute geodesic from the vertices of a mesh to given source vertices. @@ -43,9 +40,9 @@ def mesh_geodesic_distances_numpy(mesh, sources, m=1.0): """ Lc = trimesh_cotangent_laplacian_matrix(mesh) - key_index = mesh.key_index() + vertex_index = mesh.vertex_index() vertices = mesh.vertices_attributes("xyz") - faces = [[key_index[key] for key in mesh.face_vertices(fkey)] for fkey in mesh.faces()] + faces = [[vertex_index[vertex] for vertex in mesh.face_vertices(face)] for face in mesh.faces()] V = array(vertices) F = array(faces, dtype=int) diff --git a/src/compas/datastructures/mesh/geometry.py b/src/compas/datastructures/mesh/geometry.py index c14fa9b7246..28a915abac4 100644 --- a/src/compas/datastructures/mesh/geometry.py +++ b/src/compas/datastructures/mesh/geometry.py @@ -4,8 +4,6 @@ from compas.geometry import circle_from_points -__all__ = ["trimesh_face_circle"] - def trimesh_face_circle(mesh, fkey): """Get data on circumcentre of triangular face. diff --git a/src/compas/datastructures/mesh/join.py b/src/compas/datastructures/mesh/join.py index 107b1822adb..613d6d8ac24 100644 --- a/src/compas/datastructures/mesh/join.py +++ b/src/compas/datastructures/mesh/join.py @@ -5,8 +5,6 @@ from compas.utilities import pairwise from compas.utilities import geometric_key -__all__ = ["mesh_weld", "meshes_join", "meshes_join_and_weld"] - def mesh_weld(mesh, precision=None, cls=None): """Weld vertices of a mesh within some precision distance. diff --git a/src/compas/datastructures/mesh/matrices.py b/src/compas/datastructures/mesh/matrices.py index de5f2a3336c..db78b10cc9a 100644 --- a/src/compas/datastructures/mesh/matrices.py +++ b/src/compas/datastructures/mesh/matrices.py @@ -21,17 +21,6 @@ from compas.numerical import face_matrix -__all__ = [ - "mesh_adjacency_matrix", - "mesh_connectivity_matrix", - "mesh_degree_matrix", - "mesh_face_matrix", - "mesh_laplacian_matrix", - "trimesh_cotangent_laplacian_matrix", - "trimesh_vertexarea_matrix", -] - - def mesh_adjacency_matrix(mesh, rtype="array"): """Creates a vertex adjacency matrix from a Mesh datastructure. @@ -58,8 +47,8 @@ def mesh_adjacency_matrix(mesh, rtype="array"): >>> A = mesh_adjacency_matrix(mesh, rtype='csr') """ - key_index = mesh.key_index() - adjacency = [[key_index[nbr] for nbr in mesh.vertex_neighbors(key)] for key in mesh.vertices()] + vertex_index = mesh.vertex_index() + adjacency = [[vertex_index[nbr] for nbr in mesh.vertex_neighbors(vertex)] for vertex in mesh.vertices()] return adjacency_matrix(adjacency, rtype=rtype) @@ -93,8 +82,8 @@ def mesh_connectivity_matrix(mesh, rtype="array"): >>> uv = C.dot(xyz) """ - key_index = mesh.key_index() - edges = [(key_index[u], key_index[v]) for u, v in mesh.edges()] + vertex_index = mesh.vertex_index() + edges = [(vertex_index[u], vertex_index[v]) for u, v in mesh.edges()] return connectivity_matrix(edges, rtype=rtype) @@ -128,8 +117,8 @@ def mesh_degree_matrix(mesh, rtype="array"): array([3., 3., 3., 3., 3., 3., 3., 3.]) """ - key_index = mesh.key_index() - adjacency = [[key_index[nbr] for nbr in mesh.vertex_neighbors(key)] for key in mesh.vertices()] + vertex_index = mesh.vertex_index() + adjacency = [[vertex_index[nbr] for nbr in mesh.vertex_neighbors(vertex)] for vertex in mesh.vertices()] return degree_matrix(adjacency, rtype=rtype) @@ -185,8 +174,8 @@ def mesh_face_matrix(mesh, rtype="array"): True """ - key_index = {key: index for index, key in enumerate(mesh.vertices())} - face_vertices = [[key_index[key] for key in mesh.face_vertices(fkey)] for fkey in mesh.faces()] + vertex_index = {vertex: index for index, vertex in enumerate(mesh.vertices())} + face_vertices = [[vertex_index[vertex] for vertex in mesh.face_vertices(face)] for face in mesh.faces()] return face_matrix(face_vertices, rtype=rtype) @@ -246,18 +235,18 @@ def mesh_laplacian_matrix(mesh, rtype="csr"): """ data, rows, cols = [], [], [] - key_index = mesh.key_index() + vertex_index = mesh.vertex_index() - for key in mesh.vertices(): - i = key_index[key] - nbrs = mesh.vertex_neighbors(key) + for vertex in mesh.vertices(): + i = vertex_index[vertex] + nbrs = mesh.vertex_neighbors(vertex) w = len(nbrs) data.append(-1.0) rows.append(i) cols.append(i) d = 1.0 / w for nbr in nbrs: - j = key_index[nbr] + j = vertex_index[nbr] data.append(d) rows.append(i) cols.append(j) @@ -275,17 +264,15 @@ def mesh_laplacian_matrix(mesh, rtype="csr"): return L -def trimesh_edge_cotangent(mesh, u, v): +def trimesh_edge_cotangent(mesh, edge): """Compute the cotangent of the angle opposite a halfedge of the triangle mesh. Parameters ---------- mesh : :class:`~compas.datastructures.Mesh` Instance of mesh. - u : int - The identifier of the first vertex of the halfedge. - v : int - The identifier of the second vertex of the halfedge. + edge : tuple[int, int] + The identifier of the halfedge. Returns ------- @@ -293,29 +280,28 @@ def trimesh_edge_cotangent(mesh, u, v): The edge cotangent. """ - fkey = mesh.halfedge[u][v] + u, v = edge + face = mesh.halfedge[u][v] cotangent = 0.0 - if fkey is not None: - w = mesh.face_vertex_ancestor(fkey, u) - wu = mesh.edge_vector(w, u) - wv = mesh.edge_vector(w, v) + if face is not None: + w = mesh.face_vertex_ancestor(face, u) + wu = mesh.edge_vector((w, u)) + wv = mesh.edge_vector((w, v)) length = length_vector(cross_vectors(wu, wv)) if length: cotangent = dot_vectors(wu, wv) / length return cotangent -def trimesh_edge_cotangents(mesh, u, v): +def trimesh_edge_cotangents(mesh, edge): """Compute the cotangents of the angles opposite both sides of an edge of the triangle mesh. Parameters ---------- mesh : :class:`~compas.datastructures.Mesh` Instance of mesh. - u : int - The identifier of the first vertex of the edge. - v : int - The identifier of the second vertex of the edge. + edge : tuple[int, int] + The identifier of the edge. Returns ------- @@ -323,8 +309,9 @@ def trimesh_edge_cotangents(mesh, u, v): The two edge cotangents. """ - a = trimesh_edge_cotangent(mesh, u, v) - b = trimesh_edge_cotangent(mesh, v, u) + u, v = edge + a = trimesh_edge_cotangent(mesh, (u, v)) + b = trimesh_edge_cotangent(mesh, (v, u)) return a, b @@ -373,28 +360,28 @@ def trimesh_cotangent_laplacian_matrix(mesh, rtype="csr"): `Laplacian Mesh Optimization `_. """ - key_index = mesh.key_index() + vertex_index = mesh.vertex_index() n = mesh.number_of_vertices() data = [] rows = [] cols = [] - for key in mesh.vertices(): - nbrs = mesh.vertex_neighbors(key) - i = key_index[key] + for vertex in mesh.vertices(): + nbrs = mesh.vertex_neighbors(vertex) + i = vertex_index[vertex] data.append(-1.0) rows.append(i) cols.append(i) W = 0 for nbr in nbrs: - a, b = trimesh_edge_cotangents(mesh, key, nbr) + a, b = trimesh_edge_cotangents(mesh, (vertex, nbr)) w = a + b W += w for nbr in nbrs: - j = key_index[nbr] - a, b = trimesh_edge_cotangents(mesh, key, nbr) + j = vertex_index[nbr] + a, b = trimesh_edge_cotangents(mesh, (vertex, nbr)) w = a + b data.append(w / W) rows.append(i) @@ -439,10 +426,10 @@ def trimesh_vertexarea_matrix(mesh): [0.1666, 0.1666, 0.1666] """ - key_index = mesh.key_index() + vertex_index = mesh.vertex_index() xyz = asarray(mesh.vertices_attributes("xyz"), dtype=float) tris = asarray( - [[key_index[key] for key in mesh.face_vertices(fkey)] for fkey in mesh.faces()], + [[vertex_index[vertex] for vertex in mesh.face_vertices(face)] for face in mesh.faces()], dtype=int, ) e1 = xyz[tris[:, 1]] - xyz[tris[:, 0]] diff --git a/src/compas/datastructures/mesh/mesh.py b/src/compas/datastructures/mesh/mesh.py index b863b893c48..b10d918e492 100644 --- a/src/compas/datastructures/mesh/mesh.py +++ b/src/compas/datastructures/mesh/mesh.py @@ -17,6 +17,13 @@ from compas.files import PLY from compas.files import STL +from compas.geometry import Point +from compas.geometry import Vector +from compas.geometry import Line +from compas.geometry import Plane +from compas.geometry import Polygon +from compas.geometry import Circle +from compas.geometry import Frame from compas.geometry import Polyhedron from compas.geometry import angle_points from compas.geometry import area_polygon @@ -45,11 +52,11 @@ from compas.datastructures import HalfEdge -from .operations import mesh_collapse_edge -from .operations import mesh_split_edge -from .operations import mesh_split_face -from .operations import mesh_split_strip -from .operations import mesh_merge_faces +from .operations.collapse import mesh_collapse_edge +from .operations.split import mesh_split_edge +from .operations.split import mesh_split_face +from .operations.split import mesh_split_strip +from .operations.merge import mesh_merge_faces from .bbox import mesh_bounding_box from .bbox import mesh_bounding_box_xy @@ -394,7 +401,7 @@ def to_lines(self): A list of lines each defined by a pair of point coordinates. """ - return [self.edge_coordinates(u, v) for u, v in self.edges()] + return [self.edge_coordinates(edge) for edge in self.edges()] @classmethod def from_polylines(cls, boundary_polylines, other_polylines): @@ -517,11 +524,11 @@ def to_vertices_and_faces(self, triangulated=False): The faces as a list of lists of vertex indices. """ - key_index = self.key_index() - vertices = [self.vertex_coordinates(key) for key in self.vertices()] + vertex_index = self.vertex_index() + vertices = [self.vertex_coordinates(vertex) for vertex in self.vertices()] if not triangulated: - faces = [[key_index[key] for key in self.face_vertices(fkey)] for fkey in self.faces()] + faces = [[vertex_index[vertex] for vertex in self.face_vertices(face)] for face in self.faces()] return vertices, faces faces = [] @@ -531,18 +538,18 @@ def to_vertices_and_faces(self, triangulated=False): if len(face_vertices) == 3: a, b, c = face_vertices - faces.append([key_index[a], key_index[b], key_index[c]]) + faces.append([vertex_index[a], vertex_index[b], vertex_index[c]]) elif len(face_vertices) == 4: a, b, c, d = face_vertices - faces.append([key_index[a], key_index[b], key_index[c]]) - faces.append([key_index[a], key_index[c], key_index[d]]) + faces.append([vertex_index[a], vertex_index[b], vertex_index[c]]) + faces.append([vertex_index[a], vertex_index[c], vertex_index[d]]) else: - centroid = centroid_polygon([vertices[key_index[key]] for key in face_vertices]) - ckey = len(vertices) + centroid = centroid_polygon([vertices[vertex_index[vertex]] for vertex in face_vertices]) + c = len(vertices) vertices.append(centroid) for a, b in pairwise(face_vertices + face_vertices[:1]): - faces.append([key_index[a], key_index[b], ckey]) + faces.append([vertex_index[a], vertex_index[b], c]) return vertices, faces @@ -955,6 +962,53 @@ def vertex_coordinates(self, key, axes="xyz"): """ return self.vertex_attributes(key, axes) + def vertex_point(self, key): + """Return the point of a vertex. + + Parameters + ---------- + key : int + The identifier of the vertex. + + Returns + ------- + :class:`compas.geometry.Point` + The point of the vertex. + """ + return Point(*self.vertex_coordinates(key)) # type: ignore + + def vertices_points(self, vertices): + """Return the points of multiple vertices. + + Parameters + ---------- + vertices : list[int] + The identifiers of the vertices. + + Returns + ------- + list[:class:`compas.geometry.Point`] + The points of the vertices. + """ + return [self.vertex_point(vertex) for vertex in vertices] + + def set_vertex_point(self, vertex, point): + """Set the point of a vertex. + + Parameters + ---------- + vertex : int + The identifier of the vertex. + point : :class:`compas.geometry.Point` + The point to set. + + Returns + ------- + None + + """ + self.vertex_attributes(vertex, "xyz", point) + def vertex_area(self, key): """Compute the tributary area of a vertex. @@ -1001,13 +1055,13 @@ def vertex_laplacian(self, key): Returns ------- - list[float] - The components of the vector. + :class:`compas.geometry.Vector` + The Laplacian vector. """ c = self.vertex_neighborhood_centroid(key) p = self.vertex_coordinates(key) - return subtract_vectors(c, p) + return Vector(*subtract_vectors(c, p)) def vertex_neighborhood_centroid(self, key): """Compute the centroid of the neighbors of a vertex. @@ -1019,11 +1073,11 @@ def vertex_neighborhood_centroid(self, key): Returns ------- - list[float] - The coordinates of the centroid. + :class:`compas.geometry.Point` + The centroid of the vertex neighbors. """ - return centroid_points([self.vertex_coordinates(nbr) for nbr in self.vertex_neighbors(key)]) + return Point(*centroid_points([self.vertex_coordinates(nbr) for nbr in self.vertex_neighbors(key)])) def vertex_normal(self, key): """Return the normal vector at the vertex as the weighted average of the @@ -1036,12 +1090,12 @@ def vertex_normal(self, key): Returns ------- - list[float] - The components of the normal vector. + :class:`compas.geometry.Vector` + The normal vector. """ vectors = [self.face_normal(fkey, False) for fkey in self.vertex_faces(key) if fkey is not None] - return normalize_vector(centroid_points(vectors)) + return Vector(*normalize_vector(centroid_points(vectors))) def vertex_curvature(self, vkey): """Dimensionless vertex curvature. @@ -1076,37 +1130,64 @@ def vertex_curvature(self, vkey): # edge geometry # -------------------------------------------------------------------------- - def edge_coordinates(self, u, v, axes="xyz"): + def edge_coordinates(self, edge, axes="xyz"): """Return the coordinates of the start and end point of an edge. Parameters ---------- - u : int - The key of the start vertex. - v : int - The key of the end vertex. + edge : tuple(int, int) + The identifier of the edge. axes : str, optional The axes along which the coordinates should be included. Returns ------- - list[float] + tuple(point, point) The coordinates of the start point. - list[float] The coordinates of the end point. """ - return self.vertex_coordinates(u, axes=axes), self.vertex_coordinates(v, axes=axes) + return self.vertex_coordinates(edge[0], axes=axes), self.vertex_coordinates(edge[1], axes=axes) + + def edge_start(self, edge): + """Return the point at the start of an edge. + + Parameters + ---------- + edge : tuple(int, int) + The identifier of the edge. + + Returns + ------- + :class:`compas.geometry.Point` + The point at the start. + + """ + return self.vertex_point(edge[0]) + + def edge_end(self, edge): + """Return the point at the end of an edge. - def edge_length(self, u, v): + Parameters + ---------- + edge : tuple(int, int) + The identifier of the edge. + + Returns + ------- + :class:`compas.geometry.Point` + The point at the end. + + """ + return self.vertex_point(edge[1]) + + def edge_length(self, edge): """Return the length of an edge. Parameters ---------- - u : int - The key of the start vertex. - v : int - The key of the end vertex. + edge : tuple(int, int) + The identifier of the edge. Returns ------- @@ -1114,38 +1195,33 @@ def edge_length(self, u, v): The length of the edge. """ - a, b = self.edge_coordinates(u, v) + a, b = self.edge_coordinates(edge) return distance_point_point(a, b) - def edge_vector(self, u, v): + def edge_vector(self, edge): """Return the vector of an edge. Parameters ---------- - u : int - The key of the start vertex. - v : int - The key of the end vertex. + edge : tuple(int, int) + The identifier of the edge. Returns ------- - list[float] - The vector from u to v. + :class:`compas.geometry.Vector` """ - a, b = self.edge_coordinates(u, v) + a, b = self.edge_coordinates(edge) ab = subtract_vectors(b, a) - return ab + return Vector(*ab) - def edge_point(self, u, v, t=0.5): - """Return the location of a point along an edge. + def edge_point(self, edge, t=0.5): + """Return a point along an edge. Parameters ---------- - u : int - The key of the start vertex. - v : int - The key of the end vertex. + edge : tuple(int, int) + The identifier of the edge. t : float, optional The location of the point on the edge. If the value of `t` is outside the range 0-1, the point will @@ -1153,23 +1229,21 @@ def edge_point(self, u, v, t=0.5): Returns ------- - list[float] - The XYZ coordinates of the point. + :class:`compas.geometry.Point` + The point at parameter ``t``. """ - a, b = self.edge_coordinates(u, v) + a, b = self.edge_coordinates(edge) ab = subtract_vectors(b, a) - return add_vectors(a, scale_vector(ab, t)) + return Point(*add_vectors(a, scale_vector(ab, t))) - def edge_midpoint(self, u, v): - """Return the location of the midpoint of an edge. + def edge_midpoint(self, edge): + """Return the midpoint of an edge. Parameters ---------- - u : int - The key of the start vertex. - v : int - The key of the end vertex. + edge : tuple(int, int) + The identifier of the edge. Returns ------- @@ -1177,26 +1251,42 @@ def edge_midpoint(self, u, v): The XYZ coordinates of the midpoint. """ - a, b = self.edge_coordinates(u, v) - return midpoint_line((a, b)) + a, b = self.edge_coordinates(edge) + return Point(*midpoint_line((a, b))) - def edge_direction(self, u, v): + def edge_direction(self, edge): """Return the direction vector of an edge. Parameters ---------- - u : int - The key of the start vertex. - v : int - The key of the end vertex. + edge : tuple(int, int) + The identifier of the edge. Returns ------- - list[float] + :class:`compas.geometry.Vector` The direction vector of the edge. """ - return normalize_vector(self.edge_vector(u, v)) + vector = self.edge_vector(edge) + vector.unitize() + return vector + + def edge_line(self, edge): + """Return the line of an edge. + + Parameters + ---------- + edge : tuple(int, int) + The identifier of the edge. + + Returns + ------- + :class:`compas.geometry.Line` + The line of the edge. + + """ + return Line(*self.edge_coordinates(edge)) # -------------------------------------------------------------------------- # face geometry @@ -1221,6 +1311,22 @@ def face_coordinates(self, fkey, axes="xyz"): """ return [self.vertex_coordinates(key, axes=axes) for key in self.face_vertices(fkey)] + def face_points(self, fkey): + """Compute the points of the vertices of a face. + + Parameters + ---------- + fkey : int + The identifier of the face. + + Returns + ------- + list[:class:`compas.geometry.Point`] + The points of the vertices of the face. + + """ + return [self.vertex_point(key) for key in self.face_vertices(fkey)] + def face_normal(self, fkey, unitized=True): """Compute the normal of a face. @@ -1233,14 +1339,13 @@ def face_normal(self, fkey, unitized=True): Returns ------- - list[float] - The components of the normal vector. + :class:`compas.geometry.Vector` """ - return normal_polygon(self.face_coordinates(fkey), unitized=unitized) + return Vector(*normal_polygon(self.face_coordinates(fkey), unitized=unitized)) def face_centroid(self, fkey): - """Compute the location of the centroid of a face. + """Compute the point at the centroid of a face. Parameters ---------- @@ -1249,14 +1354,14 @@ def face_centroid(self, fkey): Returns ------- - list[float] - The coordinates of the centroid. + :class:`compas.geometry.Point` + The point at the centroid. """ - return centroid_points(self.face_coordinates(fkey)) + return Point(*centroid_points(self.face_coordinates(fkey))) def face_center(self, fkey): - """Compute the location of the center of mass of a face. + """Compute the point at the center of mass of a face. Parameters ---------- @@ -1265,11 +1370,11 @@ def face_center(self, fkey): Returns ------- - list[float] - The coordinates of the center of mass. + :class:`compas.geometry.Point` + The point at the center of mass. """ - return centroid_polygon(self.face_coordinates(fkey)) + return Point(*centroid_polygon(self.face_coordinates(fkey))) # type: ignore def face_area(self, fkey): """Compute the area of a face. @@ -1339,7 +1444,7 @@ def face_aspect_ratio(self, fkey): * Wikipedia. *Types of mesh*. Available at: https://en.wikipedia.org/wiki/Types_of_mesh. """ - face_edge_lengths = [self.edge_length(u, v) for u, v in self.face_halfedges(fkey)] + face_edge_lengths = [self.edge_length(edge) for edge in self.face_halfedges(fkey)] return max(face_edge_lengths) / min(face_edge_lengths) def face_skewness(self, fkey): @@ -1410,13 +1515,65 @@ def face_plane(self, face): Returns ------- - list[float] - The base point of the plane. - list[float] - The normal vector of the plane. + :class:`compas.geometry.Plane` + The plane of the face. """ - return self.face_centroid(face), self.face_normal(face) + return Plane(self.face_centroid(face), self.face_normal(face)) + + def face_polygon(self, face): + """The polygon of a face. + + Parameters + ---------- + face : int + The face identifier. + + Returns + ------- + :class:`compas.geometry.Polygon` + The polygon of the face. + + """ + return Polygon(self.face_coordinates(face)) + + def face_circle(self, face): + """The circle of a face. + + Parameters + ---------- + face : int + The face identifier. + + Returns + ------- + :class:`compas.geometry.Circle` + The circle of the face. + + """ + from compas.geometry import bestfit_circle_numpy + + point, normal, radius = bestfit_circle_numpy(self.face_coordinates(face)) + return Circle((point, normal), radius) + + def face_frame(self, face): + """The frame of a face. + + Parameters + ---------- + face : int + The face identifier. + + Returns + ------- + :class:`compas.geometry.Frame` + The frame of the face. + + """ + from compas.geometry import bestfit_frame_numpy + + point, xaxis, yaxis = bestfit_frame_numpy(self.face_coordinates(face)) + return Frame(point, xaxis, yaxis) # -------------------------------------------------------------------------- # boundary @@ -1490,7 +1647,7 @@ def vertices_on_boundaries(self): for key in vertices_all: count = 0 for nbr in self.vertex_neighbors(key): - face = self.halfedge_face(key, nbr) + face = self.halfedge_face((key, nbr)) if face is None: count += 1 if count > 1: @@ -1506,7 +1663,7 @@ def vertices_on_boundaries(self): # find all neighbors of the current spacial vertex # that are on the mesh boundary for nbr in self.vertex_neighbors(start): - face = self.halfedge_face(start, nbr) + face = self.halfedge_face((start, nbr)) if face is None: nbrs.append(nbr) # for normal mesh vertices @@ -1524,7 +1681,7 @@ def vertices_on_boundaries(self): for nbr in self.vertex_neighbors(vertex): if nbr == vertices[-2]: continue - face = self.halfedge_face(vertex, nbr) + face = self.halfedge_face((vertex, nbr)) if face is None: vertices.append(nbr) vertex = nbr @@ -1546,7 +1703,7 @@ def vertices_on_boundaries(self): start = key while True: for nbr in self.vertex_neighbors(key): - face = self.halfedge_face(key, nbr) + face = self.halfedge_face((key, nbr)) if face is None: vertices.append(nbr) key = nbr @@ -1588,7 +1745,7 @@ def faces_on_boundaries(self): vertexgroups = self.vertices_on_boundaries() facegroups = [] for vertices in vertexgroups: - temp = [self.halfedge_face(v, u) for u, v in pairwise(vertices)] + temp = [self.halfedge_face((v, u)) for u, v in pairwise(vertices)] faces = [] for face in temp: if face is None: diff --git a/src/compas/datastructures/mesh/offset.py b/src/compas/datastructures/mesh/offset.py index 3b1ba93562d..e06f5979efa 100644 --- a/src/compas/datastructures/mesh/offset.py +++ b/src/compas/datastructures/mesh/offset.py @@ -8,8 +8,6 @@ from .orientation import mesh_flip_cycles from .join import meshes_join -__all__ = ["mesh_offset", "mesh_thicken"] - def mesh_offset(mesh, distance=1.0): """Offset a mesh. diff --git a/src/compas/datastructures/mesh/operations/__init__.py b/src/compas/datastructures/mesh/operations/__init__.py index 85c06d7a76b..e69de29bb2d 100644 --- a/src/compas/datastructures/mesh/operations/__init__.py +++ b/src/compas/datastructures/mesh/operations/__init__.py @@ -1,14 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from .collapse import * # noqa: F401 F403 -from .insert import * # noqa: F401 F403 -from .merge import * # noqa: F401 F403 -from .split import * # noqa: F401 F403 -from .substitute import * # noqa: F401 F403 -from .swap import * # noqa: F401 F403 -from .weld import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/datastructures/mesh/operations/collapse.py b/src/compas/datastructures/mesh/operations/collapse.py index bd3aa966129..3202f4117ae 100644 --- a/src/compas/datastructures/mesh/operations/collapse.py +++ b/src/compas/datastructures/mesh/operations/collapse.py @@ -3,23 +3,15 @@ from __future__ import division -__all__ = [ - "mesh_collapse_edge", - "trimesh_collapse_edge", -] - - -def is_collapse_legal(mesh, u, v, allow_boundary=False): +def is_collapse_legal(mesh, edge, allow_boundary=False): """Verify if the requested collapse is legal for a triangle mesh. Parameters ---------- mesh : :class:`~compas.datastructures.Mesh` The mesh. - u : str - The vertex to collapse towards. - v : str - The vertex to collapse. + edge : tuple[int, int] + The identifier of the edge. allow_boundary : bool, optional If True, collapse is allowed even if `u` and/or `v` is on the boundary. @@ -30,6 +22,8 @@ def is_collapse_legal(mesh, u, v, allow_boundary=False): False otherwise. """ + u, v = edge + u_on = mesh.is_vertex_on_boundary(u) v_on = mesh.is_vertex_on_boundary(v) @@ -77,22 +71,20 @@ def is_collapse_legal(mesh, u, v, allow_boundary=False): return True -def mesh_collapse_edge(mesh, u, v, t=0.5, allow_boundary=False, fixed=None): +def mesh_collapse_edge(mesh, edge, t=0.5, allow_boundary=False, fixed=None): """Collapse an edge to its first or second vertex, or to an intermediate point. Parameters ---------- mesh : :class:`~compas.datastructures.Mesh` Instance of a mesh. - u : str - The first vertex of the (half-) edge. - v : str - The second vertex of the (half-) edge. + edge : tuple[int, int] + The identifier of the edge. t : float, optional Determines where to collapse to. - If ``t == 0.0`` collapse to `u`. - If ``t == 1.0`` collapse to `v`. - If ``0.0 < t < 1.0``, collapse to a point between `u` and `v`. + If ``t == 0.0`` collapse to start of the edge. + If ``t == 1.0`` collapse to end of the edge. + If ``0.0 < t < 1.0``, collapse to a point between start and end of the edge. allow_boundary : bool, optional If True, allow collapses involving boundary vertices. fixed : list[int], optional @@ -105,16 +97,18 @@ def mesh_collapse_edge(mesh, u, v, t=0.5, allow_boundary=False, fixed=None): Raises ------ ValueError - If `u` and `v` are not neighbors. + If the edge is not part of the mesh. """ + u, v = edge + if t < 0.0: raise ValueError("Parameter t should be greater than or equal to 0.") if t > 1.0: raise ValueError("Parameter t should be smaller than or equal to 1.") # check collapse conditions - if not is_collapse_legal(mesh, u, v, allow_boundary=allow_boundary): + if not is_collapse_legal(mesh, edge, allow_boundary=allow_boundary): return False # compare to fixed @@ -123,7 +117,7 @@ def mesh_collapse_edge(mesh, u, v, t=0.5, allow_boundary=False, fixed=None): return False # move U - x, y, z = mesh.edge_point(u, v, t) + x, y, z = mesh.edge_point(edge, t) mesh.vertex[u]["x"] = x mesh.vertex[u]["y"] = y mesh.vertex[u]["z"] = z @@ -188,7 +182,6 @@ def mesh_collapse_edge(mesh, u, v, t=0.5, allow_boundary=False, fixed=None): # V neighbors and halfedges coming into V for nbr, fkey in list(mesh.halfedge[v].items()): - if fkey is None: mesh.halfedge[u][nbr] = None del mesh.halfedge[v][nbr] @@ -224,22 +217,20 @@ def mesh_collapse_edge(mesh, u, v, t=0.5, allow_boundary=False, fixed=None): # - u and v on boundary -def trimesh_collapse_edge(mesh, u, v, t=0.5, allow_boundary=False, fixed=None): +def trimesh_collapse_edge(mesh, edge, t=0.5, allow_boundary=False, fixed=None): """Collapse an edge to its first or second vertex, or to an intermediate point. Parameters ---------- mesh : :class:`~compas.datastructures.Mesh` Instance of a mesh. - u : str - The first vertex of the (half-) edge. - v : str - The second vertex of the (half-) edge. + edge : tuple[int, int] + The identifier of the edge. t : float, optional Determines where to collapse to. - If ``t == 0.0`` collapse to `u`. - If ``t == 1.0`` collapse to `v`. - If ``0.0 < t < 1.0``, collapse to a point between `u` and `v`. + If ``t == 0.0`` collapse to the start of the edge. + If ``t == 1.0`` collapse to the end of the edge. + If ``0.0 < t < 1.0``, collapse to a point between start and end. allow_boundary : bool, optional If True, allow collapses involving vertices on the boundary. fixed : list, optional @@ -252,31 +243,18 @@ def trimesh_collapse_edge(mesh, u, v, t=0.5, allow_boundary=False, fixed=None): Raises ------ ValueError - If `u` and `v` are not neighbors. - - Notes - ----- - An edge can only be collapsed if the collapse is `legal`. A collapse is - legal if it meets the following requirements: - - * any vertex `w` that is a neighbor of both `u` and `v` is a face of the mesh - * `u` and `v` are not on the boundary - * ... - - See [1]_ for a detailed explanation of these requirements. - - References - ---------- - .. [1] ... + If the edge is not part of the mesh. """ + u, v = edge + if t < 0.0: raise ValueError("Parameter t should be greater than or equal to 0.") if t > 1.0: raise ValueError("Parameter t should be smaller than or equal to 1.") # check collapse conditions - if not is_collapse_legal(mesh, u, v, allow_boundary=allow_boundary): + if not is_collapse_legal(mesh, edge, allow_boundary=allow_boundary): return False if mesh.is_vertex_on_boundary(u): @@ -288,7 +266,7 @@ def trimesh_collapse_edge(mesh, u, v, t=0.5, allow_boundary=False, fixed=None): return False # move U - x, y, z = mesh.edge_point(u, v, t) + x, y, z = mesh.edge_point(edge, t) mesh.vertex[u]["x"] = x mesh.vertex[u]["y"] = y @@ -336,7 +314,6 @@ def trimesh_collapse_edge(mesh, u, v, t=0.5, allow_boundary=False, fixed=None): # neighborhood of V for nbr, fkey in list(mesh.halfedge[v].items()): - if fkey is None: mesh.halfedge[u][nbr] = None del mesh.halfedge[v][nbr] diff --git a/src/compas/datastructures/mesh/operations/insert.py b/src/compas/datastructures/mesh/operations/insert.py index d1d03ee5805..5faa6586b8a 100644 --- a/src/compas/datastructures/mesh/operations/insert.py +++ b/src/compas/datastructures/mesh/operations/insert.py @@ -3,9 +3,6 @@ from __future__ import division -__all__ = ["mesh_add_vertex_to_face_edge", "mesh_insert_vertex_on_edge"] - - def mesh_add_vertex_to_face_edge(mesh, key, fkey, v): """Add an existing vertex of the mesh to an existing face. @@ -70,7 +67,7 @@ def mesh_add_vertex_to_face_edge(mesh, key, fkey, v): del mesh.edgedata[v, u] -def mesh_insert_vertex_on_edge(mesh, u, v, vkey=None): +def mesh_insert_vertex_on_edge(mesh, edge, vkey=None): """Insert a vertex in the faces adjacent to an edge, between the two edge vertices. If no vertex key is specified or if the key does not exist yet, a vertex is added and located at the edge midpoint. @@ -78,10 +75,8 @@ def mesh_insert_vertex_on_edge(mesh, u, v, vkey=None): Parameters ---------- - u: int - The first edge vertex. - v: int - The second edge vertex. + edge : tuple[int, int] + The edge identifier. vkey: int, optional The vertex key to insert. Default is to auto-generate a new vertex identifier. @@ -97,24 +92,25 @@ def mesh_insert_vertex_on_edge(mesh, u, v, vkey=None): face_1 = [a, b, c] and face_2 = [b, a, d] applying - mesh_insert_vertex_on_edge(mesh, a, b, e) + mesh_insert_vertex_on_edge(mesh, (a, b), e) yields the two new faces face_1 = [a, e, b, c] and face_2 = [b, e, a, d]. """ + u, v = edge # add new vertex if there is none or if vkey not in vertices if vkey is None: - vkey = mesh.add_vertex(attr_dict={attr: xyz for attr, xyz in zip(["x", "y", "z"], mesh.edge_midpoint(u, v))}) + vkey = mesh.add_vertex(attr_dict={attr: xyz for attr, xyz in zip(["x", "y", "z"], mesh.edge_midpoint(edge))}) elif vkey not in list(mesh.vertices()): vkey = mesh.add_vertex( key=vkey, - attr_dict={attr: xyz for attr, xyz in zip(["x", "y", "z"], mesh.edge_midpoint(u, v))}, + attr_dict={attr: xyz for attr, xyz in zip(["x", "y", "z"], mesh.edge_midpoint(edge))}, ) # insert vertex - for fkey, halfedge in zip(mesh.edge_faces(u, v), [(u, v), (v, u)]): + for fkey, halfedge in zip(mesh.edge_faces(edge), [(u, v), (v, u)]): if fkey is not None: face_vertices = mesh.face_vertices(fkey)[:] face_vertices.insert(face_vertices.index(halfedge[-1]), vkey) diff --git a/src/compas/datastructures/mesh/operations/merge.py b/src/compas/datastructures/mesh/operations/merge.py index bd811aa7b32..67dcc549704 100644 --- a/src/compas/datastructures/mesh/operations/merge.py +++ b/src/compas/datastructures/mesh/operations/merge.py @@ -3,9 +3,6 @@ from __future__ import division -__all__ = ["mesh_merge_faces"] - - def mesh_merge_faces(mesh, faces): """Merge two faces of a mesh over their shared edge. @@ -64,11 +61,11 @@ def mesh_merge_faces(mesh, faces): key = mesh.add_face(vertices) # remove internal edges remove = [] - for u, v in mesh.face_halfedges(key): - f1, f2 = mesh.edge_faces(u, v) + for edge in mesh.face_halfedges(key): + f1, f2 = mesh.edge_faces(edge) if f1 == f2: # an internal edge has the same face on both sides - remove.append((u, v)) + remove.append(edge) for u, v in remove: if u in mesh.halfedge and v in mesh.halfedge[u]: del mesh.halfedge[u][v] diff --git a/src/compas/datastructures/mesh/operations/split.py b/src/compas/datastructures/mesh/operations/split.py index 56a380271f3..58ed640c1fc 100644 --- a/src/compas/datastructures/mesh/operations/split.py +++ b/src/compas/datastructures/mesh/operations/split.py @@ -5,25 +5,15 @@ from compas.utilities import pairwise -__all__ = [ - "mesh_split_edge", - "mesh_split_face", - "mesh_split_strip", - "trimesh_split_edge", -] - - -def mesh_split_edge(mesh, u, v, t=0.5, allow_boundary=False): +def mesh_split_edge(mesh, edge, t=0.5, allow_boundary=False): """Split and edge by inserting a vertex along its length. Parameters ---------- mesh : :class:`~compas.datastructures.Mesh` Instance of a mesh. - u : int - The key of the first vertex of the edge. - v : int - The key of the second vertex of the edge. + edge : tuple[int, int] + The identifier of the edge to split. t : float, optional The position of the inserted vertex. The value should be between 0.0 and 1.0 @@ -41,10 +31,17 @@ def mesh_split_edge(mesh, u, v, t=0.5, allow_boundary=False): If u and v are not neighbors. """ - if t <= 0.0: - raise ValueError("t should be greater than 0.0.") - if t >= 1.0: - raise ValueError("t should be smaller than 1.0.") + u, v = edge + + if t < 0.0: + raise ValueError("t should be greater than or equal to 0.0.") + if t > 1.0: + raise ValueError("t should be smaller than or equal to 1.0.") + + if t == 0: + return u + if t == 1: + return v # check if the split is legal # don't split if edge is on boundary @@ -56,7 +53,7 @@ def mesh_split_edge(mesh, u, v, t=0.5, allow_boundary=False): return # coordinates - x, y, z = mesh.edge_point(u, v, t) + x, y, z = mesh.edge_point(edge, t) # the split vertex w = mesh.add_vertex(x=x, y=y, z=z) @@ -84,17 +81,15 @@ def mesh_split_edge(mesh, u, v, t=0.5, allow_boundary=False): return w -def trimesh_split_edge(mesh, u, v, t=0.5, allow_boundary=False): +def trimesh_split_edge(mesh, edge, t=0.5, allow_boundary=False): """Split an edge of a triangle mesh. Parameters ---------- mesh : :class:`~compas.datastructures.Mesh` Instance of a mesh. - u : int - Identifier of the first vertex. - v : int - Identifier of the second vertex. + edge : tuple[int, int] + The identifier of the edge to split. t : float, optional The location of the split point along the original edge. The value should be between 0.0 and 1.0 @@ -111,6 +106,8 @@ def trimesh_split_edge(mesh, u, v, t=0.5, allow_boundary=False): This operation only works as expected for triangle meshes. """ + u, v = edge + if t <= 0.0: raise ValueError("t should be greater than 0.0.") if t >= 1.0: @@ -126,7 +123,7 @@ def trimesh_split_edge(mesh, u, v, t=0.5, allow_boundary=False): return # coordinates - x, y, z = mesh.edge_point(u, v, t) + x, y, z = mesh.edge_point(edge, t) # the split vertex w = mesh.add_vertex(x=x, y=y, z=z) @@ -250,15 +247,15 @@ def mesh_split_strip(mesh, edge): ngons = [] splits = [] - for u, v in strip[:-1]: - ngons.append(mesh.halfedge_face(u, v)) - splits.append(mesh.split_edge(u, v, t=0.5, allow_boundary=True)) + for edge in strip[:-1]: + ngons.append(mesh.halfedge_face(edge)) + splits.append(mesh.split_edge(edge, t=0.5, allow_boundary=True)) if is_closed: splits.append(splits[0]) else: - u, v = strip[-1] - splits.append(mesh.split_edge(u, v, t=0.5, allow_boundary=True)) + edge = strip[-1] + splits.append(mesh.split_edge(edge, t=0.5, allow_boundary=True)) for (u, v), ngon in zip(pairwise(splits), ngons): mesh.split_face(ngon, u, v) diff --git a/src/compas/datastructures/mesh/operations/substitute.py b/src/compas/datastructures/mesh/operations/substitute.py index 850e3c9ec89..5c351f9fc3b 100644 --- a/src/compas/datastructures/mesh/operations/substitute.py +++ b/src/compas/datastructures/mesh/operations/substitute.py @@ -2,8 +2,6 @@ from __future__ import absolute_import from __future__ import division -__all__ = ["mesh_substitute_vertex_in_faces"] - def mesh_substitute_vertex_in_faces(mesh, old_vkey, new_vkey, fkeys=None): """Substitute in a mesh a vertex by another one. diff --git a/src/compas/datastructures/mesh/operations/swap.py b/src/compas/datastructures/mesh/operations/swap.py index a786806e018..52c9fd74e75 100644 --- a/src/compas/datastructures/mesh/operations/swap.py +++ b/src/compas/datastructures/mesh/operations/swap.py @@ -3,10 +3,7 @@ from __future__ import division -__all__ = ["trimesh_swap_edge"] - - -def trimesh_swap_edge(mesh, u, v, allow_boundary=True): +def trimesh_swap_edge(mesh, edge, allow_boundary=True): """Replace an edge of the mesh by an edge connecting the opposite vertices of the adjacent faces. @@ -14,16 +11,15 @@ def trimesh_swap_edge(mesh, u, v, allow_boundary=True): ---------- mesh : :class:`~compas.datastructures.Mesh` Instance of mesh. - u : int - The key of one of the vertices of the edge. - v : int - The key of the other vertex of the edge. + edge : tuple[int, int] + The identifier of the edge to swap. Returns ------- None """ + u, v = edge # check legality of the swap # swapping on the boundary is not allowed diff --git a/src/compas/datastructures/mesh/operations/weld.py b/src/compas/datastructures/mesh/operations/weld.py index 28d915164f6..02aff67eb46 100644 --- a/src/compas/datastructures/mesh/operations/weld.py +++ b/src/compas/datastructures/mesh/operations/weld.py @@ -10,9 +10,6 @@ from .substitute import mesh_substitute_vertex_in_faces -__all__ = ["mesh_unweld_vertices", "mesh_unweld_edges"] - - def mesh_unweld_vertices(mesh, fkey, where=None): """Unweld a face of the mesh. @@ -73,7 +70,6 @@ def mesh_unweld_edges(mesh, edges): vertex_changes = {} for vkey in vertices: - # maps between old mesh face index and new network vertex index old_to_new = {nbr: i for i, nbr in enumerate(mesh.vertex_faces(vkey))} new_to_old = {i: nbr for i, nbr in enumerate(mesh.vertex_faces(vkey))} @@ -82,7 +78,7 @@ def mesh_unweld_edges(mesh, edges): # through the edges to unweld network_edges = [] for nbr in mesh.vertex_neighbors(vkey): - if not mesh.is_edge_on_boundary(vkey, nbr) and (vkey, nbr) not in edges and (nbr, vkey) not in edges: + if not mesh.is_edge_on_boundary((vkey, nbr)) and (vkey, nbr) not in edges and (nbr, vkey) not in edges: network_edges.append( ( old_to_new[mesh.halfedge[vkey][nbr]], diff --git a/src/compas/datastructures/mesh/orientation.py b/src/compas/datastructures/mesh/orientation.py index 87d514cd75a..802a717f671 100644 --- a/src/compas/datastructures/mesh/orientation.py +++ b/src/compas/datastructures/mesh/orientation.py @@ -5,13 +5,6 @@ from compas.topology import breadth_first_traverse -__all__ = [ - "mesh_face_adjacency", - "mesh_unify_cycles", - "mesh_flip_cycles", -] - - def _mesh_face_adjacency(mesh, nmax=10, radius=10.0): fkey_index = {fkey: index for index, fkey in enumerate(mesh.faces())} index_fkey = {index: fkey for index, fkey in enumerate(mesh.faces())} @@ -193,7 +186,7 @@ def unify(node, nbr): return if root is None: - root = mesh.get_any_face() + root = mesh.face_sample(size=1)[0] adj = mesh_face_adjacency(mesh) diff --git a/src/compas/datastructures/mesh/planarisation.py b/src/compas/datastructures/mesh/planarisation.py index 53810dd95e7..9cda441f14e 100644 --- a/src/compas/datastructures/mesh/planarisation.py +++ b/src/compas/datastructures/mesh/planarisation.py @@ -13,12 +13,6 @@ from compas.utilities import pairwise -__all__ = [ - "mesh_flatness", - "mesh_planarize_faces", -] - - def mesh_flatness(mesh, maxdev=1.0): """Compute mesh flatness per face. diff --git a/src/compas/datastructures/mesh/pull_numpy.py b/src/compas/datastructures/mesh/pull_numpy.py index 894ed7b0603..fb0ccb07baf 100644 --- a/src/compas/datastructures/mesh/pull_numpy.py +++ b/src/compas/datastructures/mesh/pull_numpy.py @@ -18,9 +18,6 @@ from compas.geometry import is_point_in_triangle -__all__ = ["trimesh_pull_points_numpy"] - - def trimesh_pull_points_numpy(mesh, points): """Pull points onto a mesh by computing the closest point on the mesh for each of the points. @@ -83,11 +80,7 @@ def _compute_point_on_segment(p, p0, p1): r = (b * (b * p[0] - a * p[1]) - a * c) / (a**2 + b**2) s = (a * (-b * p[0] + a * p[1]) - b * c) / (a**2 + b**2) t = 0 - return array( - [ - [r, s, t], - ] - ) + return array([[r, s, t]]) def _triangle_xform(triangle): diff --git a/src/compas/datastructures/mesh/remesh.py b/src/compas/datastructures/mesh/remesh.py index 583d26cd584..9141a338326 100644 --- a/src/compas/datastructures/mesh/remesh.py +++ b/src/compas/datastructures/mesh/remesh.py @@ -3,14 +3,9 @@ from __future__ import division from .smoothing import mesh_smooth_area -from .operations import trimesh_collapse_edge -from .operations import trimesh_swap_edge -from .operations import trimesh_split_edge - - -__all__ = [ - "trimesh_remesh", -] +from .operations.collapse import trimesh_collapse_edge +from .operations.swap import trimesh_swap_edge +from .operations.split import trimesh_split_edge def trimesh_remesh( @@ -93,7 +88,7 @@ def trimesh_remesh( lmin = (1 - tol) * (4.0 / 5.0) * target lmax = (1 + tol) * (4.0 / 3.0) * target - edge_lengths = [mesh.edge_length(u, v) for u, v in mesh.edges()] + edge_lengths = [mesh.edge_length(edge) for edge in mesh.edges()] target_start = max(edge_lengths) / 2.0 fac = target_start / target @@ -108,7 +103,6 @@ def trimesh_remesh( kmax_start = kmax / 2.0 for k in range(kmax): - if k <= kmax_start: scale = fac * (1.0 - k / kmax_start) dlmin = lmin * scale @@ -135,13 +129,13 @@ def trimesh_remesh( if u in visited or v in visited: continue - if mesh.edge_length(u, v) <= lmax + dlmax: + if mesh.edge_length((u, v)) <= lmax + dlmax: continue if verbose: print("split edge: {0} - {1}".format(u, v)) - trimesh_split_edge(mesh, u, v, allow_boundary=allow_boundary_split) + trimesh_split_edge(mesh, (u, v), allow_boundary=allow_boundary_split) visited.add(u) visited.add(v) @@ -156,12 +150,12 @@ def trimesh_remesh( if u in visited or v in visited: continue - if mesh.edge_length(u, v) >= lmin - dlmin: + if mesh.edge_length((u, v)) >= lmin - dlmin: continue if verbose: print("collapse edge: {0} - {1}".format(u, v)) - trimesh_collapse_edge(mesh, u, v, allow_boundary=allow_boundary_collapse, fixed=fixed) + trimesh_collapse_edge(mesh, (u, v), allow_boundary=allow_boundary_collapse, fixed=fixed) visited.add(u) visited.add(v) @@ -214,7 +208,7 @@ def trimesh_remesh( if verbose: print("swap edge: {0} - {1}".format(u, v)) - trimesh_swap_edge(mesh, u, v, allow_boundary=allow_boundary_swap) + trimesh_swap_edge(mesh, (u, v), allow_boundary=allow_boundary_swap) visited.add(u) visited.add(v) diff --git a/src/compas/datastructures/mesh/slice.py b/src/compas/datastructures/mesh/slice.py index d7b6d510063..25b3f0f2a45 100644 --- a/src/compas/datastructures/mesh/slice.py +++ b/src/compas/datastructures/mesh/slice.py @@ -4,9 +4,6 @@ from compas.geometry import dot_vectors -__all__ = ["mesh_slice_plane"] - - def mesh_slice_plane(mesh, plane): """Slice a mesh with a plane and construct the resulting submeshes. @@ -151,7 +148,7 @@ def intersect(self): L_ax = length_vector(subtract_vectors(x, a)) L_ab = length_vector(subtract_vectors(b, a)) t = L_ax / L_ab - key = self.mesh.split_edge(u, v, t=t, allow_boundary=True) + key = self.mesh.split_edge((u, v), t=t, allow_boundary=True) intersections.append(key) else: if u in vertex_intersections: diff --git a/src/compas/datastructures/mesh/smoothing.py b/src/compas/datastructures/mesh/smoothing.py index fbcd4163086..c8098937cd6 100644 --- a/src/compas/datastructures/mesh/smoothing.py +++ b/src/compas/datastructures/mesh/smoothing.py @@ -6,13 +6,6 @@ from compas.geometry import centroid_polygon -__all__ = [ - "mesh_smooth_centroid", - "mesh_smooth_centerofmass", - "mesh_smooth_area", -] - - def mesh_smooth_centroid(mesh, fixed=None, kmax=100, damping=0.5, callback=None, callback_args=None): """Smooth a mesh by moving every free vertex to the centroid of its neighbors. diff --git a/src/compas/datastructures/mesh/smoothing_numpy.py b/src/compas/datastructures/mesh/smoothing_numpy.py index bd842bd203f..d03d2512e47 100644 --- a/src/compas/datastructures/mesh/smoothing_numpy.py +++ b/src/compas/datastructures/mesh/smoothing_numpy.py @@ -3,9 +3,6 @@ from .matrices import trimesh_cotangent_laplacian_matrix -__all__ = ["trimesh_smooth_laplacian_cotangent"] - - def trimesh_smooth_laplacian_cotangent(trimesh, fixed, kmax=10): """Smooth a triangle mesh using a laplacian matrix with cotangent weights. diff --git a/src/compas/datastructures/mesh/subdivision.py b/src/compas/datastructures/mesh/subdivision.py index 376b43eef13..0db8bc76aaa 100644 --- a/src/compas/datastructures/mesh/subdivision.py +++ b/src/compas/datastructures/mesh/subdivision.py @@ -13,21 +13,8 @@ from compas.utilities import pairwise -__all__ = [ - "mesh_subdivide", - "mesh_subdivide_tri", - "mesh_subdivide_corner", - "mesh_subdivide_quad", - "mesh_subdivide_catmullclark", - "mesh_subdivide_doosabin", - "mesh_subdivide_frames", - "trimesh_subdivide_loop", -] - - def subd_factory(cls): class SubdMesh(cls): - _add_vertex = cls.add_vertex _add_face = cls.add_face _insert_vertex = cls.insert_vertex @@ -204,8 +191,8 @@ def mesh_subdivide_quad(mesh, k=1): for _ in range(k): faces = {face: subd.face_vertices(face)[:] for face in subd.faces()} face_centroid = {face: subd.face_centroid(face) for face in subd.faces()} - for u, v in list(subd.edges()): - subd.split_edge(u, v, allow_boundary=True) + for edge in list(subd.edges()): + subd.split_edge(edge, allow_boundary=True) for face, vertices in faces.items(): descendant = {i: j for i, j in subd.face_halfedges(face)} ancestor = {j: i for i, j in subd.face_halfedges(face)} @@ -246,8 +233,8 @@ def mesh_subdivide_corner(mesh, k=1): for _ in range(k): subd = mesh_fast_copy(mesh) # split every edge - for u, v in list(subd.edges()): - subd.split_edge(u, v, allow_boundary=True) + for edge in list(subd.edges()): + subd.split_edge(edge, allow_boundary=True) # create 4 new faces for every old face for fkey in mesh.faces(): descendant = {i: j for i, j in subd.face_halfedges(fkey)} @@ -352,8 +339,7 @@ def mesh_subdivide_catmullclark(mesh, k=1, fixed=None): edgepoints = [] for u, v in mesh.edges(): - - w = subd.split_edge(u, v, allow_boundary=True) + w = subd.split_edge((u, v), allow_boundary=True) crease = mesh.edge_attribute((u, v), "crease") or 0 if crease: @@ -366,7 +352,6 @@ def mesh_subdivide_catmullclark(mesh, k=1, fixed=None): fkey_xyz = {fkey: mesh.face_centroid(fkey) for fkey in mesh.faces()} for fkey in mesh.faces(): - descendant = {i: j for i, j in subd.face_halfedges(fkey)} ancestor = {j: i for i, j in subd.face_halfedges(fkey)} @@ -736,8 +721,7 @@ def trimesh_subdivide_loop(mesh, k=1, fixed=None): # odd vertices for u, v in list(subd.edges()): - - w = subd.split_edge(u, v, allow_boundary=True) + w = subd.split_edge((u, v), allow_boundary=True) edgepoints[(u, v)] = w edgepoints[(v, u)] = w diff --git a/src/compas/datastructures/mesh/transformations.py b/src/compas/datastructures/mesh/transformations.py index e9a5d14f250..232663a8c98 100644 --- a/src/compas/datastructures/mesh/transformations.py +++ b/src/compas/datastructures/mesh/transformations.py @@ -5,12 +5,6 @@ from compas.geometry import transform_points -__all__ = [ - "mesh_transform", - "mesh_transformed", -] - - def mesh_transform(mesh, transformation): """Transform a mesh. diff --git a/src/compas/datastructures/mesh/transformations_numpy.py b/src/compas/datastructures/mesh/transformations_numpy.py index 94a2cb49388..6b2cf9bf9fd 100644 --- a/src/compas/datastructures/mesh/transformations_numpy.py +++ b/src/compas/datastructures/mesh/transformations_numpy.py @@ -5,12 +5,6 @@ from compas.geometry import transform_points_numpy -__all__ = [ - "mesh_transform_numpy", - "mesh_transformed_numpy", -] - - def mesh_transform_numpy(mesh, transformation): """Transform a mesh. diff --git a/src/compas/datastructures/mesh/triangulation.py b/src/compas/datastructures/mesh/triangulation.py index 631a6e15597..19298855060 100644 --- a/src/compas/datastructures/mesh/triangulation.py +++ b/src/compas/datastructures/mesh/triangulation.py @@ -3,12 +3,7 @@ from __future__ import division -from .operations import mesh_split_face - - -__all__ = [ - "mesh_quads_to_triangles", -] +from .operations.split import mesh_split_face def mesh_quads_to_triangles(mesh, check_angles=False): diff --git a/src/compas/datastructures/mesh/trimesh_samplepoints_numpy.py b/src/compas/datastructures/mesh/trimesh_samplepoints_numpy.py index 0edbaae9cba..ab0c60511fb 100644 --- a/src/compas/datastructures/mesh/trimesh_samplepoints_numpy.py +++ b/src/compas/datastructures/mesh/trimesh_samplepoints_numpy.py @@ -9,11 +9,6 @@ from numpy import finfo -__all__ = [ - "trimesh_samplepoints_numpy", -] - - def trimesh_samplepoints_numpy(mesh, num_points=1000, return_normals=False): """Compute sample points on a triangle mesh surface. @@ -64,9 +59,9 @@ def trimesh_samplepoints_numpy(mesh, num_points=1000, return_normals=False): raise ValueError("Mesh is invalid.") # (1) Prepare data for computing - key_index = mesh.key_index() + vertex_index = mesh.vertex_index() vertices = mesh.vertices_attributes("xyz") - faces = [[key_index[key] for key in mesh.face_vertices(fkey)] for fkey in mesh.faces()] + faces = [[vertex_index[vertex] for vertex in mesh.face_vertices(face)] for face in mesh.faces()] V = array(vertices, dtype=float64) F = array(faces, dtype=int) @@ -99,7 +94,6 @@ def trimesh_samplepoints_numpy(mesh, num_points=1000, return_normals=False): # (5) (if True) Return the normal vector of the sampled points if return_normals: - samples_points_normals = cross((v1 - v0), (v2 - v1), axis=1) samples_points_normals_norm = norm(samples_points_normals, ord=2, axis=1, keepdims=True) samples_points_normals = samples_points_normals / samples_points_normals_norm diff --git a/src/compas/datastructures/mesh/trimming.py b/src/compas/datastructures/mesh/trimming.py index d1f61ba81eb..39e279b5bc4 100644 --- a/src/compas/datastructures/mesh/trimming.py +++ b/src/compas/datastructures/mesh/trimming.py @@ -3,8 +3,5 @@ from __future__ import division -__all__ = [] - - def mesh_trim(mesh): pass diff --git a/src/compas/datastructures/network/__init__.py b/src/compas/datastructures/network/__init__.py index 4ad486ba3c5..e69de29bb2d 100644 --- a/src/compas/datastructures/network/__init__.py +++ b/src/compas/datastructures/network/__init__.py @@ -1,24 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas - -from .operations import * # noqa: F401 F403 - -if not compas.IPY: - from .matrices import * # noqa: F401 F403 - -from .network import * # noqa: F401 F403 - -from .combinatorics import * # noqa: F401 F403 -from .complementarity import * # noqa: F401 F403 -from .duality import * # noqa: F401 F403 -from .explode import * # noqa: F401 F403 -from .planarity import * # noqa: F401 F403 -from .smoothing import * # noqa: F401 F403 -from .transformations import * # noqa: F401 F403 -from .traversal import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/datastructures/network/combinatorics.py b/src/compas/datastructures/network/combinatorics.py index 8cca0778a9e..ee796af7daf 100644 --- a/src/compas/datastructures/network/combinatorics.py +++ b/src/compas/datastructures/network/combinatorics.py @@ -5,9 +5,6 @@ from compas.topology import breadth_first_traverse -__all__ = ["network_is_connected"] - - def network_is_connected(network): """Verify that the network is connected. @@ -38,5 +35,5 @@ def network_is_connected(network): """ if network.number_of_nodes() == 0: return False - nodes = breadth_first_traverse(network.adjacency, network.get_any_node()) + nodes = breadth_first_traverse(network.adjacency, network.node_sample(size=1)[0]) return len(nodes) == network.number_of_nodes() diff --git a/src/compas/datastructures/network/complementarity.py b/src/compas/datastructures/network/complementarity.py index a770a300e08..eb2a201258f 100644 --- a/src/compas/datastructures/network/complementarity.py +++ b/src/compas/datastructures/network/complementarity.py @@ -5,9 +5,6 @@ from itertools import combinations -__all__ = ["network_complement"] - - def network_complement(network, cls=None): """Generate the complement network of a network. @@ -44,6 +41,6 @@ def network_complement(network, cls=None): cls = type(network) nodes = [network.node_coordinates(key) for key in network.nodes()] - edges = [(u, v) for u, v in combinations(network.nodes(), 2) if not network.has_edge(u, v, directed=False)] + edges = [(u, v) for u, v in combinations(network.nodes(), 2) if not network.has_edge((u, v), directed=False)] return cls.from_nodes_and_edges(nodes, edges) diff --git a/src/compas/datastructures/network/duality.py b/src/compas/datastructures/network/duality.py index bcd7610b435..cb0b1e2a03c 100644 --- a/src/compas/datastructures/network/duality.py +++ b/src/compas/datastructures/network/duality.py @@ -9,11 +9,6 @@ from compas.geometry import is_ccw_xy -__all__ = [ - "network_find_cycles", -] - - PI2 = 2.0 * pi @@ -54,18 +49,17 @@ def network_find_cycles(network, breakpoints=None): leaves = list(network.leaves()) if leaves: - u = sorted([(key, network.node_coordinates(key, "xy")) for key in leaves], key=lambda x: (x[1][1], x[1][0]),)[ - 0 - ][0] + key_xy = list(zip(leaves, network.nodes_attributes("xy", keys=leaves))) else: - u = sorted(network.nodes(True), key=lambda x: (x[1]["y"], x[1]["x"]))[0][0] + key_xy = list(zip(network.nodes(), network.nodes_attributes("xy"))) + u = sorted(key_xy, key=lambda x: (x[1][1], x[1][0]))[0][0] cycles = {} found = {} ckey = 0 v = network_node_find_first_neighbor(network, u) - cycle = network_find_edge_cycle(network, u, v) + cycle = network_find_edge_cycle(network, (u, v)) frozen = frozenset(cycle) found[frozen] = ckey cycles[ckey] = cycle @@ -75,7 +69,7 @@ def network_find_cycles(network, breakpoints=None): for u, v in network.edges(): if network.adjacency[u][v] is None: - cycle = network_find_edge_cycle(network, u, v) + cycle = network_find_edge_cycle(network, (u, v)) frozen = frozenset(cycle) if frozen not in found: found[frozen] = ckey @@ -84,7 +78,7 @@ def network_find_cycles(network, breakpoints=None): for a, b in pairwise(cycle + cycle[:1]): network.adjacency[a][b] = found[frozen] if network.adjacency[v][u] is None: - cycle = network_find_edge_cycle(network, v, u) + cycle = network_find_edge_cycle(network, (v, u)) frozen = frozenset(cycle) if frozen not in found: found[frozen] = ckey @@ -155,7 +149,8 @@ def node_sort_neighbors(key, nbrs, xyz, ccw=True): return ordered -def network_find_edge_cycle(network, u, v): +def network_find_edge_cycle(network, edge): + u, v = edge cycle = [u] while True: cycle.append(v) diff --git a/src/compas/datastructures/network/explode.py b/src/compas/datastructures/network/explode.py index aeb88e93318..1750a479168 100644 --- a/src/compas/datastructures/network/explode.py +++ b/src/compas/datastructures/network/explode.py @@ -4,12 +4,6 @@ from compas.topology import connected_components -__all__ = [ - "network_disconnected_nodes", - "network_disconnected_edges", - "network_explode", -] - def network_disconnected_nodes(network): """Get the disconnected node groups in a network. diff --git a/src/compas/datastructures/network/matrices.py b/src/compas/datastructures/network/matrices.py index ef113f53f43..814ae32564e 100644 --- a/src/compas/datastructures/network/matrices.py +++ b/src/compas/datastructures/network/matrices.py @@ -8,14 +8,6 @@ from compas.numerical import laplacian_matrix -__all__ = [ - "network_adjacency_matrix", - "network_degree_matrix", - "network_connectivity_matrix", - "network_laplacian_matrix", -] - - def _return_matrix(M, rtype): if rtype == "list": return M.toarray().tolist() @@ -46,8 +38,8 @@ def network_adjacency_matrix(network, rtype="array"): Constructed adjacency matrix. """ - key_index = network.key_index() - adjacency = [[key_index[nbr] for nbr in network.neighbors(key)] for key in network.nodes()] + node_index = network.node_index() + adjacency = [[node_index[nbr] for nbr in network.neighbors(key)] for key in network.nodes()] return adjacency_matrix(adjacency, rtype=rtype) @@ -67,8 +59,8 @@ def network_degree_matrix(network, rtype="array"): Constructed node degree matrix. """ - key_index = network.key_index() - adjacency = [[key_index[nbr] for nbr in network.neighbors(key)] for key in network.nodes()] + node_index = network.node_index() + adjacency = [[node_index[nbr] for nbr in network.neighbors(key)] for key in network.nodes()] return degree_matrix(adjacency, rtype=rtype) @@ -88,8 +80,8 @@ def network_connectivity_matrix(network, rtype="array"): Constructed connectivity matrix. """ - key_index = network.key_index() - edges = [(key_index[u], key_index[v]) for u, v in network.edges()] + node_index = network.node_index() + edges = [(node_index[u], node_index[v]) for u, v in network.edges()] return connectivity_matrix(edges, rtype=rtype) @@ -117,6 +109,6 @@ def network_laplacian_matrix(network, normalize=False, rtype="array"): vectors could be used in a more natural way ``c = xyz + d``. """ - key_index = network.key_index() - edges = [(key_index[u], key_index[v]) for u, v in network.edges()] + node_index = network.node_index() + edges = [(node_index[u], node_index[v]) for u, v in network.edges()] return laplacian_matrix(edges, normalize=normalize, rtype=rtype) diff --git a/src/compas/datastructures/network/network.py b/src/compas/datastructures/network/network.py index ee359c654ff..b3dfaf8adf7 100644 --- a/src/compas/datastructures/network/network.py +++ b/src/compas/datastructures/network/network.py @@ -12,6 +12,9 @@ from compas.files import OBJ from compas.utilities import geometric_key +from compas.geometry import Point +from compas.geometry import Vector +from compas.geometry import Line from compas.geometry import centroid_points from compas.geometry import subtract_vectors from compas.geometry import distance_point_point @@ -22,7 +25,7 @@ from compas.datastructures import Graph -from .operations import network_split_edge +from .operations.split import network_split_edge from .combinatorics import network_is_connected from .complementarity import network_complement @@ -129,16 +132,22 @@ def from_obj(cls, filepath, precision=None): :class:`~compas.datastructures.Network` A network object. + See Also + -------- + :meth:`to_obj` + :meth:`from_lines`, :meth:`from_nodes_and_edges`, :meth:`from_pointcloud` + :class:`compas.files.OBJ` + """ network = cls() obj = OBJ(filepath, precision) obj.read() nodes = obj.vertices edges = obj.lines - for i, (x, y, z) in enumerate(nodes): + for i, (x, y, z) in enumerate(nodes): # type: ignore network.add_node(i, x=x, y=y, z=z) - for u, v in edges: - network.add_edge(u, v) + for edge in edges: # type: ignore + network.add_edge(*edge) return network @classmethod @@ -157,6 +166,11 @@ def from_lines(cls, lines, precision=None): :class:`~compas.datastructures.Network` A network object. + See Also + -------- + :meth:`to_lines` + :meth:`from_obj`, :meth:`from_nodes_and_edges`, :meth:`from_pointcloud` + """ network = cls() edges = [] @@ -194,6 +208,11 @@ def from_nodes_and_edges(cls, nodes, edges): :class:`~compas.datastructures.Network` A network object. + See Also + -------- + :meth:`to_nodes_and_edges` + :meth:`from_obj`, :meth:`from_lines`, :meth:`from_pointcloud` + """ network = cls() @@ -225,6 +244,11 @@ def from_pointcloud(cls, cloud, degree=3): :class:`~compas.datastructures.Network` A network object. + See Also + -------- + :meth:`to_points` + :meth:`from_obj`, :meth:`from_lines`, :meth:`from_nodes_and_edges` + """ network = cls() for x, y, z in cloud: @@ -250,6 +274,11 @@ def to_obj(self): ------- None + See Also + -------- + :meth:`from_obj` + :meth:`to_lines`, :meth:`to_nodes_and_edges`, :meth:`to_points` + """ raise NotImplementedError @@ -261,6 +290,11 @@ def to_points(self): list[list[float]] A list with the coordinates of the vertices of the network. + See Also + -------- + :meth:`from_pointcloud` + :meth:`to_lines`, :meth:`to_nodes_and_edges`, :meth:`to_obj` + """ return [self.node_coordinates(key) for key in self.nodes()] @@ -272,8 +306,13 @@ def to_lines(self): list[tuple[list[float], list[float]]] A list of lines each defined by a pair of point coordinates. + See Also + -------- + :meth:`from_lines` + :meth:`to_nodes_and_edges`, :meth:`to_obj`, :meth:`to_points` + """ - return [self.edge_coordinates(u, v) for u, v in self.edges()] + return [self.edge_coordinates(edge) for edge in self.edges()] def to_nodes_and_edges(self): """Return the nodes and edges of a network. @@ -285,6 +324,11 @@ def to_nodes_and_edges(self): list[tuple[hashable, hashable]] A list of edges, with each edge represented by a pair of indices in the node list. + See Also + -------- + :meth:`from_nodes_and_edges` + :meth:`to_lines`, :meth:`to_obj`, :meth:`to_points` + """ key_index = dict((key, index) for index, key in enumerate(self.nodes())) nodes = [self.node_coordinates(key) for key in self.nodes()] @@ -295,8 +339,8 @@ def to_nodes_and_edges(self): # helpers # -------------------------------------------------------------------------- - def key_gkey(self, precision=None): - """Returns a dictionary that maps node dictionary keys to the corresponding + def node_gkey(self, precision=None): + """Returns a dictionary that maps node identifiers to the corresponding *geometric key* up to a certain precision. Parameters @@ -307,16 +351,23 @@ def key_gkey(self, precision=None): Returns ------- dict[hashable, str] - A dictionary of key-geometric key pairs. + A dictionary of (node, geometric key) pairs. + + See Also + -------- + :meth:`gkey_node` + :func:`compas.geometry.geometric_key` """ gkey = geometric_key xyz = self.node_coordinates return {key: gkey(xyz(key), precision) for key in self.nodes()} - def gkey_key(self, precision=None): + key_gkey = node_gkey + + def gkey_node(self, precision=None): """Returns a dictionary that maps *geometric keys* of a certain precision - to the keys of the corresponding nodes. + to the identifiers of the corresponding nodes. Parameters ---------- @@ -326,15 +377,19 @@ def gkey_key(self, precision=None): Returns ------- dict[str, hashable] - A dictionary of geometric key-key pairs. + A dictionary of (geometric key, node) pairs. + + See Also + -------- + :meth:`node_gkey` + :func:`compas.geometry.geometric_key` """ gkey = geometric_key xyz = self.node_coordinates return {gkey(xyz(key), precision): key for key in self.nodes()} - node_gkey = key_gkey - gkey_node = gkey_key + gkey_key = gkey_node # -------------------------------------------------------------------------- # builders @@ -387,9 +442,33 @@ def node_coordinates(self, key, axes="xyz"): list[float] The coordinates of the node. + See Also + -------- + :meth:`node_point`, :meth:`node_laplacian`, :meth:`node_neighborhood_centroid` + """ return [self.node[key][axis] for axis in axes] + def node_point(self, node): + """Return the point of a node. + + Parameters + ---------- + node : hashable + The identifier of the node. + + Returns + ------- + :class:`compas.geometry.Point` + The point of the node. + + See Also + -------- + :meth:`node_coordinates`, :meth:`node_laplacian`, :meth:`node_neighborhood_centroid` + + """ + return Point(*self.node_coordinates(node)) + def node_laplacian(self, key): """Return the vector from the node to the centroid of its 1-ring neighborhood. @@ -400,16 +479,20 @@ def node_laplacian(self, key): Returns ------- - list[float] + :class:`compas.geometry.Vector` The laplacian vector. + See Also + -------- + :meth:`node_coordinates`, :meth:`node_point`, :meth:`node_neighborhood_centroid` + """ c = centroid_points([self.node_coordinates(nbr) for nbr in self.neighbors(key)]) p = self.node_coordinates(key) - return subtract_vectors(c, p) + return Vector(*subtract_vectors(c, p)) def node_neighborhood_centroid(self, key): - """Compute the centroid of the neighboring nodes. + """Return the computed centroid of the neighboring nodes. Parameters ---------- @@ -418,86 +501,91 @@ def node_neighborhood_centroid(self, key): Returns ------- - list[float] - The coordinates of the centroid. + :class:`compas.geometry.Point` + The point at the centroid. + + See Also + -------- + :meth:`node_coordinates`, :meth:`node_point`, :meth:`node_laplacian` """ - return centroid_points([self.node_coordinates(nbr) for nbr in self.neighbors(key)]) + return Point(*centroid_points([self.node_coordinates(nbr) for nbr in self.neighbors(key)])) # -------------------------------------------------------------------------- # edge geometry # -------------------------------------------------------------------------- - def edge_coordinates(self, u, v, axes="xyz"): + def edge_coordinates(self, edge, axes="xyz"): """Return the coordinates of the start and end point of an edge. Parameters ---------- - u : hashable - The key of the start node. - v : hashable - The key of the end node. + edge : tuple[hashable, hashable] + The identifier of the edge. axes : str, optional The axes along which the coordinates should be included. Returns ------- - list[float] + tuple[list[float], list[float]] The coordinates of the start point. - list[float] The coordinates of the end point. + See Also + -------- + :meth:`edge_point`, :meth:`edge_start`, :meth:`edge_end`, :meth:`edge_midpoint` + """ + u, v = edge return self.node_coordinates(u, axes=axes), self.node_coordinates(v, axes=axes) - def edge_length(self, u, v): - """Return the length of an edge. + def edge_start(self, edge): + """Return the start point of an edge. Parameters ---------- - u : hashable - The key of the start node. - v : hashable - The key of the end node. + edge : tuple[hashable, hashable] + The identifier of the edge. Returns ------- - float - The length of the edge. + :class:`compas.geometry.Point` + The start point of the edge. + + See Also + -------- + :meth:`edge_point`, :meth:`edge_end`, :meth:`edge_midpoint` """ - a, b = self.edge_coordinates(u, v) - return distance_point_point(a, b) + return self.node_point(edge[0]) - def edge_vector(self, u, v): - """Return the vector of an edge. + def edge_end(self, edge): + """Return the end point of an edge. Parameters ---------- - u : hashable - The key of the start node. - v : hashable - The key of the end node. + edge : tuple[hashable, hashable] + The identifier of the edge. Returns ------- - list[float] - The vector from u to v. + :class:`compas.geometry.Point` + The end point of the edge. + + See Also + -------- + :meth:`edge_point`, :meth:`edge_start`, :meth:`edge_midpoint` """ - a, b = self.edge_coordinates(u, v) - ab = subtract_vectors(b, a) - return ab + return self.node_point(edge[1]) - def edge_point(self, u, v, t=0.5): - """Return the location of a point along an edge. + def edge_point(self, edge, t=0.5): + """Return the point at a parametric location along an edge. Parameters ---------- - u : hashable - The key of the start node. - v : hashable - The key of the end node. + edge : tuple[hashable, hashable] + The identifier of the edge. t : float, optional The location of the point on the edge. If the value of `t` is outside the range 0-1, the point will @@ -505,47 +593,124 @@ def edge_point(self, u, v, t=0.5): Returns ------- - list[float] - The XYZ coordinates of the point. + :class:`compas.geometry.Point` + The point at the specified location. + + See Also + -------- + :meth:`edge_start`, :meth:`edge_end`, :meth:`edge_midpoint` """ - a, b = self.edge_coordinates(u, v) + if t == 0.0: + return self.edge_start(edge) + if t == 1.0: + return self.edge_end(edge) + if t == 0.5: + return self.edge_midpoint(edge) + + a, b = self.edge_coordinates(edge) ab = subtract_vectors(b, a) - return add_vectors(a, scale_vector(ab, t)) + return Point(*add_vectors(a, scale_vector(ab, t))) - def edge_midpoint(self, u, v): + def edge_midpoint(self, edge): """Return the location of the midpoint of an edge. Parameters ---------- - u : hashable - The key of the start node. - v : hashable - The key of the end node. + edge : tuple[hashable, hashable] + The identifier of the edge. Returns ------- - list[float] - The XYZ coordinates of the midpoint. + :class:`compas.geometry.Point` + The midpoint of the edge. + + See Also + -------- + :meth:`edge_start`, :meth:`edge_end`, :meth:`edge_point` """ - a, b = self.edge_coordinates(u, v) - return midpoint_line((a, b)) + a, b = self.edge_coordinates(edge) + return Point(*midpoint_line((a, b))) + + def edge_vector(self, edge): + """Return the vector of an edge. - def edge_direction(self, u, v): + Parameters + ---------- + edge : tuple[hashable, hashable] + The identifier of the edge. + + Returns + ------- + :class:`compas.geometry.Vector` + The vector from start to end. + + See Also + -------- + :meth:`edge_direction`, :meth:`edge_line`, :meth:`edge_length` + + """ + a, b = self.edge_coordinates(edge) + return Vector.from_start_end(a, b) + + def edge_direction(self, edge): """Return the direction vector of an edge. Parameters ---------- - u : hashable - The key of the start node. - v : hashable - The key of the end node. + edge : tuple[hashable, hashable] + The identifier of the edge. Returns ------- - list[float] + :class:`compas.geometry.Vector` The direction vector of the edge. + See Also + -------- + :meth:`edge_vector`, :meth:`edge_line`, :meth:`edge_length` + """ - return normalize_vector(self.edge_vector(u, v)) + return Vector(*normalize_vector(self.edge_vector(edge))) + + def edge_line(self, edge): + """Return the line of an edge. + + Parameters + ---------- + edge : tuple[hashable, hashable] + The identifier of the edge. + + Returns + ------- + :class:`compas.geometry.Line` + The line of the edge. + + See Also + -------- + :meth:`edge_vector`, :meth:`edge_direction`, :meth:`edge_length` + + """ + return Line(*self.edge_coordinates(edge)) + + def edge_length(self, edge): + """Return the length of an edge. + + Parameters + ---------- + edge : tuple[hashable, hashable] + The identifier of the edge. + + Returns + ------- + float + The length of the edge. + + See Also + -------- + :meth:`edge_vector`, :meth:`edge_direction`, :meth:`edge_line` + + """ + a, b = self.edge_coordinates(edge) + return distance_point_point(a, b) diff --git a/src/compas/datastructures/network/operations/__init__.py b/src/compas/datastructures/network/operations/__init__.py index 7a9198e29be..e69de29bb2d 100644 --- a/src/compas/datastructures/network/operations/__init__.py +++ b/src/compas/datastructures/network/operations/__init__.py @@ -1,8 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from .split import * # noqa: F401 F403 -from .join import * # noqa: F401 F403 - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/datastructures/network/operations/join.py b/src/compas/datastructures/network/operations/join.py index 7d2f3f818fd..7777b15367e 100644 --- a/src/compas/datastructures/network/operations/join.py +++ b/src/compas/datastructures/network/operations/join.py @@ -5,8 +5,6 @@ from compas.utilities import pairwise from compas.utilities import geometric_key -__all__ = ["network_join_edges", "network_polylines"] - def network_join_edges(network, key): """Join the edges incidental on the given node, if there are exactly two incident edges. @@ -50,7 +48,7 @@ def network_join_edges(network, key): del network.halfedge[key] del network.edge[key] # set attributes based on average of two joining edges? - network.add_edge(a, b) + network.add_edge((a, b)) def network_polylines(network, splits=None): @@ -105,7 +103,6 @@ def network_polylines(network, splits=None): # get adjacent edges until the polyline is closed... while polyline[0] != polyline[-1]: - # ... or until both end are non-two-valent vertices if ( len(network.neighbors(polyline[-1])) != 2 diff --git a/src/compas/datastructures/network/operations/split.py b/src/compas/datastructures/network/operations/split.py index 04fb9a20944..3eaebd3a523 100644 --- a/src/compas/datastructures/network/operations/split.py +++ b/src/compas/datastructures/network/operations/split.py @@ -3,20 +3,13 @@ from __future__ import division -__all__ = [ - "network_split_edge", -] - - -def network_split_edge(network, u, v, t=0.5): +def network_split_edge(network, edge, t=0.5): """Split and edge by inserting a node along its length. Parameters ---------- - u : str - The key of the first node of the edge. - v : str - The key of the second node of the edge. + edge : tuple[hashable, hashable] + The identifier of the edge to split. t : float, optional The position of the inserted node on the edge. @@ -30,9 +23,10 @@ def network_split_edge(network, u, v, t=0.5): ValueError If `t` is not in the range 0-1. Exception - If `u` and `v` are not neighbors. + If the edge is not part of the network. """ + u, v = edge if not network.has_edge(u, v): return @@ -42,11 +36,11 @@ def network_split_edge(network, u, v, t=0.5): raise ValueError("t should be smaller than 1.0.") # the split node - x, y, z = network.edge_point(u, v, t) + x, y, z = network.edge_point(edge, t) w = network.add_node(x=x, y=y, z=z) - network.add_edge(u, w) - network.add_edge(w, v) + network.add_edge((u, w)) + network.add_edge((w, v)) if v in network.edge[u]: del network.edge[u][v] diff --git a/src/compas/datastructures/network/planarity.py b/src/compas/datastructures/network/planarity.py index 95243a1f6ed..506a31ce3f2 100644 --- a/src/compas/datastructures/network/planarity.py +++ b/src/compas/datastructures/network/planarity.py @@ -14,18 +14,6 @@ from compas.geometry import subtract_vectors_xy -__all__ = [ - "network_is_crossed", - "network_count_crossings", - "network_find_crossings", - "network_is_xy", - "network_is_planar", - "network_is_planar_embedding", - "network_embed_in_plane", - "network_embed_in_plane_proxy", -] - - def network_embed_in_plane_proxy(data, fixed=None, straightline=True): from compas.datastructures import Network diff --git a/src/compas/datastructures/network/smoothing.py b/src/compas/datastructures/network/smoothing.py index ccb708ff3b0..271fd53d282 100644 --- a/src/compas/datastructures/network/smoothing.py +++ b/src/compas/datastructures/network/smoothing.py @@ -5,11 +5,6 @@ from compas.geometry import centroid_points -__all__ = [ - "network_smooth_centroid", -] - - def network_smooth_centroid(network, fixed=None, kmax=100, damping=0.5, callback=None, callback_args=None): """Smooth a network by moving every free node to the centroid of its neighbors. diff --git a/src/compas/datastructures/network/transformations.py b/src/compas/datastructures/network/transformations.py index bc403eec24d..8dd228a0256 100644 --- a/src/compas/datastructures/network/transformations.py +++ b/src/compas/datastructures/network/transformations.py @@ -6,12 +6,6 @@ from compas.geometry import transform_points -__all__ = [ - "network_transform", - "network_transformed", -] - - def network_transform(network, transformation): """Transform a network. diff --git a/src/compas/datastructures/network/traversal.py b/src/compas/datastructures/network/traversal.py index fe7cda4edc3..eeba6b1565b 100644 --- a/src/compas/datastructures/network/traversal.py +++ b/src/compas/datastructures/network/traversal.py @@ -5,9 +5,6 @@ from compas.topology import shortest_path -__all__ = ["network_shortest_path"] - - def network_shortest_path(network, start, end): """Find the shortest path between two nodes of the network. diff --git a/src/compas/datastructures/volmesh/__init__.py b/src/compas/datastructures/volmesh/__init__.py index 6dac31a42eb..e69de29bb2d 100644 --- a/src/compas/datastructures/volmesh/__init__.py +++ b/src/compas/datastructures/volmesh/__init__.py @@ -1,13 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from .operations import * # noqa: F401 F403 - -from .bbox import * # noqa: F401 F403 -from .transformations import * # noqa: F401 F403 - -from .volmesh import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/datastructures/volmesh/volmesh.py b/src/compas/datastructures/volmesh/volmesh.py index a596d5584ef..556ff6ab3b0 100644 --- a/src/compas/datastructures/volmesh/volmesh.py +++ b/src/compas/datastructures/volmesh/volmesh.py @@ -9,6 +9,11 @@ from compas.files import OBJ +from compas.geometry import Point +from compas.geometry import Vector +from compas.geometry import Line +from compas.geometry import Polygon +from compas.geometry import Polyhedron from compas.geometry import add_vectors from compas.geometry import bestfit_plane from compas.geometry import centroid_points @@ -128,6 +133,10 @@ def from_meshgrid(cls, dx=10, dy=None, dz=None, nx=10, ny=None, nz=None): ------- :class:`~compas.datastructures.VolMesh` + See Also + -------- + :meth:`from_obj`, :meth:`from_vertices_and_cells` + """ dy = dy or dx dz = dz or dx @@ -178,6 +187,12 @@ def from_obj(cls, filepath, precision=None): :class:`~compas.datastructures.VolMesh` A volmesh object. + See Also + -------- + :meth:`to_obj` + :meth:`from_meshgrid`, :meth:`from_vertices_and_cells` + :class:`compas.files.OBJ` + """ obj = OBJ(filepath, precision) vertices = obj.parser.vertices @@ -213,6 +228,10 @@ def to_obj(self, filepath, precision=None, **kwargs): ------- None + See Also + -------- + :meth:`from_obj` + Warnings -------- This function only writes geometric data about the vertices and @@ -238,6 +257,11 @@ def from_vertices_and_cells(cls, vertices, cells): :class:`~compas.datastructures.VolMesh` A volmesh object. + See Also + -------- + :meth:`to_vertices_and_cells` + :meth:`from_obj`, :meth:`from_meshgrid` + """ volmesh = cls() for x, y, z in vertices: @@ -256,6 +280,10 @@ def to_vertices_and_cells(self): list[list[list[int]]] A list of cells, with each cell a list of faces, and each face a list of vertex indices. + See Also + -------- + :meth:`from_vertices_and_cells` + """ vertex_index = self.vertex_index() vertices = [self.vertex_coordinates(vertex) for vertex in self.vertices()] @@ -280,6 +308,10 @@ def cell_to_mesh(self, cell): :class:`~compas.datastructures.Mesh` A mesh object. + See Also + -------- + :meth:`cell_to_vertices_and_faces` + """ vertices, faces = self.cell_to_vertices_and_faces(cell) return Mesh.from_vertices_and_faces(vertices, faces) @@ -299,6 +331,10 @@ def cell_to_vertices_and_faces(self, cell): list[list[int]] A list of faces, with each face a list of vertex indices. + See Also + -------- + :meth:`cell_to_mesh` + """ vertices = self.cell_vertices(cell) faces = self.cell_faces(cell) @@ -325,6 +361,10 @@ def vertex_gkey(self, precision=None): dict[int, str] A dictionary of vertex-geometric key pairs. + See Also + -------- + :meth:`gkey_vertex` + """ gkey = geometric_key xyz = self.vertex_coordinates @@ -344,6 +384,10 @@ def gkey_vertex(self, precision=None): dict[str, int] A dictionary of geometric key-vertex pairs. + See Also + -------- + :meth:`vertex_gkey` + """ gkey = geometric_key xyz = self.vertex_coordinates @@ -366,11 +410,11 @@ def centroid(self): Returns ------- - list[float] - The coordinates of the centroid. + :class:`compas.geometry.Point` + The point at the centroid. """ - return centroid_points([self.vertex_coordinates(vertex) for vertex in self.vertices()]) + return Point(*centroid_points([self.vertex_coordinates(vertex) for vertex in self.vertices()])) # -------------------------------------------------------------------------- # vertex geometry @@ -392,9 +436,33 @@ def vertex_coordinates(self, vertex, axes="xyz"): list[float] Coordinates of the vertex. + See Also + -------- + :meth:`vertex_point`, :meth:`vertex_laplacian`, :meth:`vertex_neighborhood_centroid` + """ return [self._vertex[vertex][axis] for axis in axes] + def vertex_point(self, vertex): + """Return the point representation of a vertex. + + Parameters + ---------- + vertex : int + The identifier of the vertex. + + Returns + ------- + :class:`compas.geometry.Point` + The point. + + See Also + -------- + :meth:`vertex_laplacian`, :meth:`vertex_neighborhood_centroid` + + """ + return Point(*self.vertex_coordinates(vertex)) + def vertex_laplacian(self, vertex): """Compute the vector from a vertex to the centroid of its neighbors. @@ -405,16 +473,20 @@ def vertex_laplacian(self, vertex): Returns ------- - list[float] - The components of the vector. + :class:`compas.geometry.Vector` + The laplacian vector. + + See Also + -------- + :meth:`vertex_point`, :meth:`vertex_neighborhood_centroid` """ c = self.vertex_neighborhood_centroid(vertex) p = self.vertex_coordinates(vertex) - return subtract_vectors(c, p) + return Vector(*subtract_vectors(c, p)) def vertex_neighborhood_centroid(self, vertex): - """Compute the centroid of the neighbors of a vertex. + """Compute the point at the centroid of the neighbors of a vertex. Parameters ---------- @@ -423,11 +495,15 @@ def vertex_neighborhood_centroid(self, vertex): Returns ------- - list[float] + :class:`compas.geometry.Point` The coordinates of the centroid. + See Also + -------- + :meth:`vertex_point`, :meth:`vertex_laplacian` + """ - return centroid_points([self.vertex_coordinates(nbr) for nbr in self.vertex_neighbors(vertex)]) + return Point(*centroid_points([self.vertex_coordinates(nbr) for nbr in self.vertex_neighbors(vertex)])) # -------------------------------------------------------------------------- # edge geometry @@ -445,17 +521,22 @@ def edge_coordinates(self, edge, axes="xyz"): Returns ------- - list[float] + tuple[list[float], list[float]] The coordinates of the start point. - list[float] The coordinates of the end point. + See Also + -------- + :meth:`edge_start`, :meth:`edge_end`, :meth:`edge_midpoint`, :meth:`edge_point` + :meth:`edge_vector`, :meth:`edge_direction`, :meth:`edge_line` + :meth:`edge_length` + """ u, v = edge return self.vertex_coordinates(u, axes=axes), self.vertex_coordinates(v, axes=axes) - def edge_length(self, edge): - """Return the length of an edge. + def edge_start(self, edge): + """Return the start point of an edge. Parameters ---------- @@ -464,15 +545,18 @@ def edge_length(self, edge): Returns ------- - float - The length of the edge. + :class:`compas.geometry.Point` + The start point. + + See Also + -------- + :meth:`edge_end`, :meth:`edge_midpoint`, :meth:`edge_point` """ - a, b = self.edge_coordinates(edge) - return distance_point_point(a, b) + return self.vertex_point(edge[0]) - def edge_vector(self, edge): - """Return the vector of an edge. + def edge_end(self, edge): + """Return the end point of an edge. Parameters ---------- @@ -481,16 +565,39 @@ def edge_vector(self, edge): Returns ------- - list[float] - The vector from u to v. + :class:`compas.geometry.Point` + The end point. + + See Also + -------- + :meth:`edge_start`, :meth:`edge_midpoint`, :meth:`edge_point` + + """ + return self.vertex_point(edge[1]) + + def edge_midpoint(self, edge): + """Return the midpoint of an edge. + + Parameters + ---------- + edge : tuple[int, int] + The edge identifier. + + Returns + ------- + :class:`compas.geometry.Point` + The midpoint. + + See Also + -------- + :meth:`edge_start`, :meth:`edge_end`, :meth:`edge_point` """ a, b = self.edge_coordinates(edge) - ab = subtract_vectors(b, a) - return ab + return Point(0.5 * (a[0] + b[0]), 0.5 * (a[1] + b[1]), 0.5 * (a[2] + b[2])) def edge_point(self, edge, t=0.5): - """Return the location of a point along an edge. + """Return the point at a parametric location along an edge. Parameters ---------- @@ -503,13 +610,45 @@ def edge_point(self, edge, t=0.5): Returns ------- - list[float] + :class:`compas.geometry.Point` The XYZ coordinates of the point. + See Also + -------- + :meth:`edge_start`, :meth:`edge_end`, :meth:`edge_midpoint` + """ + if t == 0: + return self.edge_start(edge) + if t == 1: + return self.edge_end(edge) + if t == 0.5: + return self.edge_midpoint(edge) + a, b = self.edge_coordinates(edge) ab = subtract_vectors(b, a) - return add_vectors(a, scale_vector(ab, t)) + return Point(*add_vectors(a, scale_vector(ab, t))) + + def edge_vector(self, edge): + """Return the vector of an edge. + + Parameters + ---------- + edge : tuple[int, int] + The edge identifier. + + Returns + ------- + :class:`compas.geometry.Vector` + The vector from start to end. + + See Also + -------- + :meth:`edge_direction`, :meth:`edge_line` + + """ + a, b = self.edge_coordinates(edge) + return Vector.from_start_end(a, b) def edge_direction(self, edge): """Return the direction vector of an edge. @@ -521,11 +660,52 @@ def edge_direction(self, edge): Returns ------- - list[float] + :class:`compas.geometry.Vector` The direction vector of the edge. + See Also + -------- + :meth:`edge_vector`, :meth:`edge_line` + """ - return normalize_vector(self.edge_vector(edge)) + return Vector(*normalize_vector(self.edge_vector(edge))) + + def edge_line(self, edge): + """Return the line representation of an edge. + + Parameters + ---------- + edge : tuple[int, int] + The edge identifier. + + Returns + ------- + :class:`compas.geometry.Line` + The line. + + See Also + -------- + :meth:`edge_vector`, :meth:`edge_direction` + + """ + return Line(self.edge_start(edge), self.edge_end(edge)) + + def edge_length(self, edge): + """Return the length of an edge. + + Parameters + ---------- + edge : tuple[int, int] + The edge identifier. + + Returns + ------- + float + The length of the edge. + + """ + a, b = self.edge_coordinates(edge) + return distance_point_point(a, b) # -------------------------------------------------------------------------- # face geometry @@ -563,9 +743,54 @@ def face_coordinates(self, face, axes="xyz"): list[list[float]] The coordinates of the vertices of the face. + See Also + -------- + :meth:`face_points`, :meth:`face_polygon`, :meth:`face_normal`, :meth:`face_centroid`, :meth:`face_center` + :meth:`face_area`, :meth:`face_flatness`, :meth:`face_aspect_ratio` + """ return [self.vertex_coordinates(vertex, axes=axes) for vertex in self.face_vertices(face)] + def face_points(self, face): + """Compute the points of the vertices of a face. + + Parameters + ---------- + face : int + The identifier of the face. + + Returns + ------- + list[:class:`compas.geometry.Point`] + The points of the vertices of the face. + + See Also + -------- + :meth:`face_polygon`, :meth:`face_normal`, :meth:`face_centroid`, :meth:`face_center` + + """ + return [self.vertex_point(vertex) for vertex in self.face_vertices(face)] + + def face_polygon(self, face): + """Compute the polygon of a face. + + Parameters + ---------- + face : int + The identifier of the face. + + Returns + ------- + :class:`compas.geometry.Polygon` + The polygon of the face. + + See Also + -------- + :meth:`face_points`, :meth:`face_normal`, :meth:`face_centroid`, :meth:`face_center` + + """ + return Polygon(self.face_points(face)) + def face_normal(self, face, unitized=True): """Compute the oriented normal of a face. @@ -578,14 +803,18 @@ def face_normal(self, face, unitized=True): Returns ------- - list[float] - The components of the normal vector. + :class:`compas.geometry.Vector` + The normal vector. + + See Also + -------- + :meth:`face_points`, :meth:`face_polygon`, :meth:`face_centroid`, :meth:`face_center` """ - return normal_polygon(self.face_coordinates(face), unitized=unitized) + return Vector(*normal_polygon(self.face_coordinates(face), unitized=unitized)) def face_centroid(self, face): - """Compute the location of the centroid of a face. + """Compute the point at the centroid of a face. Parameters ---------- @@ -594,14 +823,18 @@ def face_centroid(self, face): Returns ------- - list[float] + :class:`compas.geometry.Point` The coordinates of the centroid. + See Also + -------- + :meth:`face_points`, :meth:`face_polygon`, :meth:`face_normal`, :meth:`face_center` + """ - return centroid_points(self.face_coordinates(face)) + return Point(*centroid_points(self.face_coordinates(face))) def face_center(self, face): - """Compute the location of the center of mass of a face. + """Compute the point at the center of mass of a face. Parameters ---------- @@ -610,11 +843,15 @@ def face_center(self, face): Returns ------- - list[float] + :class:`compas.geometry.Point` The coordinates of the center of mass. + See Also + -------- + :meth:`face_points`, :meth:`face_polygon`, :meth:`face_normal`, :meth:`face_centroid` + """ - return centroid_polygon(self.face_coordinates(face)) + return Point(*centroid_polygon(self.face_coordinates(face))) def face_area(self, face): """Compute the oriented area of a face. @@ -629,6 +866,10 @@ def face_area(self, face): float The non-oriented area of the face. + See Also + -------- + :meth:`face_flatness`, :meth:`face_aspect_ratio` + """ return length_vector(self.face_normal(face, unitized=False)) @@ -645,8 +886,12 @@ def face_flatness(self, face, maxdev=0.02): float The flatness. - Note - ---- + See Also + -------- + :meth:`face_area`, :meth:`face_aspect_ratio` + + Notes + ----- compas.geometry.mesh_flatness function currently only works for quadrilateral faces. This function uses the distance between each face vertex and its projected point on the best-fit plane of the face as the flatness metric. @@ -675,13 +920,17 @@ def face_aspect_ratio(self, face): float The aspect ratio. + See Also + -------- + :meth:`face_area`, :meth:`face_flatness` + References ---------- .. [1] Wikipedia. *Types of mesh*. Available at: https://en.wikipedia.org/wiki/Types_of_mesh. """ - face_edge_lengths = [self.edge_length(edge) for edge in self.face_halfedges(face)] + face_edge_lengths = [self.edge_length(edge) for edge in self.halfface_halfedges(face)] return max(face_edge_lengths) / min(face_edge_lengths) halfface_area = face_area @@ -696,8 +945,28 @@ def face_aspect_ratio(self, face): # cell geometry # -------------------------------------------------------------------------- + def cell_points(self, cell): + """Compute the points of the vertices of a cell. + + Parameters + ---------- + cell : int + The identifier of the cell. + + Returns + ------- + list[:class:`compas.geometry.Point`] + The points of the vertices of the cell. + + See Also + -------- + :meth:`cell_polygon`, :meth:`cell_centroid`, :meth:`cell_center` + + """ + return [self.vertex_point(vertex) for vertex in self.cell_vertices(cell)] + def cell_centroid(self, cell): - """Compute the location of the centroid of a cell. + """Compute the point at the centroid of a cell. Parameters ---------- @@ -706,15 +975,19 @@ def cell_centroid(self, cell): Returns ------- - list[float] + :class:`compas.geometry.Point` The coordinates of the centroid. + See Also + -------- + :meth:`cell_center` + """ vertices = self.cell_vertices(cell) - return centroid_points([self.vertex_coordinates(vertex) for vertex in vertices]) + return Point(*centroid_points([self.vertex_coordinates(vertex) for vertex in vertices])) def cell_center(self, cell): - """Compute the location of the center of mass of a cell. + """Compute the point at the center of mass of a cell. Parameters ---------- @@ -723,12 +996,16 @@ def cell_center(self, cell): Returns ------- - list[float] + :class:`compas.geometry.Point` The coordinates of the center of mass. + See Also + -------- + :meth:`cell_centroid` + """ vertices, faces = self.cell_to_vertices_and_faces(cell) - return centroid_polyhedron((vertices, faces)) + return Point(*centroid_polyhedron((vertices, faces))) def cell_vertex_normal(self, cell, vertex): """Return the normal vector at the vertex of a boundary cell as the weighted average of the @@ -743,10 +1020,27 @@ def cell_vertex_normal(self, cell, vertex): Returns ------- - list[float] + :class:`compas.geometry.Vector` The components of the normal vector. """ cell_faces = self.cell_faces(cell) - vectors = [self.face_normal(face) for face in self.vertex_faces(vertex) if face in cell_faces] - return normalize_vector(centroid_points(vectors)) + vectors = [self.face_normal(face) for face in self.vertex_halffaces(vertex) if face in cell_faces] + return Vector(*normalize_vector(centroid_points(vectors))) + + def cell_polyhedron(self, cell): + """Construct a polyhedron from the vertices and faces of a cell. + + Parameters + ---------- + cell : int + The identifier of the cell. + + Returns + ------- + :class:`compas.geometry.Polyhedron` + The polyhedron. + + """ + vertices, faces = self.cell_to_vertices_and_faces(cell) + return Polyhedron(vertices, faces) diff --git a/src/compas/files/__init__.py b/src/compas/files/__init__.py index 6e7d1b19ae9..0b9da407258 100644 --- a/src/compas/files/__init__.py +++ b/src/compas/files/__init__.py @@ -1,138 +1,12 @@ -""" -******************************************************************************** -files -******************************************************************************** - -.. currentmodule:: compas.files - -.. rst-class:: lead - -This package provides classes for working with selected file formats that are capable -of storing information about 2D and 3D geometry, robots, pointclouds, ... - - -DXF -=== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - DXF - DXFReader - DXFParser - - -GLTF -==== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - GLTF - GLTFReader - GLTFParser - GLTFContent - GLTFMesh - GLTFExporter - - -LAS -=== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - LAS - LASReader - LASParser - - -OBJ -=== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - OBJ - OBJReader - OBJParser - OBJWriter - - -OFF -=== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - OFF - OFFReader - OFFWriter - - -PLY -=== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - PLY - PLYReader - PLYParser - PLYWriter - - -STL -=== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - STL - STLReader - STLParser - STLWriter - - -URDF -==== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - URDF - URDFParser - URDFElement - URDFGenericElement - - -XML -=== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - XML - XMLReader - XMLWriter - XMLElement - prettify_string - - -""" from __future__ import absolute_import from .dxf import DXF, DXFParser, DXFReader -from .gltf import GLTF, GLTFContent, GLTFExporter, GLTFMesh, GLTFParser, GLTFReader +from .gltf.gltf import GLTF +from .gltf.gltf_content import GLTFContent +from .gltf.gltf_exporter import GLTFExporter +from .gltf.gltf_mesh import GLTFMesh +from .gltf.gltf_parser import GLTFParser +from .gltf.gltf_reader import GLTFReader from .las import LAS, LASParser, LASReader from .obj import OBJ, OBJParser, OBJReader, OBJWriter from .off import OFF, OFFReader, OFFWriter diff --git a/src/compas/files/gltf/__init__.py b/src/compas/files/gltf/__init__.py index 7e7503c1bf4..e69de29bb2d 100644 --- a/src/compas/files/gltf/__init__.py +++ b/src/compas/files/gltf/__init__.py @@ -1,19 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from .gltf import GLTF -from .gltf_content import GLTFContent -from .gltf_exporter import GLTFExporter -from .gltf_mesh import GLTFMesh -from .gltf_parser import GLTFParser -from .gltf_reader import GLTFReader - -__all__ = [ - "GLTF", - "GLTFContent", - "GLTFMesh", - "GLTFReader", - "GLTFParser", - "GLTFExporter", -] diff --git a/src/compas/files/gltf/extensions.py b/src/compas/files/gltf/extensions.py index 9c21932765f..0064849f942 100644 --- a/src/compas/files/gltf/extensions.py +++ b/src/compas/files/gltf/extensions.py @@ -4,7 +4,7 @@ def create_if_data(cls, data, attr): - return cls.from_data(data.get(attr)) if attr in data and len(data[attr]) else None + return cls.from_data(data.get(attr)) if attr in data and data[attr] is not None else None class KHR_materials_transmission(BaseGLTFDataClass): diff --git a/src/compas/files/gltf/gltf_mesh.py b/src/compas/files/gltf/gltf_mesh.py index 14e2fa37b8d..4736da08357 100644 --- a/src/compas/files/gltf/gltf_mesh.py +++ b/src/compas/files/gltf/gltf_mesh.py @@ -210,7 +210,19 @@ def from_mesh(cls, context, mesh): :class:`~compas.files.GLTFMesh` """ vertices, faces = mesh.to_vertices_and_faces() - return cls.from_vertices_and_faces(context, vertices, faces) + texture_coordinates = mesh.vertices_attribute("texture_coordinate") + vertex_normals = mesh.vertices_attribute("vertex_normal") + vertex_colors = mesh.vertices_attribute("vertex_color") + + mesh_data = cls.from_vertices_and_faces(context, vertices, faces) + pd = mesh_data.primitive_data_list[0] + if texture_coordinates[0] is not None: + pd.attributes["TEXCOORD_0"] = texture_coordinates + if vertex_normals[0] is not None: + pd.attributes["NORMAL"] = vertex_normals + if vertex_colors[0] is not None: + pd.attributes["COLOR_0"] = vertex_colors + return mesh_data def to_data(self, primitives): """Returns a JSONable dictionary object in accordance with glTF specifications. diff --git a/src/compas/files/obj.py b/src/compas/files/obj.py index b7478f463fe..37c3c93796f 100644 --- a/src/compas/files/obj.py +++ b/src/compas/files/obj.py @@ -527,8 +527,8 @@ def parse(self): index_key[i] = key vertex[key] = xyz - key_index = {key: index for index, key in enumerate(vertex)} - index_index = {index: key_index[key] for index, key in iter(index_key.items())} + vertex_index = {key: index for index, key in enumerate(vertex)} + index_index = {index: vertex_index[key] for index, key in iter(index_key.items())} self.vertices = [xyz for xyz in iter(vertex.values())] self.points = [index_index[index] for index in self.reader.points] @@ -642,10 +642,10 @@ def _write_vertices(self, mesh): self.file.write(self.vertex_tpl.format(x, y, z)) def _write_faces(self, mesh): - key_index = mesh.key_index() - for fkey in mesh.faces(): - vertices = mesh.face_vertices(fkey) - vertices = [key_index[key] + self._v for key in vertices] + vertex_index = mesh.vertex_index() + for face in mesh.faces(): + vertices = mesh.face_vertices(face) + vertices = [vertex_index[key] + self._v for key in vertices] vertices_str = " ".join([str(index) for index in vertices]) self.file.write("f {0}\n".format(vertices_str)) diff --git a/src/compas/files/off.py b/src/compas/files/off.py index e96b3cd906f..b885a137d74 100644 --- a/src/compas/files/off.py +++ b/src/compas/files/off.py @@ -291,8 +291,8 @@ def _write_vertices(self): self.file.write(self.vertex_tpl.format(x, y, z)) def _write_faces(self): - key_index = self.mesh.key_index() - for fkey in self.mesh.faces(): - vertices = self.mesh.face_vertices(fkey) + vertex_index = self.mesh.vertex_index() + for face in self.mesh.faces(): + vertices = self.mesh.face_vertices(face) v = len(vertices) - self.file.write("{0} {1}\n".format(v, " ".join([str(key_index[key]) for key in vertices]))) + self.file.write("{0} {1}\n".format(v, " ".join([str(vertex_index[vertex]) for vertex in vertices]))) diff --git a/src/compas/files/ply.py b/src/compas/files/ply.py index 2b2ab89699b..3cf465a838d 100644 --- a/src/compas/files/ply.py +++ b/src/compas/files/ply.py @@ -659,8 +659,8 @@ def _write_vertices(self): self.file.write(self.vertex_tpl.format(x, y, z)) def _write_faces(self): - key_index = self.mesh.key_index() - for fkey in self.mesh.faces(): - vertices = self.mesh.face_vertices(fkey) + vertex_index = self.mesh.vertex_index() + for face in self.mesh.faces(): + vertices = self.mesh.face_vertices(face) v = len(vertices) - self.file.write("{0} {1}\n".format(v, " ".join([str(key_index[key]) for key in vertices]))) + self.file.write("{0} {1}\n".format(v, " ".join([str(vertex_index[vertex]) for vertex in vertices]))) diff --git a/src/compas/files/stl.py b/src/compas/files/stl.py index 5bc71db857d..f7f455cd56b 100644 --- a/src/compas/files/stl.py +++ b/src/compas/files/stl.py @@ -394,7 +394,8 @@ def _write_footer(self): def _write_faces(self): vertex_xyz = self._vertex_xyz for face in self.mesh.faces(): - self.file.write("facet normal {0} {1} {2}\n".format(*self.mesh.face_normal(face))) + normal = list(self.mesh.face_normal(face)) + self.file.write("facet normal {0} {1} {2}\n".format(*normal)) self.file.write(" outer loop\n") for vertex in self.mesh.face_vertices(face): self.file.write(" vertex {0} {1} {2}\n".format(*vertex_xyz[vertex])) @@ -413,7 +414,8 @@ def _write_binary_num_faces(self): def _write_binary_faces(self): vertex_xyz = self._vertex_xyz for face in self.mesh.faces(): - self.file.write(struct.pack("<3f", *self.mesh.face_normal(face))) + normal = list(self.mesh.face_normal(face)) + self.file.write(struct.pack("<3f", *normal)) for vertex in self.mesh.face_vertices(face): self.file.write(struct.pack("<3f", *vertex_xyz[vertex])) self.file.write(b"\0\0") diff --git a/src/compas/geometry/__init__.py b/src/compas/geometry/__init__.py index 07c281e4232..184db9a4604 100644 --- a/src/compas/geometry/__init__.py +++ b/src/compas/geometry/__init__.py @@ -1,578 +1,27 @@ -""" -******************************************************************************** -geometry -******************************************************************************** - -.. currentmodule:: compas.geometry - -Primitives -========== - -Bases ------ - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Geometry - Primitive - Shape - Curve - Surface - -0-dimensional -------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Vector - Quaternion - Point - Pointcloud - Plane - Frame - -1-dimensional -------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Line - Polyline - Bezier - NurbsCurve - -2-dimensional -------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Circle - Ellipse - Polygon - NurbsSurface - Arc - -3-dimensional -------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Box - Sphere - Cylinder - Cone - Capsule - Torus - Polyhedron - -Boundary Representation (Brep) ------------------------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Brep - BrepVertex - BrepEdge - BrepLoop - BrepFace - BrepTrim - BrepTrimIsoStatus - - BrepType - BrepOrientation - - BrepError - BrepInvalidError - BrepTrimmingError - -Transformations -=============== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Projection - Reflection - Rotation - Scale - Shear - Transformation - Translation - - -Functions -========= - -Points, Vectors, Lines, Planes, Circles ---------------------------------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - angle_points - angle_points_xy - angle_vectors - angle_vectors_xy - angle_vectors_signed - angles_points - angles_points_xy - angles_vectors - angles_vectors_xy - angle_planes - centroid_points - centroid_points_xy - centroid_points_weighted - circle_from_points - circle_from_points_xy - midpoint_point_point - midpoint_point_point_xy - midpoint_line - midpoint_line_xy - tangent_points_to_circle_xy - - -Polygons & Polyhedrons ----------------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - area_polygon - area_polygon_xy - area_triangle - area_triangle_xy - centroid_polygon - centroid_polygon_xy - centroid_polygon_vertices - centroid_polygon_vertices_xy - centroid_polygon_edges - centroid_polygon_edges_xy - centroid_polyhedron - normal_polygon - normal_triangle - normal_triangle_xy - volume_polyhedron - - -Point Sets ----------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - bestfit_circle_numpy - bestfit_frame_numpy - bestfit_plane - bestfit_plane_numpy - bestfit_sphere_numpy - bounding_box - bounding_box_xy - convex_hull - convex_hull_numpy - convex_hull_xy - convex_hull_xy_numpy - icp_numpy - oabb_numpy - oriented_bounding_box_numpy - oriented_bounding_box_xy_numpy - - -Distance --------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - closest_line_to_point - closest_point_in_cloud - closest_point_in_cloud_xy - closest_point_on_line - closest_point_on_line_xy - closest_point_on_plane - closest_point_on_polyline - closest_point_on_polyline_xy - closest_point_on_segment - closest_point_on_segment_xy - distance_line_line - distance_point_point - distance_point_point_xy - distance_point_point_sqrd - distance_point_point_sqrd_xy - distance_point_line - distance_point_line_xy - distance_point_line_sqrd - distance_point_line_sqrd_xy - distance_point_plane - distance_point_plane_signed - - -Intersections -------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - intersection_circle_circle_xy - intersection_ellipse_line_xy - intersection_line_box_xy - intersection_line_line_xy - intersection_line_line - intersection_line_plane - intersection_line_segment_xy - intersection_line_segment - intersection_line_triangle - intersection_mesh_mesh - intersection_plane_circle - intersection_plane_plane_plane - intersection_plane_plane - intersection_polyline_plane - intersection_ray_mesh - intersection_segment_plane - intersection_segment_polyline - intersection_segment_polyline_xy - intersection_segment_segment - intersection_segment_segment_xy - intersection_sphere_line - intersection_sphere_sphere - - -Interpolation -------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - barycentric_coordinates - discrete_coons_patch - tween_points - tween_points_distance - - -Offsets -------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - offset_line - offset_polyline - offset_polygon - - -Boolean operations ------------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - boolean_union_mesh_mesh - boolean_difference_mesh_mesh - boolean_intersection_mesh_mesh - - -Triangulation -------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - conforming_delaunay_triangulation - constrained_delaunay_triangulation - delaunay_from_points - delaunay_from_points_numpy - delaunay_triangulation - voronoi_from_points_numpy - - -Triangle meshes ---------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - trimesh_gaussian_curvature - trimesh_geodistance - trimesh_harmonic - trimesh_isolines - trimesh_lscm - trimesh_mean_curvature - trimesh_massmatrix - trimesh_principal_curvature - trimesh_remesh - trimesh_remesh_constrained - trimesh_remesh_along_isoline - trimesh_slice - - -Quad meshes ------------ - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - quadmesh_planarize - - -Predicates ----------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - is_ccw_xy - is_colinear - is_colinear_line_line - is_colinear_xy - is_coplanar - is_intersection_line_line - is_intersection_line_line_xy - is_intersection_line_plane - is_intersection_line_triangle - is_intersection_plane_plane - is_intersection_segment_plane - is_intersection_segment_segment - is_intersection_segment_segment_xy - is_point_behind_plane - is_point_infront_plane - is_point_in_circle - is_point_in_circle_xy - is_point_in_convex_polygon_xy - is_point_in_halfspace - is_point_in_polygon_xy - is_point_in_polyhedron - is_point_in_triangle - is_point_in_triangle_xy - is_point_on_line - is_point_on_line_xy - is_point_on_plane - is_point_on_polyline - is_point_on_polyline_xy - is_point_on_segment - is_point_on_segment_xy - is_polygon_convex - is_polygon_convex_xy - is_polygon_in_polygon_xy - - -Transformations ---------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - axis_and_angle_from_matrix - axis_angle_vector_from_matrix - axis_angle_from_quaternion - basis_vectors_from_matrix - compose_matrix - decompose_matrix - dehomogenize_numpy - dehomogenize_and_unflatten_frames_numpy - euler_angles_from_matrix - euler_angles_from_quaternion - homogenize_numpy - homogenize_and_flatten_frames_numpy - identity_matrix - local_axes - local_to_world_coordinates - local_to_world_coordinates_numpy - matrix_determinant - matrix_from_axis_and_angle - matrix_from_axis_angle_vector - matrix_from_basis_vectors - matrix_from_change_of_basis - matrix_from_euler_angles - matrix_from_frame - matrix_from_frame_to_frame - matrix_from_orthogonal_projection - matrix_from_parallel_projection - matrix_from_perspective_entries - matrix_from_perspective_projection - matrix_from_quaternion - matrix_from_scale_factors - matrix_from_shear - matrix_from_shear_entries - matrix_from_translation - matrix_inverse - mirror_point_plane - mirror_points_line - mirror_points_line_xy - mirror_points_plane - mirror_points_point - mirror_points_point_xy - mirror_vector_vector - orient_points - orthonormalize_axes - project_point_line - project_point_line_xy - project_point_plane - project_points_line - project_points_line_xy - project_points_plane - quaternion_canonize - quaternion_conjugate - quaternion_from_axis_angle - quaternion_from_euler_angles - quaternion_from_matrix - quaternion_is_unit - quaternion_multiply - quaternion_norm - quaternion_unitize - reflect_line_plane - reflect_line_triangle - rotate_points - rotate_points_xy - scale_points - scale_points_xy - transform_frames - transform_points - transform_points_numpy - transform_vectors - transform_vectors_numpy - translate_points - translate_points_xy - translation_from_matrix - world_to_local_coordinates - world_to_local_coordinates_numpy - - -Linear algebra --------------- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - add_vectors - add_vectors_xy - allclose - argmax - argmin - close - cross_vectors - cross_vectors_xy - dehomogenize_vectors - divide_vectors - divide_vectors_xy - dot_vectors - dot_vectors_xy - homogenize_vectors - length_vector - length_vector_xy - length_vector_sqrd - length_vector_sqrd_xy - multiply_matrices - multiply_matrix_vector - multiply_vectors - multiply_vectors_xy - norm_vector - norm_vectors - normalize_vector - normalize_vector_xy - normalize_vectors - normalize_vectors_xy - orthonormalize_vectors - power_vector - power_vectors - scale_vector - scale_vector_xy - scale_vectors - scale_vectors_xy - square_vector - square_vectors - subtract_vectors - subtract_vectors_xy - sum_vectors - transpose_matrix - vector_average - vector_component - vector_component_xy - vector_standard_deviation - vector_variance - - -Misc ----- - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - KDTree - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - archimedean_spiral_evaluate - circle_evaluate - ellipse_evaluate, - helix_evaluate - logarithmic_spiral_evaluate - -""" from __future__ import absolute_import import compas -from ._core import ( - close, - allclose, - argmin, - argmax, - add_vectors, - add_vectors_xy, - sum_vectors, - cross_vectors, - cross_vectors_xy, - divide_vectors, - divide_vectors_xy, - dot_vectors, - dot_vectors_xy, - length_vector, - length_vector_xy, - length_vector_sqrd, - length_vector_sqrd_xy, - multiply_matrices, - multiply_matrix_vector, - multiply_vectors, - multiply_vectors_xy, +# ============================================================================= +# Core +# ============================================================================= + +from ._core._algebra import add_vectors, add_vectors_xy, allclose, argmax, argmin +from ._core._algebra import close, cross_vectors, cross_vectors_xy +from ._core._algebra import dehomogenize_vectors, divide_vectors, divide_vectors_xy, dot_vectors, dot_vectors_xy +from ._core._algebra import homogenize_vectors +from ._core._algebra import length_vector, length_vector_sqrd, length_vector_sqrd_xy, length_vector_xy +from ._core._algebra import multiply_matrices, multiply_matrix_vector, multiply_vectors, multiply_vectors_xy +from ._core._algebra import ( norm_vector, norm_vectors, normalize_vector, normalize_vector_xy, normalize_vectors, normalize_vectors_xy, - homogenize_vectors, - dehomogenize_vectors, - orthonormalize_vectors, - power_vector, - power_vectors, +) +from ._core._algebra import orthonormalize_vectors +from ._core._algebra import power_vector, power_vectors +from ._core._algebra import ( scale_vector, scale_vector_xy, scale_vectors, @@ -581,82 +30,180 @@ square_vectors, subtract_vectors, subtract_vectors_xy, - transpose_matrix, + sum_vectors, +) +from ._core._algebra import transpose_matrix +from ._core._algebra import ( + vector_average, vector_component, vector_component_xy, - vector_average, - vector_variance, vector_standard_deviation, + vector_variance, +) + +from ._core.analytical import ( + archimedean_spiral_evaluate, circle_evaluate, ellipse_evaluate, - archimedean_spiral_evaluate, - logarithmic_spiral_evaluate, helix_evaluate, - angles_vectors, - angles_vectors_xy, - angles_points, - angles_points_xy, + logarithmic_spiral_evaluate, +) +from ._core.angles import ( + angle_planes, + angle_points, + angle_points_xy, angle_vectors, angle_vectors_signed, angle_vectors_xy, - angle_points, - angle_points_xy, - angle_planes, - midpoint_point_point, - midpoint_point_point_xy, - midpoint_line, - midpoint_line_xy, + angles_points, + angles_points_xy, + angles_vectors, + angles_vectors_xy, +) +from ._core.centroids import ( centroid_points, centroid_points_weighted, centroid_points_xy, centroid_polygon, - centroid_polygon_xy, - centroid_polygon_vertices, - centroid_polygon_vertices_xy, centroid_polygon_edges, centroid_polygon_edges_xy, + centroid_polygon_vertices, + centroid_polygon_vertices_xy, + centroid_polygon_xy, centroid_polyhedron, - circle_from_points, - circle_from_points_xy, - distance_point_point, - distance_point_point_xy, - distance_point_point_sqrd, - distance_point_point_sqrd_xy, - distance_point_line, - distance_point_line_xy, - distance_point_line_sqrd, - distance_point_line_sqrd_xy, - distance_point_plane, - distance_point_plane_signed, - distance_line_line, + midpoint_line, + midpoint_line_xy, + midpoint_point_point, + midpoint_point_point_xy, +) +from ._core.constructors import circle_from_points, circle_from_points_xy +from ._core.distance import ( + closest_line_to_point, closest_point_in_cloud, closest_point_in_cloud_xy, closest_point_on_line, closest_point_on_line_xy, - closest_point_on_segment, - closest_point_on_segment_xy, + closest_point_on_plane, + # closest_point_on_polygon_xy, closest_point_on_polyline, closest_point_on_polyline_xy, - closest_point_on_plane, - closest_line_to_point, - KDTree, - normal_polygon, - normal_triangle, - normal_triangle_xy, - quaternion_norm, - quaternion_unitize, - quaternion_is_unit, - quaternion_multiply, + closest_point_on_segment, + closest_point_on_segment_xy, + # closest_points_in_cloud_numpy, + distance_line_line, + distance_point_line, + distance_point_line_sqrd, + distance_point_line_sqrd_xy, + distance_point_line_xy, + distance_point_plane, + distance_point_plane_signed, + distance_point_point, + distance_point_point_sqrd, + distance_point_point_sqrd_xy, + distance_point_point_xy, +) +from ._core.normals import normal_polygon, normal_triangle, normal_triangle_xy +from ._core.quaternions import ( quaternion_canonize, quaternion_conjugate, - area_polygon, - area_polygon_xy, - area_triangle, - area_triangle_xy, - volume_polyhedron, - tangent_points_to_circle_xy, + quaternion_is_unit, + quaternion_multiply, + quaternion_norm, + quaternion_unitize, ) -from .predicates import ( +from ._core.size import area_polygon, area_polygon_xy, area_triangle, area_triangle_xy, volume_polyhedron +from ._core.tangent import tangent_points_to_circle_xy + +from ._core.kdtree import KDTree + +# ============================================================================= +# Transformations +# ============================================================================= + +from .transformations.matrices import ( + axis_and_angle_from_matrix, + axis_angle_from_quaternion, + axis_angle_vector_from_matrix, + basis_vectors_from_matrix, + compose_matrix, + decompose_matrix, + euler_angles_from_matrix, + euler_angles_from_quaternion, + identity_matrix, + matrix_determinant, + matrix_from_axis_and_angle, + matrix_from_axis_angle_vector, + matrix_from_basis_vectors, + matrix_from_change_of_basis, + matrix_from_euler_angles, + matrix_from_frame, + matrix_from_frame_to_frame, + matrix_from_orthogonal_projection, + matrix_from_parallel_projection, + matrix_from_perspective_entries, + matrix_from_perspective_projection, + matrix_from_quaternion, + matrix_from_scale_factors, + matrix_from_shear, + matrix_from_shear_entries, + matrix_from_translation, + matrix_inverse, + quaternion_from_axis_angle, + quaternion_from_euler_angles, + quaternion_from_matrix, + translation_from_matrix, +) + +from .transformations.transformations import local_axes, local_to_world_coordinates +from .transformations.transformations import ( + # mirror_point_line, + # mirror_point_line_xy, + mirror_point_plane, + # mirror_point_point, + # mirror_point_point_xy, + mirror_points_line, + mirror_points_line_xy, + mirror_points_point, + mirror_points_plane, + mirror_points_point_xy, + mirror_vector_vector, +) +from .transformations.transformations import orient_points, orthonormalize_axes +from .transformations.transformations import ( + project_point_line, + project_point_line_xy, + project_point_plane, + project_points_line, + project_points_line_xy, + project_points_plane, +) +from .transformations.transformations import reflect_line_plane, reflect_line_triangle, rotate_points, rotate_points_xy +from .transformations.transformations import scale_points, scale_points_xy +from .transformations.transformations import ( + transform_frames, + transform_points, + transform_vectors, + translate_points_xy, + translate_points, +) +from .transformations.transformations import world_to_local_coordinates + +if not compas.IPY: + from .transformations.transformations_numpy import dehomogenize_and_unflatten_frames_numpy, dehomogenize_numpy + from .transformations.transformations_numpy import homogenize_and_flatten_frames_numpy, homogenize_numpy + from .transformations.transformations_numpy import local_to_world_coordinates_numpy + from .transformations.transformations_numpy import ( + # transform_frames_numpy, + transform_points_numpy, + transform_vectors_numpy, + ) + from .transformations.transformations_numpy import world_to_local_coordinates_numpy + +# ============================================================================= +# Predicates +# ============================================================================= + +from .predicates.predicates_2 import ( is_ccw_xy, is_colinear_xy, is_polygon_convex_xy, @@ -670,6 +217,8 @@ is_polygon_in_polygon_xy, is_intersection_line_line_xy, is_intersection_segment_segment_xy, +) +from .predicates.predicates_3 import ( is_colinear, is_colinear_line_line, is_coplanar, @@ -691,7 +240,24 @@ is_intersection_segment_plane, is_intersection_plane_plane, ) -from .intersections import ( + +# ============================================================================= +# Other +# ============================================================================= + +from .bbox.bbox import bounding_box, bounding_box_xy +from .bestfit.bestfit import bestfit_plane +from .booleans import ( + boolean_union_mesh_mesh, + boolean_difference_mesh_mesh, + boolean_intersection_mesh_mesh, +) +from .hull.hull import convex_hull, convex_hull_xy +from .interpolation.barycentric import barycentric_coordinates +from .interpolation.coons import discrete_coons_patch +from .interpolation.tweening import tween_points, tween_points_distance +from .intersections import intersection_mesh_mesh, intersection_ray_mesh +from .intersections.intersections import ( intersection_circle_circle_xy, intersection_ellipse_line_xy, intersection_line_box_xy, @@ -701,12 +267,10 @@ intersection_line_segment_xy, intersection_line_segment, intersection_line_triangle, - intersection_mesh_mesh, intersection_plane_circle, intersection_plane_plane_plane, intersection_plane_plane, intersection_polyline_plane, - intersection_ray_mesh, intersection_segment_plane, intersection_segment_polyline_xy, intersection_segment_polyline, @@ -715,196 +279,97 @@ intersection_sphere_line, intersection_sphere_sphere, ) -from .transformations import ( - matrix_determinant, - matrix_inverse, - decompose_matrix, - compose_matrix, - identity_matrix, - matrix_from_frame, - matrix_from_frame_to_frame, - matrix_from_change_of_basis, - matrix_from_euler_angles, - matrix_from_axis_and_angle, - matrix_from_axis_angle_vector, - matrix_from_basis_vectors, - matrix_from_translation, - matrix_from_orthogonal_projection, - matrix_from_parallel_projection, - matrix_from_perspective_projection, - matrix_from_perspective_entries, - matrix_from_shear_entries, - matrix_from_shear, - matrix_from_scale_factors, - matrix_from_quaternion, - euler_angles_from_matrix, - euler_angles_from_quaternion, - axis_and_angle_from_matrix, - axis_angle_vector_from_matrix, - axis_angle_from_quaternion, - quaternion_from_matrix, - quaternion_from_euler_angles, - quaternion_from_axis_angle, - basis_vectors_from_matrix, - translation_from_matrix, - local_axes, - orthonormalize_axes, - transform_points, - transform_vectors, - transform_frames, - local_to_world_coordinates, - world_to_local_coordinates, - translate_points, - translate_points_xy, - scale_points, - scale_points_xy, - rotate_points, - rotate_points_xy, - mirror_vector_vector, - mirror_points_point, - mirror_points_point_xy, - mirror_points_line, - mirror_points_line_xy, - mirror_point_plane, - mirror_points_plane, - project_point_plane, - project_points_plane, - project_point_line, - project_point_line_xy, - project_points_line, - project_points_line_xy, - reflect_line_plane, - reflect_line_triangle, - orient_points, - Projection, - Reflection, - Rotation, - Scale, - Shear, - Transformation, - Translation, -) - -if not compas.IPY: - from .transformations import ( - transform_points_numpy, - transform_vectors_numpy, - homogenize_numpy, - dehomogenize_numpy, - homogenize_and_flatten_frames_numpy, - dehomogenize_and_unflatten_frames_numpy, - world_to_local_coordinates_numpy, - local_to_world_coordinates_numpy, - ) - -from .geometry import Geometry - -from .primitives import ( # noqa: E402 - Primitive, - Bezier, - Circle, - Ellipse, - Frame, - Line, - Plane, - Point, - Polygon, - Polyline, - Quaternion, - Vector, - Arc, -) -from .shapes import ( # noqa: E402 - Shape, - Box, - Capsule, - Cone, - Cylinder, - Polyhedron, - Sphere, - Torus, -) -from .bbox import bounding_box, bounding_box_xy # noqa: E402 +from .offset.offset import offset_line, offset_polyline, offset_polygon +from .quadmesh.planarization import quadmesh_planarize +from .triangulation import conforming_delaunay_triangulation, constrained_delaunay_triangulation, delaunay_triangulation +from .triangulation.delaunay import delaunay_from_points +from .trimesh.curvature import trimesh_mean_curvature, trimesh_gaussian_curvature, trimesh_principal_curvature +from .trimesh.geodistance import trimesh_geodistance +from .trimesh.isolines import trimesh_isolines +from .trimesh.matrices import trimesh_massmatrix +from .trimesh.parametrisation import trimesh_harmonic, trimesh_lscm +from .trimesh.remesh import trimesh_remesh, trimesh_remesh_along_isoline, trimesh_remesh_constrained +from .trimesh.slicing import trimesh_slice if not compas.IPY: - from .bbox import ( + from .bbox.bbox_numpy import ( oriented_bounding_box_numpy, oriented_bounding_box_xy_numpy, oabb_numpy, ) -from .bestfit import bestfit_plane # noqa: E402 - -if not compas.IPY: - from .bestfit import ( + from .bestfit.bestfit_numpy import ( bestfit_plane_numpy, bestfit_frame_numpy, bestfit_circle_numpy, bestfit_sphere_numpy, ) -from .booleans import ( # noqa: E402 - boolean_union_mesh_mesh, - boolean_difference_mesh_mesh, - boolean_intersection_mesh_mesh, -) -from .hull import convex_hull, convex_hull_xy # noqa: E402 - -if not compas.IPY: - from .hull import convex_hull_numpy, convex_hull_xy_numpy -from .interpolation import ( # noqa: E402 - barycentric_coordinates, - discrete_coons_patch, - tween_points, - tween_points_distance, -) -from .offset import offset_line, offset_polyline, offset_polygon # noqa: E402 -from .pointclouds import Pointcloud # noqa: E402 -from .quadmesh import quadmesh_planarize # noqa: E402 -from .triangulation import ( # noqa: E402 - conforming_delaunay_triangulation, - constrained_delaunay_triangulation, - delaunay_from_points, - delaunay_triangulation, -) - -if not compas.IPY: - from .triangulation import delaunay_from_points_numpy, voronoi_from_points_numpy -from .trimesh import ( # noqa: E402 - trimesh_mean_curvature, - trimesh_gaussian_curvature, - trimesh_principal_curvature, - trimesh_geodistance, - trimesh_isolines, - trimesh_massmatrix, - trimesh_harmonic, - trimesh_lscm, - trimesh_remesh, - trimesh_remesh_constrained, - trimesh_remesh_along_isoline, - trimesh_slice, -) + from .hull.hull_numpy import convex_hull_numpy, convex_hull_xy_numpy + from .icp.icp_numpy import icp_numpy + from .triangulation.delaunay_numpy import delaunay_from_points_numpy, voronoi_from_points_numpy -if not compas.IPY: - from .icp import icp_numpy - -from .curves import Curve, NurbsCurve +# ============================================================================= +# Class APIs +# ============================================================================= -from .surfaces import Surface, NurbsSurface +from .geometry import Geometry +from .transformations.transformation import Transformation + +from .transformations.projection import Projection +from .transformations.reflection import Reflection +from .transformations.rotation import Rotation +from .transformations.scale import Scale +from .transformations.shear import Shear +from .transformations.translation import Translation + +from .primitives._primitive import Primitive +from .primitives.vector import Vector +from .primitives.point import Point +from .primitives.line import Line +from .primitives.plane import Plane +from .primitives.quaternion import Quaternion +from .primitives.frame import Frame + +from .primitives.arc import Arc +from .primitives.circle import Circle +from .primitives.curve import Bezier +from .primitives.ellipse import Ellipse +from .primitives.polygon import Polygon +from .primitives.polyline import Polyline + +from .curves.curve import Curve +from .curves.nurbs import NurbsCurve + +from .surfaces.surface import Surface +from .surfaces.nurbs import NurbsSurface + +from .shapes._shape import Shape +from .shapes.box import Box +from .shapes.capsule import Capsule +from .shapes.cone import Cone +from .shapes.cylinder import Cylinder +from .shapes.polyhedron import Polyhedron +from .shapes.sphere import Sphere +from .shapes.torus import Torus + +from .pointclouds.pointcloud import Pointcloud from .brep import ( - Brep, - BrepVertex, - BrepFace, - BrepLoop, - BrepEdge, - BrepTrim, - BrepTrimIsoStatus, - BrepType, - BrepOrientation, BrepError, BrepInvalidError, BrepTrimmingError, ) +from .brep.brep import Brep +from .brep.brep import BrepOrientation +from .brep.brep import BrepType +from .brep.edge import BrepEdge +from .brep.loop import BrepLoop +from .brep.face import BrepFace +from .brep.vertex import BrepVertex +from .brep.trim import BrepTrim +from .brep.trim import BrepTrimIsoStatus + + __all__ = [ "close", "allclose", diff --git a/src/compas/geometry/_core/__init__.py b/src/compas/geometry/_core/__init__.py index c19989b1a0e..e69de29bb2d 100644 --- a/src/compas/geometry/_core/__init__.py +++ b/src/compas/geometry/_core/__init__.py @@ -1,19 +0,0 @@ -from __future__ import print_function -from __future__ import absolute_import -from __future__ import division - -from ._algebra import * # noqa: F401 F403 - -from .constructors import * # noqa: F401 F403 -from .analytical import * # noqa: F401 F403 -from .distance import * # noqa: F401 F403 -from .angles import * # noqa: F401 F403 -from .centroids import * # noqa: F401 F403 -from .normals import * # noqa: F401 F403 -from .size import * # noqa: F401 F403 -from .quaternions import * # noqa: F401 F403 -from .tangent import * # noqa: F401 F403 -from .kdtree import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/_core/_algebra.py b/src/compas/geometry/_core/_algebra.py index 921435eb4df..31ca4303fd8 100644 --- a/src/compas/geometry/_core/_algebra.py +++ b/src/compas/geometry/_core/_algebra.py @@ -5,55 +5,6 @@ from math import sqrt from math import fabs -__all__ = [ - "close", - "allclose", - "argmin", - "argmax", - "add_vectors", - "add_vectors_xy", - "sum_vectors", - "cross_vectors", - "cross_vectors_xy", - "divide_vectors", - "divide_vectors_xy", - "dot_vectors", - "dot_vectors_xy", - "length_vector", - "length_vector_xy", - "length_vector_sqrd", - "length_vector_sqrd_xy", - "multiply_matrices", - "multiply_matrix_vector", - "multiply_vectors", - "multiply_vectors_xy", - "norm_vector", - "norm_vectors", - "normalize_vector", - "normalize_vector_xy", - "normalize_vectors", - "normalize_vectors_xy", - "homogenize_vectors", - "dehomogenize_vectors", - "orthonormalize_vectors", - "power_vector", - "power_vectors", - "scale_vector", - "scale_vector_xy", - "scale_vectors", - "scale_vectors_xy", - "square_vector", - "square_vectors", - "subtract_vectors", - "subtract_vectors_xy", - "transpose_matrix", - "vector_component", - "vector_component_xy", - "vector_average", - "vector_variance", - "vector_standard_deviation", -] - def vector_average(vector): """Average of a vector. diff --git a/src/compas/geometry/_core/analytical.py b/src/compas/geometry/_core/analytical.py index 9dfb90d9eff..13a40b13403 100644 --- a/src/compas/geometry/_core/analytical.py +++ b/src/compas/geometry/_core/analytical.py @@ -6,14 +6,6 @@ from math import cos from math import sin -__all__ = [ - "circle_evaluate", - "ellipse_evaluate", - "archimedean_spiral_evaluate", - "logarithmic_spiral_evaluate", - "helix_evaluate", -] - def circle_evaluate(t, r, z=0): """Evalutes a circle at a parameter. diff --git a/src/compas/geometry/_core/angles.py b/src/compas/geometry/_core/angles.py index 3fc88425be1..aa5901e0805 100644 --- a/src/compas/geometry/_core/angles.py +++ b/src/compas/geometry/_core/angles.py @@ -6,29 +6,13 @@ from math import degrees from math import acos -from compas.geometry._core import subtract_vectors -from compas.geometry._core import subtract_vectors_xy -from compas.geometry._core import dot_vectors -from compas.geometry._core import dot_vectors_xy -from compas.geometry._core import length_vector -from compas.geometry._core import length_vector_xy -from compas.geometry._core import cross_vectors - - -__all__ = [ - "angles_vectors", - "angles_vectors_xy", - "angles_vectors", - "angles_vectors_xy", - "angles_points", - "angles_points_xy", - "angle_vectors", - "angle_vectors_signed", - "angle_vectors_xy", - "angle_points", - "angle_points_xy", - "angle_planes", -] +from ._algebra import subtract_vectors +from ._algebra import subtract_vectors_xy +from ._algebra import dot_vectors +from ._algebra import dot_vectors_xy +from ._algebra import length_vector +from ._algebra import length_vector_xy +from ._algebra import cross_vectors def angle_vectors(u, v, deg=False, tol=0.0): diff --git a/src/compas/geometry/_core/centroids.py b/src/compas/geometry/_core/centroids.py index 4b5a17ff2cc..63777dc524f 100644 --- a/src/compas/geometry/_core/centroids.py +++ b/src/compas/geometry/_core/centroids.py @@ -6,34 +6,16 @@ from compas.utilities import pairwise -from compas.geometry._core import add_vectors -from compas.geometry._core import subtract_vectors -from compas.geometry._core import subtract_vectors_xy -from compas.geometry._core import length_vector -from compas.geometry._core import length_vector_xy -from compas.geometry._core import dot_vectors -from compas.geometry._core import cross_vectors -from compas.geometry._core import cross_vectors_xy -from compas.geometry._core import scale_vector -from compas.geometry._core import sum_vectors - - -__all__ = [ - "midpoint_point_point", - "midpoint_point_point_xy", - "midpoint_line", - "midpoint_line_xy", - "centroid_points", - "centroid_points_weighted", - "centroid_points_xy", - "centroid_polygon", - "centroid_polygon_xy", - "centroid_polygon_vertices", - "centroid_polygon_vertices_xy", - "centroid_polygon_edges", - "centroid_polygon_edges_xy", - "centroid_polyhedron", -] +from ._algebra import add_vectors +from ._algebra import subtract_vectors +from ._algebra import subtract_vectors_xy +from ._algebra import length_vector +from ._algebra import length_vector_xy +from ._algebra import dot_vectors +from ._algebra import cross_vectors +from ._algebra import cross_vectors_xy +from ._algebra import scale_vector +from ._algebra import sum_vectors def midpoint_point_point(a, b): diff --git a/src/compas/geometry/_core/constructors.py b/src/compas/geometry/_core/constructors.py index 9c14a8153bd..5a31dadb826 100644 --- a/src/compas/geometry/_core/constructors.py +++ b/src/compas/geometry/_core/constructors.py @@ -4,20 +4,14 @@ from math import sqrt -from compas.geometry._core import subtract_vectors -from compas.geometry._core import sum_vectors -from compas.geometry._core import cross_vectors -from compas.geometry._core import dot_vectors -from compas.geometry._core import scale_vector -from compas.geometry._core import normalize_vector -from compas.geometry._core import length_vector -from compas.geometry._core import length_vector_sqrd - - -__all__ = [ - "circle_from_points", - "circle_from_points_xy", -] +from ._algebra import subtract_vectors +from ._algebra import sum_vectors +from ._algebra import cross_vectors +from ._algebra import dot_vectors +from ._algebra import scale_vector +from ._algebra import normalize_vector +from ._algebra import length_vector +from ._algebra import length_vector_sqrd def circle_from_points(a, b, c): diff --git a/src/compas/geometry/_core/distance.py b/src/compas/geometry/_core/distance.py index 899f7992e78..decbbe7636e 100644 --- a/src/compas/geometry/_core/distance.py +++ b/src/compas/geometry/_core/distance.py @@ -7,46 +7,21 @@ from compas.utilities import pairwise -from compas.geometry._core import add_vectors -from compas.geometry._core import add_vectors_xy -from compas.geometry._core import subtract_vectors -from compas.geometry._core import subtract_vectors_xy -from compas.geometry._core import scale_vector -from compas.geometry._core import normalize_vector -from compas.geometry._core import length_vector -from compas.geometry._core import length_vector_xy -from compas.geometry._core import length_vector_sqrd -from compas.geometry._core import length_vector_sqrd_xy -from compas.geometry._core import cross_vectors -from compas.geometry._core import cross_vectors_xy -from compas.geometry._core import dot_vectors -from compas.geometry._core import vector_component -from compas.geometry._core import vector_component_xy - - -__all__ = [ - "distance_point_point", - "distance_point_point_xy", - "distance_point_point_sqrd", - "distance_point_point_sqrd_xy", - "distance_point_line", - "distance_point_line_xy", - "distance_point_line_sqrd", - "distance_point_line_sqrd_xy", - "distance_point_plane", - "distance_point_plane_signed", - "distance_line_line", - "closest_point_in_cloud", - "closest_point_in_cloud_xy", - "closest_point_on_line", - "closest_point_on_line_xy", - "closest_point_on_segment", - "closest_point_on_segment_xy", - "closest_point_on_polyline", - "closest_point_on_polyline_xy", - "closest_point_on_plane", - "closest_line_to_point", -] +from ._algebra import add_vectors +from ._algebra import add_vectors_xy +from ._algebra import subtract_vectors +from ._algebra import subtract_vectors_xy +from ._algebra import scale_vector +from ._algebra import normalize_vector +from ._algebra import length_vector +from ._algebra import length_vector_xy +from ._algebra import length_vector_sqrd +from ._algebra import length_vector_sqrd_xy +from ._algebra import cross_vectors +from ._algebra import cross_vectors_xy +from ._algebra import dot_vectors +from ._algebra import vector_component +from ._algebra import vector_component_xy def distance_point_point(a, b): diff --git a/src/compas/geometry/_core/kdtree.py b/src/compas/geometry/_core/kdtree.py index 874ffee9eaa..bd9587f2ea4 100644 --- a/src/compas/geometry/_core/kdtree.py +++ b/src/compas/geometry/_core/kdtree.py @@ -4,10 +4,7 @@ import collections -from compas.geometry._core import distance_point_point_sqrd - - -__all__ = ["KDTree"] +from .distance import distance_point_point_sqrd Node = collections.namedtuple("Node", "point axis label left right") diff --git a/src/compas/geometry/_core/normals.py b/src/compas/geometry/_core/normals.py index 85db0701dff..c7f9d066716 100644 --- a/src/compas/geometry/_core/normals.py +++ b/src/compas/geometry/_core/normals.py @@ -2,21 +2,14 @@ from __future__ import absolute_import from __future__ import division -from compas.geometry._core import subtract_vectors -from compas.geometry._core import subtract_vectors_xy -from compas.geometry._core import cross_vectors -from compas.geometry._core import cross_vectors_xy -from compas.geometry._core import length_vector -from compas.geometry._core import normalize_vector - -from compas.geometry._core import centroid_points - - -__all__ = [ - "normal_polygon", - "normal_triangle", - "normal_triangle_xy", -] +from ._algebra import subtract_vectors +from ._algebra import subtract_vectors_xy +from ._algebra import cross_vectors +from ._algebra import cross_vectors_xy +from ._algebra import length_vector +from ._algebra import normalize_vector + +from .centroids import centroid_points def normal_polygon(polygon, unitized=True): diff --git a/src/compas/geometry/_core/quaternions.py b/src/compas/geometry/_core/quaternions.py index 0fc76490892..7cfb6b5bcca 100644 --- a/src/compas/geometry/_core/quaternions.py +++ b/src/compas/geometry/_core/quaternions.py @@ -49,18 +49,9 @@ """ import math -from compas.geometry._core import allclose +from ._algebra import allclose -__all__ = [ - "quaternion_norm", - "quaternion_unitize", - "quaternion_is_unit", - "quaternion_multiply", - "quaternion_canonize", - "quaternion_conjugate", -] - ATOL = 1e-6 # absolute tolerance diff --git a/src/compas/geometry/_core/size.py b/src/compas/geometry/_core/size.py index c79a69e74a0..7536a8e985c 100644 --- a/src/compas/geometry/_core/size.py +++ b/src/compas/geometry/_core/size.py @@ -6,27 +6,18 @@ from compas.utilities import pairwise -from compas.geometry._core import subtract_vectors -from compas.geometry._core import subtract_vectors_xy -from compas.geometry._core import length_vector -from compas.geometry._core import cross_vectors -from compas.geometry._core import cross_vectors_xy -from compas.geometry._core import dot_vectors - -from compas.geometry._core import centroid_points -from compas.geometry._core import centroid_points_xy - -from compas.geometry._core import normal_triangle -from compas.geometry._core import normal_triangle_xy - - -__all__ = [ - "area_polygon", - "area_polygon_xy", - "area_triangle", - "area_triangle_xy", - "volume_polyhedron", -] +from ._algebra import subtract_vectors +from ._algebra import subtract_vectors_xy +from ._algebra import length_vector +from ._algebra import cross_vectors +from ._algebra import cross_vectors_xy +from ._algebra import dot_vectors + +from .centroids import centroid_points +from .centroids import centroid_points_xy + +from .normals import normal_triangle +from .normals import normal_triangle_xy def area_polygon(polygon): diff --git a/src/compas/geometry/_core/tangent.py b/src/compas/geometry/_core/tangent.py index 3f5f5be786b..32da71412a5 100644 --- a/src/compas/geometry/_core/tangent.py +++ b/src/compas/geometry/_core/tangent.py @@ -5,9 +5,6 @@ from math import sqrt -__all__ = ["tangent_points_to_circle_xy"] - - def tangent_points_to_circle_xy(circle, point): """Calculates the tangent points on a circle in the XY plane. diff --git a/src/compas/geometry/bbox/__init__.py b/src/compas/geometry/bbox/__init__.py index 57c9d4303da..e69de29bb2d 100644 --- a/src/compas/geometry/bbox/__init__.py +++ b/src/compas/geometry/bbox/__init__.py @@ -1,13 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas - -from .bbox import * # noqa: F401 F403 - -if not compas.IPY: - from .bbox_numpy import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/bbox/bbox.py b/src/compas/geometry/bbox/bbox.py index 44b731060b6..79e7b8a1c63 100644 --- a/src/compas/geometry/bbox/bbox.py +++ b/src/compas/geometry/bbox/bbox.py @@ -5,12 +5,6 @@ from itertools import islice -__all__ = [ - "bounding_box", - "bounding_box_xy", -] - - def bounding_box(points): """Computes the axis-aligned minimum bounding box of a list of points. diff --git a/src/compas/geometry/bbox/bbox_numpy.py b/src/compas/geometry/bbox/bbox_numpy.py index a078d7a7636..7986db0e290 100644 --- a/src/compas/geometry/bbox/bbox_numpy.py +++ b/src/compas/geometry/bbox/bbox_numpy.py @@ -9,30 +9,17 @@ from numpy import amax from numpy import amin from numpy import dot - -# from numpy import ptp from numpy import sum from scipy.spatial import ConvexHull -# from scipy.spatial import QhullError - +from compas.numerical import pca_numpy from compas.geometry import local_axes from compas.geometry import world_to_local_coordinates_numpy from compas.geometry import local_to_world_coordinates_numpy from compas.geometry import transform_points_numpy -from compas.geometry import Frame -from compas.geometry import Transformation -from compas.numerical import pca_numpy -from compas.geometry.bbox.bbox import bounding_box - - -__all__ = [ - "oriented_bounding_box_numpy", - "oriented_bounding_box_xy_numpy", - "oabb_numpy", -] +from .bbox import bounding_box # make alternative implementation using PCA @@ -264,6 +251,9 @@ def oabb_numpy(points): XYZ coordinates of 8 points defining a box. """ + from compas.geometry import Frame + from compas.geometry import Transformation + origin, (xaxis, yaxis, zaxis), values = pca_numpy(points) frame = Frame(origin, xaxis, yaxis) world = Frame.worldXY() diff --git a/src/compas/geometry/bestfit/__init__.py b/src/compas/geometry/bestfit/__init__.py index 7886571d90f..e69de29bb2d 100644 --- a/src/compas/geometry/bestfit/__init__.py +++ b/src/compas/geometry/bestfit/__init__.py @@ -1,13 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas - -from .bestfit import * # noqa: F401 F403 - -if not compas.IPY: - from .bestfit_numpy import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/bestfit/bestfit.py b/src/compas/geometry/bestfit/bestfit.py index 8219816fd43..e8a8a5c509d 100644 --- a/src/compas/geometry/bestfit/bestfit.py +++ b/src/compas/geometry/bestfit/bestfit.py @@ -7,9 +7,6 @@ from compas.geometry import centroid_points -__all__ = ["bestfit_plane"] - - def bestfit_plane(points): """Fit a plane to a list of (more than three) points. diff --git a/src/compas/geometry/bestfit/bestfit_numpy.py b/src/compas/geometry/bestfit/bestfit_numpy.py index 29cc3161f92..c8eaf27f782 100644 --- a/src/compas/geometry/bestfit/bestfit_numpy.py +++ b/src/compas/geometry/bestfit/bestfit_numpy.py @@ -8,17 +8,9 @@ from numpy.linalg import lstsq from scipy.optimize import leastsq +from compas.numerical import pca_numpy from compas.geometry import world_to_local_coordinates_numpy from compas.geometry import local_to_world_coordinates_numpy -from compas.numerical import pca_numpy - - -__all__ = [ - "bestfit_plane_numpy", - "bestfit_frame_numpy", - "bestfit_circle_numpy", - "bestfit_sphere_numpy", -] def bestfit_plane_numpy(points): diff --git a/src/compas/geometry/booleans/__init__.py b/src/compas/geometry/booleans/__init__.py index a256b292bfd..042a3bbc51f 100644 --- a/src/compas/geometry/booleans/__init__.py +++ b/src/compas/geometry/booleans/__init__.py @@ -4,12 +4,6 @@ from compas.plugins import pluggable -__all__ = [ - "boolean_union_mesh_mesh", - "boolean_difference_mesh_mesh", - "boolean_intersection_mesh_mesh", -] - @pluggable(category="booleans") def boolean_union_mesh_mesh(A, B): diff --git a/src/compas/geometry/brep/__init__.py b/src/compas/geometry/brep/__init__.py index 63c4272235f..c5474b87b5f 100644 --- a/src/compas/geometry/brep/__init__.py +++ b/src/compas/geometry/brep/__init__.py @@ -1,14 +1,3 @@ -from .brep import Brep -from .brep import BrepOrientation -from .brep import BrepType -from .edge import BrepEdge -from .loop import BrepLoop -from .face import BrepFace -from .vertex import BrepVertex -from .trim import BrepTrim -from .trim import BrepTrimIsoStatus - - class BrepError(Exception): """Represents a generic error in the Brep context""" @@ -25,19 +14,3 @@ class BrepTrimmingError(BrepError): """Raised when a trimming operation has failed or had not result""" pass - - -__all__ = [ - "Brep", - "BrepEdge", - "BrepLoop", - "BrepFace", - "BrepVertex", - "BrepTrim", - "BrepTrimIsoStatus", - "BrepOrientation", - "BrepType", - "BrepError", - "BrepInvalidError", - "BrepTrimmingError", -] diff --git a/src/compas/geometry/brep/brep.py b/src/compas/geometry/brep/brep.py index 1f2b58d1006..8d64ba4001b 100644 --- a/src/compas/geometry/brep/brep.py +++ b/src/compas/geometry/brep/brep.py @@ -213,10 +213,6 @@ def DATASCHEMA(self): } ) - @property - def JSONSCHEMANAME(self): - return "brep" - @property def data(self): faces = [] diff --git a/src/compas/geometry/curves/__init__.py b/src/compas/geometry/curves/__init__.py index 1a958bd18a2..e69de29bb2d 100644 --- a/src/compas/geometry/curves/__init__.py +++ b/src/compas/geometry/curves/__init__.py @@ -1,4 +0,0 @@ -from __future__ import absolute_import - -from .curve import Curve # noqa: F401 -from .nurbs import NurbsCurve # noqa: F401 diff --git a/src/compas/geometry/curves/curve.py b/src/compas/geometry/curves/curve.py index fce845b60a4..2b58a98c39e 100644 --- a/src/compas/geometry/curves/curve.py +++ b/src/compas/geometry/curves/curve.py @@ -53,21 +53,6 @@ def __str__(self): # Data # ============================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data.""" - raise NotImplementedError - - @property - def JSONSCHEMANAME(self): - """dict : Schema of the curve data in JSON format.""" - raise NotImplementedError - - @property - def dtype(self): - """str : The type of the object in the form of a '2-level' import and a class name.""" - return "compas.geometry/Curve" - @property def data(self): """dict : Representation of the curve as a dict containing only native Python data.""" diff --git a/src/compas/geometry/curves/nurbs.py b/src/compas/geometry/curves/nurbs.py index 5f1d313ffce..5ffbbcbd893 100644 --- a/src/compas/geometry/curves/nurbs.py +++ b/src/compas/geometry/curves/nurbs.py @@ -65,6 +65,20 @@ class NurbsCurve(Curve): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "points": {"type": "array", "minItems": 2, "items": Point.JSONSCHEMA}, + "weights": {"type": "array", "items": {"type": "number"}}, + "knots": {"type": "array", "items": {"type": "number"}}, + "multiplicities": {"type": "array", "items": {"type": "integer"}}, + "degree": {"type": "integer", "exclusiveMinimum": 0}, + "is_periodic": {"type": "boolean"}, + }, + "additionalProperties": False, + "minProperties": 6, + } + def __new__(cls, *args, **kwargs): return new_nurbscurve(cls, *args, **kwargs) @@ -95,30 +109,6 @@ def __str__(self): # Data # ============================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data.""" - from schema import Schema - from compas.data import is_float3 - from compas.data import is_sequence_of_int - from compas.data import is_sequence_of_float - - return Schema( - { - "points": lambda points: all(is_float3(point) for point in points), - "weights": is_sequence_of_float, - "knots": is_sequence_of_float, - "multiplicities": is_sequence_of_int, - "degree": int, - "is_periodic": bool, - } - ) - - @property - def JSONSCHEMANAME(self): - """dict : Schema of the curve data in JSON format.""" - raise NotImplementedError - @property def dtype(self): """str : The type of the object in the form of a '2-level' import and a class name.""" @@ -128,7 +118,7 @@ def dtype(self): def data(self): """dict : Representation of the curve as a dict containing only native Python data.""" return { - "points": [point.data for point in self.points], + "points": self.points, "weights": self.weights, "knots": self.knots, "multiplicities": self.multiplicities, @@ -155,7 +145,7 @@ def from_data(cls, data): The constructed curve. """ - points = [Point.from_data(point) for point in data["points"]] + points = data["points"] weights = data["weights"] knots = data["knots"] multiplicities = data["multiplicities"] diff --git a/src/compas/geometry/hull/__init__.py b/src/compas/geometry/hull/__init__.py index a997d8aa5cb..e69de29bb2d 100644 --- a/src/compas/geometry/hull/__init__.py +++ b/src/compas/geometry/hull/__init__.py @@ -1,13 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas - -from .hull import * # noqa: F401 F403 - -if not compas.IPY: - from .hull_numpy import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/hull/hull.py b/src/compas/geometry/hull/hull.py index 9004464c42b..547019b8a73 100644 --- a/src/compas/geometry/hull/hull.py +++ b/src/compas/geometry/hull/hull.py @@ -8,12 +8,6 @@ from compas.geometry import cross_vectors_xy -__all__ = [ - "convex_hull", - "convex_hull_xy", -] - - def convex_hull(points): """Construct convex hull for a set of points. diff --git a/src/compas/geometry/hull/hull_numpy.py b/src/compas/geometry/hull/hull_numpy.py index 7c9b099b754..d1119502db8 100644 --- a/src/compas/geometry/hull/hull_numpy.py +++ b/src/compas/geometry/hull/hull_numpy.py @@ -6,12 +6,6 @@ from scipy.spatial import ConvexHull -__all__ = [ - "convex_hull_numpy", - "convex_hull_xy_numpy", -] - - def convex_hull_numpy(points): """Compute the convex hull of a set of points. diff --git a/src/compas/geometry/icp/__init__.py b/src/compas/geometry/icp/__init__.py index 5731f4e56dc..e69de29bb2d 100644 --- a/src/compas/geometry/icp/__init__.py +++ b/src/compas/geometry/icp/__init__.py @@ -1,11 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas - -if not compas.IPY: - from .icp_numpy import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/icp/icp_numpy.py b/src/compas/geometry/icp/icp_numpy.py index 09cf50963ed..cd7534912b8 100644 --- a/src/compas/geometry/icp/icp_numpy.py +++ b/src/compas/geometry/icp/icp_numpy.py @@ -12,14 +12,9 @@ from compas.numerical import pca_numpy from compas.numerical import normrow -from compas.geometry import Transformation -from compas.geometry import Frame from compas.geometry import transform_points_numpy -__all__ = ["icp_numpy"] - - def bestfit_transform(A, B): n, m = A.shape Am = np.mean(A, axis=0) @@ -84,6 +79,9 @@ def icp_numpy(source, target, tol=1e-3): >>> """ + from compas.geometry import Transformation + from compas.geometry import Frame + A = asarray(source) B = asarray(target) diff --git a/src/compas/geometry/interpolation/__init__.py b/src/compas/geometry/interpolation/__init__.py index 13901f7a3cc..e69de29bb2d 100644 --- a/src/compas/geometry/interpolation/__init__.py +++ b/src/compas/geometry/interpolation/__init__.py @@ -1,10 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from .barycentric import * # noqa: F401 F403 -from .coons import * # noqa: F401 F403 -from .tweening import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/interpolation/barycentric.py b/src/compas/geometry/interpolation/barycentric.py index 25e85fe2d3f..7a5663b0439 100644 --- a/src/compas/geometry/interpolation/barycentric.py +++ b/src/compas/geometry/interpolation/barycentric.py @@ -6,9 +6,6 @@ from compas.geometry import dot_vectors -__all__ = ["barycentric_coordinates"] - - def barycentric_coordinates(point, triangle): """Compute the barycentric coordinates of a point wrt to a triangle. diff --git a/src/compas/geometry/interpolation/coons.py b/src/compas/geometry/interpolation/coons.py index 8b28675adc3..868ba0cef40 100644 --- a/src/compas/geometry/interpolation/coons.py +++ b/src/compas/geometry/interpolation/coons.py @@ -10,11 +10,6 @@ from compas.utilities import normalize_values -__all__ = [ - "discrete_coons_patch", -] - - def discrete_coons_patch(ab, bc, dc, ad): """Creates a coons patch from a set of four or three boundary polylines (ab, bc, dc, ad). diff --git a/src/compas/geometry/interpolation/tweening.py b/src/compas/geometry/interpolation/tweening.py index 19ee6d478ea..8b8862d9914 100644 --- a/src/compas/geometry/interpolation/tweening.py +++ b/src/compas/geometry/interpolation/tweening.py @@ -8,9 +8,6 @@ from compas.geometry import distance_point_point -__all__ = ["tween_points", "tween_points_distance"] - - def tween_points(points1, points2, num): """Compute the interpolated points between two sets of points. diff --git a/src/compas/geometry/intersections/__init__.py b/src/compas/geometry/intersections/__init__.py index ac06df4fcfb..f6fa9ec7bd7 100644 --- a/src/compas/geometry/intersections/__init__.py +++ b/src/compas/geometry/intersections/__init__.py @@ -3,7 +3,6 @@ from __future__ import print_function from compas.plugins import pluggable -from .intersections import * # noqa: F401 F403 @pluggable(category="intersections") @@ -53,6 +52,3 @@ def intersection_ray_mesh(ray, mesh): """ raise NotImplementedError - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/intersections/intersections.py b/src/compas/geometry/intersections/intersections.py index 40484290c55..0da81dd9480 100644 --- a/src/compas/geometry/intersections/intersections.py +++ b/src/compas/geometry/intersections/intersections.py @@ -25,30 +25,6 @@ from compas.geometry import is_point_in_triangle -__all__ = [ - "intersection_line_line", - "intersection_segment_segment", - "intersection_line_segment", - "intersection_line_plane", - "intersection_polyline_plane", - "intersection_line_triangle", - "intersection_segment_plane", - "intersection_plane_circle", - "intersection_plane_plane", - "intersection_plane_plane_plane", - "intersection_sphere_line", - "intersection_sphere_sphere", - "intersection_segment_polyline", - "intersection_line_line_xy", - "intersection_segment_segment_xy", - "intersection_line_segment_xy", - "intersection_line_box_xy", - "intersection_circle_circle_xy", - "intersection_ellipse_line_xy", - "intersection_segment_polyline_xy", -] - - def intersection_line_line(l1, l2, tol=1e-6): """Computes the intersection of two lines. diff --git a/src/compas/geometry/offset/__init__.py b/src/compas/geometry/offset/__init__.py index 123b83f6242..e69de29bb2d 100644 --- a/src/compas/geometry/offset/__init__.py +++ b/src/compas/geometry/offset/__init__.py @@ -1,9 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - - -from .offset import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/offset/offset.py b/src/compas/geometry/offset/offset.py index 6c5750a5723..44f20a9b9d6 100644 --- a/src/compas/geometry/offset/offset.py +++ b/src/compas/geometry/offset/offset.py @@ -12,16 +12,10 @@ from compas.geometry import normal_polygon from compas.geometry import is_colinear +from compas.data import is_item_iterable + from compas.utilities import iterable_like from compas.utilities import pairwise -from compas.utilities import is_item_iterable - - -__all__ = [ - "offset_line", - "offset_polyline", - "offset_polygon", -] def intersect_lines(l1, l2, tol): @@ -140,7 +134,6 @@ def offset_polygon(polygon, distance, tol=1e-6): >>> offsetted_polygon = offset_polygon(polygon, 0.5) >>> offsetted_polygon Polygon[[0.5, 0.5, 0.0], [0.5, 0.5, 0.0], [0.5, 0.5, 0.0], [0.5, 0.5, 0.0]] - >>> """ normal = normal_polygon(polygon) diff --git a/src/compas/geometry/pointclouds/__init__.py b/src/compas/geometry/pointclouds/__init__.py index baf8688eb3c..e69de29bb2d 100644 --- a/src/compas/geometry/pointclouds/__init__.py +++ b/src/compas/geometry/pointclouds/__init__.py @@ -1,7 +0,0 @@ -from __future__ import print_function -from __future__ import absolute_import -from __future__ import division - -from .pointcloud import * # noqa: F401 F403 - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/pointclouds/pointcloud.py b/src/compas/geometry/pointclouds/pointcloud.py index 7f8daf97f8e..6769e1ba708 100644 --- a/src/compas/geometry/pointclouds/pointcloud.py +++ b/src/compas/geometry/pointclouds/pointcloud.py @@ -10,9 +10,6 @@ from compas.geometry import Point -__all__ = ["Pointcloud"] - - class Pointcloud(Primitive): """Class for working with pointclouds. @@ -34,29 +31,28 @@ class Pointcloud(Primitive): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "points": {"type": "array", "items": Point.JSONSCHEMA, "minItems": 1}, + }, + "required": ["points"], + } + + __slots__ = ["_points"] + def __init__(self, points, **kwargs): super(Pointcloud, self).__init__(**kwargs) self._points = None self.points = points - @property - def DATASCHEMA(self): - from schema import Schema - from compas.data import is_float3 - - return Schema({"points": lambda points: all(is_float3(point) for point in points)}) - - @property - def JSONSCHEMANAME(self): - return "pointcloud" - @property def data(self): - return {"points": [point.data for point in self.points]} + return {"points": self.points} @data.setter def data(self, data): - self._points = [Point.from_data(point) for point in data["points"]] + self._points = data["points"] @classmethod def from_data(cls, data): diff --git a/src/compas/geometry/predicates/__init__.py b/src/compas/geometry/predicates/__init__.py index 1de2646dfe9..e69de29bb2d 100644 --- a/src/compas/geometry/predicates/__init__.py +++ b/src/compas/geometry/predicates/__init__.py @@ -1,8 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from .predicates_2 import * # noqa: F401 F403 -from .predicates_3 import * # noqa: F401 F403 - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/predicates/predicates_2.py b/src/compas/geometry/predicates/predicates_2.py index 85e23410461..6de386bdfa9 100644 --- a/src/compas/geometry/predicates/predicates_2.py +++ b/src/compas/geometry/predicates/predicates_2.py @@ -2,26 +2,9 @@ from __future__ import absolute_import from __future__ import division -from compas.geometry._core import distance_point_point_xy -from compas.geometry._core import distance_point_line_xy -from compas.geometry._core import closest_point_on_segment_xy - - -__all__ = [ - "is_ccw_xy", - "is_colinear_xy", - "is_polygon_convex_xy", - "is_point_on_line_xy", - "is_point_on_segment_xy", - "is_point_on_polyline_xy", - "is_point_in_triangle_xy", - "is_point_in_polygon_xy", - "is_point_in_convex_polygon_xy", - "is_point_in_circle_xy", - "is_polygon_in_polygon_xy", - "is_intersection_line_line_xy", - "is_intersection_segment_segment_xy", -] +from compas.geometry import distance_point_point_xy +from compas.geometry import distance_point_line_xy +from compas.geometry import closest_point_on_segment_xy def is_ccw_xy(a, b, c, colinear=False): @@ -383,7 +366,7 @@ def is_polygon_in_polygon_xy(polygon1, polygon2): for i in range(len(polygon1)): line = [polygon1[-i], polygon1[-i - 1]] for j in range(len(polygon2)): - line_ = [polygon2[-j], polygon2[j - 1]] + line_ = [polygon2[-j], polygon2[-j - 1]] if is_intersection_segment_segment_xy(line, line_): return False for pt in polygon2: @@ -392,6 +375,118 @@ def is_polygon_in_polygon_xy(polygon1, polygon2): return False +def polygon_to_polygon_relationship_xy(polygon1, polygon2): + """Determine if a polygon (polygon1) is inside, intersects, is outside or contains another polygon (polygon2) on the XY-plane. + + Parameters + ---------- + polygon1 : sequence[point] | :class:`~compas.geometry.Polygon` + List of XY(Z) coordinates of points representing the locations of the corners of the polygon to examine the position regarding the boundary polygon (Z will be ignored). + The vertices are assumed to be in order. The polygon is assumed to be closed: + the first and last vertex in the sequence should not be the same. + polygon2 : sequence[point] | :class:`~compas.geometry.Polygon` + List of XY(Z) coordinates of points representing the locations of the corners of the boundary polygon (Z will be ignored). + The vertices are assumed to be in order. The polygon is assumed to be closed: + the first and last vertex in the sequence should not be the same. + + Returns + ------- + int + 1 if polygon1 is inside polygon2. + 0 if polygon1 intersects polygon2. + -1 if polygon1 is outside polygon2. + -2 if polygon1 contains polygon2 (polygon2 is inside polygon1). + """ + for i in range(len(polygon1)): + line1 = [polygon1[i], polygon1[i - 1]] + for j in range(len(polygon2)): + line2 = [polygon2[j], polygon2[j - 1]] + if is_intersection_segment_segment_xy(line1, line2): + return 0 + for pt in polygon1: + if is_point_in_polygon_xy(pt, polygon2): + return 1 + if is_point_in_polygon_xy(polygon2.centroid, polygon1): + return -2 + return -1 + + +def point_to_polygon_relationship_xy(point, polygon, tolerance=10**-6): + """Determine if a point is inside, outside or on the boundary (with tolerance) of a polygon in the XY-plane. + + Parameters + ---------- + point : [float, float, float] | :class:`~compas.geometry.Point` + XY(Z) coordinates of a point (Z will be ignored). + polygon : sequence[point] | :class:`~compas.geometry.Polygon` + List of XY(Z) coordinates of points representing the locations of the corners of the boundary polygon (Z will be ignored). + The vertices are assumed to be in order. The polygon is assumed to be closed: + the first and last vertex in the sequence should not be the same. + + Returns + ------- + int + 1 if point is inside polygon. + 0 if point is on the boundary of polygon. + -1 if point is outside polygon. + """ + x, y = point[0], point[1] + polygon = [(p[0], p[1]) for p in polygon] # make 2D + flag = -1 + for i in range(-1, len(polygon) - 1): + x1, y1 = polygon[i] + x2, y2 = polygon[i + 1] + segment = ([x1, y1], [x2, y2]) + if is_point_on_segment_xy(point, segment, tolerance): + return 0 + elif y > min(y1, y2): + if y <= max(y1, y2): + if x <= max(x1, x2): + if y1 != y2: + xinters = (y - y1) * (x2 - x1) / (y2 - y1) + x1 + if x1 == x2 or x <= xinters: + flag = -flag + return flag + + +def is_intersection_polygon_polygon_xy(polygon1, polygon2): + """Determines if two polygons intersect, assuming they lie in the XY plane. + + Parameters + ---------- + polygon1 : sequence[point] | :class:`~compas.geometry.Polygon` + A Polygon lying in the XY. + polygon2 : sequence[point] | :class:`~compas.geometry.Polygon` + A Polygon lying in the XY. + + Returns + ------- + bool + True if the polygons intersect. False if they don't. + + Examples + -------- + >>> from compas.geometry import Polygon + >>> polygon1 = Polygon([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]) + >>> polygon2 = Polygon([[0.5, 0.5], [1.5, 0.5], [1.5, 1.5], [0.5, 1.5]]) + >>> is_intersection_polygon_polygon_xy(polygon1, polygon2) + True + + >>> from compas.geometry import Polygon + >>> polygon1 = Polygon([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]) + >>> polygon2 = Polygon([[1.5, 1.5], [2.5, 1.5], [2.5, 2.5], [1.5, 2.5]]) + >>> is_intersection_polygon_polygon_xy(polygon1, polygon2) + False + """ + for i in range(len(polygon1)): + line1 = [polygon1[i], polygon1[i - 1]] + for j in range(len(polygon2)): + line2 = [polygon2[j], polygon2[j - 1]] + if is_intersection_segment_segment_xy(line1, line2): + return True + return False + + def is_intersection_line_line_xy(l1, l2, tol=1e-6): """Verifies if two lines intersect on the XY-plane. @@ -405,7 +500,7 @@ def is_intersection_line_line_xy(l1, l2, tol=1e-6): A tolerance for intersection verification. Returns - -------- + ------- bool True if the lines intersect in one point False if the lines are skew, parallel or lie on top of each other. diff --git a/src/compas/geometry/predicates/predicates_3.py b/src/compas/geometry/predicates/predicates_3.py index 52e138ddf5d..55560cdf7a9 100644 --- a/src/compas/geometry/predicates/predicates_3.py +++ b/src/compas/geometry/predicates/predicates_3.py @@ -6,44 +6,20 @@ from compas.utilities import window -from compas.geometry._core import subtract_vectors -from compas.geometry._core import cross_vectors -from compas.geometry._core import dot_vectors -from compas.geometry._core import normalize_vector -from compas.geometry._core import centroid_points -from compas.geometry._core import normal_polygon -from compas.geometry._core import length_vector_sqrd - -from compas.geometry._core import distance_point_point -from compas.geometry._core import distance_point_plane -from compas.geometry._core import distance_point_line -from compas.geometry._core import closest_point_on_segment - -from compas.geometry._core import area_triangle - - -__all__ = [ - "is_colinear", - "is_colinear_line_line", - "is_coplanar", - "is_polygon_convex", - "is_point_on_plane", - "is_point_infront_plane", - "is_point_behind_plane", - "is_point_in_halfspace", - "is_point_on_line", - "is_point_on_segment", - "is_point_on_polyline", - "is_point_in_triangle", - "is_point_in_circle", - "is_point_in_polyhedron", - "is_intersection_line_line", - "is_intersection_segment_segment", - "is_intersection_line_triangle", - "is_intersection_line_plane", - "is_intersection_segment_plane", - "is_intersection_plane_plane", -] +from compas.geometry import subtract_vectors +from compas.geometry import cross_vectors +from compas.geometry import dot_vectors +from compas.geometry import normalize_vector +from compas.geometry import centroid_points +from compas.geometry import normal_polygon +from compas.geometry import length_vector_sqrd + +from compas.geometry import distance_point_point +from compas.geometry import distance_point_plane +from compas.geometry import distance_point_line +from compas.geometry import closest_point_on_segment + +from compas.geometry import area_triangle def is_colinear(a, b, c, tol=1e-6): @@ -451,7 +427,7 @@ def is_intersection_line_line(l1, l2, tol=1e-6): A tolerance for intersection verification. Returns - -------- + ------- bool True if the lines intersect in one point. False if the lines are skew, parallel or lie on top of each other. @@ -486,7 +462,7 @@ def is_intersection_segment_segment(s1, s2, tol=1e-6): A tolerance for intersection verification. Returns - -------- + ------- bool True if the segments intersect in one point. False if the segments are skew, parallel or lie on top of each other. diff --git a/src/compas/geometry/primitives/__init__.py b/src/compas/geometry/primitives/__init__.py index 77a4d64e85d..e69de29bb2d 100644 --- a/src/compas/geometry/primitives/__init__.py +++ b/src/compas/geometry/primitives/__init__.py @@ -1,21 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from ._primitive import Primitive # noqa: F401 - -from .vector import Vector # noqa: F401 -from .point import Point # noqa: F401 -from .line import Line # noqa: F401 -from .plane import Plane # noqa: F401 -from .quaternion import Quaternion # noqa: F401 -from .frame import Frame # noqa: F401 -from .polyline import Polyline # noqa: F401 -from .polygon import Polygon # noqa: F401 -from .circle import Circle # noqa: F401 -from .ellipse import Ellipse # noqa: F401 -from .curve import Bezier # noqa: F401 -from .arc import Arc # noqa: F401 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/primitives/_primitive.py b/src/compas/geometry/primitives/_primitive.py index 1c837d98071..d57289b5e74 100644 --- a/src/compas/geometry/primitives/_primitive.py +++ b/src/compas/geometry/primitives/_primitive.py @@ -2,7 +2,7 @@ from __future__ import division from __future__ import print_function -from ..geometry import Geometry +from compas.geometry import Geometry class Primitive(Geometry): diff --git a/src/compas/geometry/primitives/arc.py b/src/compas/geometry/primitives/arc.py index bf31845690d..7f295838917 100644 --- a/src/compas/geometry/primitives/arc.py +++ b/src/compas/geometry/primitives/arc.py @@ -1,8 +1,13 @@ +from __future__ import print_function +from __future__ import absolute_import +from __future__ import division + import math from compas.geometry import close -from compas.geometry.primitives import Frame -from compas.geometry.primitives import Primitive + +from ._primitive import Primitive +from .frame import Frame class Arc(Primitive): @@ -36,6 +41,17 @@ class Arc(Primitive): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "frame": Frame.JSONSCHEMA, + "radius": {"type": "number", "exclusiveMinimum": 0}, + "start": {"type": "number", "minimum": 0}, + "end": {"type": "number", "exclusiveMinimum": 0, "optional": True}, + }, + "required": ["frame", "radius", "start", "end"], + } + def __init__(self, frame=None, radius=None, end_angle=None, start_angle=None, **kwargs): super(Arc, self).__init__(**kwargs) @@ -50,7 +66,7 @@ def __init__(self, frame=None, radius=None, end_angle=None, start_angle=None, ** @property def data(self): return { - "frame": self._frame.data, + "frame": self._frame, "radius": self._radius, "start": self._start_angle, "end": self._end_angle, @@ -58,7 +74,7 @@ def data(self): @data.setter def data(self, value): - self._frame = Frame.from_data(value["frame"]) + self._frame = value["frame"] self._radius = value["radius"] self._start_angle = value["start"] self._end_angle = value["end"] diff --git a/src/compas/geometry/primitives/circle.py b/src/compas/geometry/primitives/circle.py index 6d22d342c16..17f2800b235 100644 --- a/src/compas/geometry/primitives/circle.py +++ b/src/compas/geometry/primitives/circle.py @@ -4,8 +4,8 @@ from math import pi -from compas.geometry.primitives import Primitive -from compas.geometry.primitives import Plane +from ._primitive import Primitive +from .plane import Plane class Circle(Primitive): @@ -44,6 +44,15 @@ class Circle(Primitive): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "plane": Plane.JSONSCHEMA, + "radius": {"type": "number", "exclusiveMinimum": 0}, + }, + "required": ["plane", "radius"], + } + __slots__ = ["_plane", "_radius"] def __init__(self, plane, radius, **kwargs): @@ -57,31 +66,14 @@ def __init__(self, plane, radius, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - import schema - - return schema.Schema( - { - "plane": Plane.DATASCHEMA.fget(None), - "radius": schema.And(float, lambda x: x > 0), - } - ) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "circle" - @property def data(self): """dict : The data dictionary that represents the circle.""" - return {"plane": self.plane.data, "radius": self.radius} + return {"plane": self.plane, "radius": self.radius} @data.setter def data(self, data): - self.plane = Plane.from_data(data["plane"]) + self.plane = data["plane"] self.radius = data["radius"] @classmethod @@ -105,7 +97,7 @@ def from_data(cls, data): >>> circle = Circle.from_data(data) """ - return cls(Plane.from_data(data["plane"]), data["radius"]) + return cls(data["plane"], data["radius"]) # ========================================================================== # properties diff --git a/src/compas/geometry/primitives/curve.py b/src/compas/geometry/primitives/curve.py index b3edf43d9f5..45fc5dc8220 100644 --- a/src/compas/geometry/primitives/curve.py +++ b/src/compas/geometry/primitives/curve.py @@ -4,9 +4,9 @@ from math import factorial -from compas.geometry.primitives import Primitive -from compas.geometry.primitives import Point -from compas.geometry.primitives import Vector +from ._primitive import Primitive +from .vector import Vector +from .point import Point def binomial_coefficient(n, k): @@ -104,6 +104,14 @@ class Bezier(Primitive): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "points": {"type": "array", "minItems": 2, "items": Point.JSONSCHEMA}, + }, + "required": ["points"], + } + __slots__ = ["_points"] def __init__(self, points): @@ -118,7 +126,7 @@ def __init__(self, points): @property def data(self): """dict : The data dictionary that represents the curve.""" - return {"points": [list(point) for point in self.points]} + return {"points": self.points} @data.setter def data(self, data): diff --git a/src/compas/geometry/primitives/ellipse.py b/src/compas/geometry/primitives/ellipse.py index a350953fabd..b8c7127fb2b 100644 --- a/src/compas/geometry/primitives/ellipse.py +++ b/src/compas/geometry/primitives/ellipse.py @@ -2,8 +2,8 @@ from __future__ import absolute_import from __future__ import division -from compas.geometry.primitives import Primitive -from compas.geometry.primitives import Plane +from ._primitive import Primitive +from .plane import Plane class Ellipse(Primitive): @@ -44,6 +44,16 @@ class Ellipse(Primitive): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "plane": Plane.JSONSCHEMA, + "major": {"type": "number", "exclusiveMinimum": 0}, + "minor": {"type": "number", "exclusiveMinimum": 0}, + }, + "required": ["plane", "major", "minor"], + } + __slots__ = ["_plane", "_major", "_minor"] def __init__(self, plane, major, minor, **kwargs): @@ -59,32 +69,14 @@ def __init__(self, plane, major, minor, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - import schema - - return schema.Schema( - { - "plane": Plane.DATASCHEMA.fget(None), - "major": schema.And(float, lambda x: x > 0), - "minor": schema.And(float, lambda x: x > 0), - } - ) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "ellipse" - @property def data(self): """dict : The data dictionary that represents the ellipse.""" - return {"plane": self.plane.data, "major": self.major, "minor": self.minor} + return {"plane": self.plane, "major": self.major, "minor": self.minor} @data.setter def data(self, data): - self.plane = Plane.from_data(data["plane"]) + self.plane = data["plane"] self.major = data["major"] self.minor = data["minor"] @@ -109,7 +101,7 @@ def from_data(cls, data): >>> ellipse = Ellipse.from_data(data) """ - return cls(Plane.from_data(data["plane"]), data["minor"], data["minor"]) + return cls(data["plane"], data["minor"], data["minor"]) # ========================================================================== # properties diff --git a/src/compas/geometry/primitives/frame.py b/src/compas/geometry/primitives/frame.py index d6b427f7d73..cf055a80a56 100644 --- a/src/compas/geometry/primitives/frame.py +++ b/src/compas/geometry/primitives/frame.py @@ -15,12 +15,13 @@ from compas.geometry import matrix_from_quaternion from compas.geometry import quaternion_from_matrix from compas.geometry import subtract_vectors + from compas.geometry import Transformation -from compas.geometry.primitives import Point -from compas.geometry.primitives import Primitive -from compas.geometry.primitives import Quaternion -from compas.geometry.primitives import Vector +from ._primitive import Primitive +from .vector import Vector +from .point import Point +from .quaternion import Quaternion class Frame(Primitive): @@ -66,6 +67,16 @@ class Frame(Primitive): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "point": Point.JSONSCHEMA, + "xaxis": Vector.JSONSCHEMA, + "yaxis": Vector.JSONSCHEMA, + }, + "required": ["point", "xaxis", "yaxis"], + } + def __init__(self, point, xaxis, yaxis, **kwargs): super(Frame, self).__init__(**kwargs) self._point = None @@ -79,38 +90,20 @@ def __init__(self, point, xaxis, yaxis, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - from schema import Schema - - return Schema( - { - "point": Point.DATASCHEMA.fget(None), - "xaxis": Vector.DATASCHEMA.fget(None), - "yaxis": Vector.DATASCHEMA.fget(None), - } - ) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "frame" - @property def data(self): """dict : The data dictionary that represents the frame.""" return { - "point": self.point.data, - "xaxis": self.xaxis.data, - "yaxis": self.yaxis.data, + "point": self.point, + "xaxis": self.xaxis, + "yaxis": self.yaxis, } @data.setter def data(self, data): - self.point = Point.from_data(data["point"]) - self.xaxis = Vector.from_data(data["xaxis"]) - self.yaxis = Vector.from_data(data["yaxis"]) + self.point = data["point"] + self.xaxis = data["xaxis"] + self.yaxis = data["yaxis"] @classmethod def from_data(cls, data): @@ -138,11 +131,7 @@ def from_data(cls, data): Vector(0.000, 1.000, 0.000) """ - frame = cls( - Point.from_data(data["point"]), - Vector.from_data(data["xaxis"]), - Vector.from_data(data["yaxis"]), - ) + frame = cls(data["point"], data["xaxis"], data["yaxis"]) return frame # ========================================================================== @@ -175,9 +164,9 @@ def yaxis(self): def yaxis(self, vector): yaxis = Vector(*vector) yaxis.unitize() - zaxis = Vector.cross(self.xaxis, yaxis) + zaxis = Vector(*cross_vectors(self.xaxis, yaxis)) zaxis.unitize() - self._yaxis = Vector.cross(zaxis, self.xaxis) + self._yaxis = Vector(*cross_vectors(zaxis, self.xaxis)) @property def normal(self): diff --git a/src/compas/geometry/primitives/line.py b/src/compas/geometry/primitives/line.py index 798ee4a3f5b..f900a07f2b3 100644 --- a/src/compas/geometry/primitives/line.py +++ b/src/compas/geometry/primitives/line.py @@ -2,8 +2,8 @@ from __future__ import absolute_import from __future__ import division -from compas.geometry.primitives import Primitive -from compas.geometry.primitives import Point +from ._primitive import Primitive +from .point import Point class Line(Primitive): @@ -47,6 +47,15 @@ class Line(Primitive): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "start": Point.JSONSCHEMA, + "end": Point.JSONSCHEMA, + }, + "required": ["start", "end"], + } + __slots__ = ["_start", "_end"] def __init__(self, p1, p2, **kwargs): @@ -60,27 +69,15 @@ def __init__(self, p1, p2, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - from schema import Schema - - return Schema({"start": Point.DATASCHEMA.fget(None), "end": Point.DATASCHEMA.fget(None)}) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "line" - @property def data(self): """dict : The data dictionary that represents the line.""" - return {"start": self.start.data, "end": self.end.data} + return {"start": self.start, "end": self.end} @data.setter def data(self, data): - self.start = Point.from_data(data["start"]) - self.end = Point.from_data(data["end"]) + self.start = data["start"] + self.end = data["end"] @classmethod def from_data(cls, data): @@ -98,7 +95,7 @@ def from_data(cls, data): Point(1.000, 0.000, 0.000) """ - return cls(Point.from_data(data["start"]), Point.from_data(data["end"])) + return cls(data["start"], data["end"]) # ========================================================================== # properties diff --git a/src/compas/geometry/primitives/plane.py b/src/compas/geometry/primitives/plane.py index 84988b9e0d3..dc57e6ae2de 100644 --- a/src/compas/geometry/primitives/plane.py +++ b/src/compas/geometry/primitives/plane.py @@ -1,11 +1,13 @@ -from __future__ import print_function from __future__ import absolute_import from __future__ import division +from __future__ import print_function from math import sqrt -from compas.geometry.primitives import Primitive -from compas.geometry.primitives import Vector -from compas.geometry.primitives import Point + +from compas.geometry import cross_vectors +from ._primitive import Primitive +from .vector import Vector +from .point import Point class Plane(Primitive): @@ -39,6 +41,15 @@ class Plane(Primitive): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "point": Point.JSONSCHEMA, + "normal": Vector.JSONSCHEMA, + }, + "required": ["point", "normal"], + } + __slots__ = ["_point", "_normal"] def __init__(self, point, normal, **kwargs): @@ -52,32 +63,15 @@ def __init__(self, point, normal, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - from schema import Schema - - return Schema( - { - "point": Point.DATASCHEMA.fget(None), - "normal": Vector.DATASCHEMA.fget(None), - } - ) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "plane" - @property def data(self): """dict : The data dictionary that represents the plane.""" - return {"point": self.point.data, "normal": self.normal.data} + return {"point": self.point, "normal": self.normal} @data.setter def data(self, data): - self.point = Point.from_data(data["point"]) - self.normal = Vector.from_data(data["normal"]) + self.point = data["point"] + self.normal = data["normal"] @classmethod def from_data(cls, data): @@ -102,7 +96,7 @@ def from_data(cls, data): Vector(0.000, 0.000, 1.000) """ - return cls(Point.from_data(data["point"]), Vector.from_data(data["normal"])) + return cls(data["point"], data["normal"]) # ========================================================================== # properties @@ -204,7 +198,7 @@ def from_three_points(cls, a, b, c): a = Point(*a) b = Point(*b) c = Point(*c) - normal = Vector.cross(b - a, c - a) + normal = Vector(*cross_vectors(b - a, c - a)) return cls(a, normal) @classmethod @@ -228,14 +222,14 @@ def from_point_and_two_vectors(cls, point, u, v): Examples -------- - >>> plane = Plane.from_three_points([0.0, 0.0, 0.0], [2.0, 1.0, 0.0], [0.0, 3.0, 0.0]) + >>> plane = Plane.from_point_and_two_vectors([0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0]) >>> plane.point Point(0.000, 0.000, 0.000) >>> plane.normal Vector(0.000, 0.000, 1.000) """ - normal = Vector.cross(u, v) + normal = Vector(*cross_vectors(u, v)) return cls(point, normal) def from_abcd(cls, abcd): diff --git a/src/compas/geometry/primitives/point.py b/src/compas/geometry/primitives/point.py index 4fd46d91b3d..4e9fca77c36 100644 --- a/src/compas/geometry/primitives/point.py +++ b/src/compas/geometry/primitives/point.py @@ -6,7 +6,6 @@ from compas.geometry import centroid_points from compas.geometry import normal_polygon - from compas.geometry import distance_point_point from compas.geometry import distance_point_line from compas.geometry import distance_point_plane @@ -19,11 +18,10 @@ from compas.geometry import is_point_in_polygon_xy from compas.geometry import is_point_in_convex_polygon_xy from compas.geometry import is_point_behind_plane - from compas.geometry import transform_points -from compas.geometry.primitives import Primitive -from compas.geometry.primitives import Vector +from ._primitive import Primitive +from .vector import Vector class Point(Primitive): @@ -105,6 +103,13 @@ class Point(Primitive): """ + JSONSCHEMA = { + "type": "array", + "minItems": 3, + "maxItems": 3, + "items": {"type": "number"}, + } + __slots__ = ["_x", "_y", "_z"] def __init__(self, x, y, z=0.0, **kwargs): @@ -120,19 +125,6 @@ def __init__(self, x, y, z=0.0, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - from schema import Schema - from compas.data import is_float3 - - return Schema(is_float3) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "point" - @property def data(self): """dict : The data representing the point.""" diff --git a/src/compas/geometry/primitives/polygon.py b/src/compas/geometry/primitives/polygon.py index 79e163668fe..126b22edf79 100644 --- a/src/compas/geometry/primitives/polygon.py +++ b/src/compas/geometry/primitives/polygon.py @@ -12,13 +12,13 @@ from compas.geometry import is_polygon_convex from compas.geometry import transform_points -from compas.geometry.primitives import Line -from compas.geometry.primitives import Point -from compas.geometry.primitives import Primitive -from compas.geometry.primitives import Vector - from compas.utilities import pairwise +from ._primitive import Primitive +from .line import Line +from .point import Point +from .vector import Vector + class Polygon(Primitive): """A polygon is defined by a sequence of points forming a closed loop. @@ -64,6 +64,12 @@ class Polygon(Primitive): """ + JSONSCHEMA = { + "type": "object", + "properties": {"points": {"type": "array", "minItems": 2, "items": Point.JSONSCHEMA}}, + "required": ["points"], + } + __slots__ = ["_points", "_lines"] def __init__(self, points, **kwargs): @@ -76,27 +82,14 @@ def __init__(self, points, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - from schema import Schema - from compas.data import is_float3 - - return Schema({"points": lambda points: all(is_float3(point) for point in points)}) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "polygon" - @property def data(self): """dict : The data dictionary that represents the polygon.""" - return {"points": [point.data for point in self.points]} + return {"points": self.points} @data.setter def data(self, data): - self.points = [Point.from_data(point) for point in data["points"]] + self.points = data["points"] @classmethod def from_data(cls, data): @@ -119,7 +112,7 @@ def from_data(cls, data): Point(0.000, 0.000, 0.000) """ - return cls([Point.from_data(point) for point in data["points"]]) + return cls(data["points"]) # ========================================================================== # properties diff --git a/src/compas/geometry/primitives/polyline.py b/src/compas/geometry/primitives/polyline.py index 96b71eb7603..4760eb1f5f2 100644 --- a/src/compas/geometry/primitives/polyline.py +++ b/src/compas/geometry/primitives/polyline.py @@ -4,14 +4,13 @@ from compas.geometry import allclose from compas.geometry import transform_points - -from compas.geometry.predicates import is_point_on_line -from compas.geometry.primitives import Line -from compas.geometry.primitives import Primitive -from compas.geometry.primitives import Point - +from compas.geometry import is_point_on_line from compas.utilities import pairwise +from ._primitive import Primitive +from .point import Point +from .line import Line + class Polyline(Primitive): """A polyline is defined by a sequence of points connected by line segments. @@ -56,6 +55,12 @@ class Polyline(Primitive): """ + JSONSCHEMA = { + "type": "object", + "properties": {"points": {"type": "array", "minItems": 2, "items": Point.JSONSCHEMA}}, + "required": ["points"], + } + __slots__ = ["_points", "_lines"] def __init__(self, points, **kwargs): @@ -68,27 +73,14 @@ def __init__(self, points, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - from schema import Schema - from compas.data import is_float3 - - return Schema({"points": lambda points: all(is_float3(point) for point in points)}) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "polyline" - @property def data(self): """dict : Returns the data dictionary that represents the polyline.""" - return {"points": [point.data for point in self.points]} + return {"points": self.points} @data.setter def data(self, data): - self.points = [Point.from_data(point) for point in data["points"]] + self.points = data["points"] @classmethod def from_data(cls, data): @@ -110,7 +102,7 @@ def from_data(cls, data): Polyline([Point(0.000, 0.000, 0.000), Point(1.000, 0.000, 0.000), Point(1.000, 1.000, 0.000)]) """ - return cls([Point.from_data(point) for point in data["points"]]) + return cls(data["points"]) # ========================================================================== # properties @@ -352,6 +344,13 @@ def divide_polyline(self, num_segments): list list[:class:`~compas.geometry.Point`] + Examples + -------- + >>> polyline = Polyline([(0, 0, 0), (1, 1, 0), (2, 3, 0), (4, 4, 0), (5, 2, 0)]) + >>> divided_polylines = polyline.divide(3) + >>> divided_polyline + [Point(0.000, 0.000, 0.000), Point(1.578, 2.157, 0.000), Point(3.578, 3.789, 0.000), Point(5.000, 2.000, 0.000)] + """ segment_length = self.length / num_segments return self.divide_polyline_by_length(segment_length, False) @@ -359,7 +358,7 @@ def divide_polyline(self, num_segments): divide = divide_polyline def divide_polyline_by_length(self, length, strict=True, tol=1e-06): - """Splits a polyline in segments of a given length. + """Divide a polyline in segments of a given length. Parameters ---------- @@ -379,6 +378,18 @@ def divide_polyline_by_length(self, length, strict=True, tol=1e-06): The points of the new polyline are constrained to the segments of the old polyline. However, since the old points are not part of the new set of points, the geometry of the polyline will change. + Examples + -------- + >>> polyline = Polyline([(0, 0, 0), (1, 1, 0), (2, 3, 0), (4, 4, 0), (5, 2, 0)]) + >>> divided_polylines = polyline.divide_by_length(3) + >>> divided_polyline + [Point(0.000, 0.000, 0.000), Point(1.709, 2.418, 0.000), Point(4.051, 3.898, 0.000)] + + >>> polyline = Polyline([(0, 0, 0), (1, 1, 0), (2, 3, 0), (4, 4, 0), (5, 2, 0)]) + >>> divided_polylines = polyline.divide_by_length(3, strict=False) + >>> divided_polyline + [Point(0.000, 0.000, 0.000), Point(1.709, 2.418, 0.000), Point(4.051, 3.898, 0.000), Point(5.000, 2.000, 0.000)] + """ num_pts = int(self.length / length) total_length = [0, 0] @@ -412,11 +423,110 @@ def divide_polyline_by_length(self, length, strict=True, tol=1e-06): divide_by_length = divide_polyline_by_length + def split_polyline_by_length(self, length, strict=True): + """Split a polyline in segments of a given length. + + Parameters + ---------- + length : float + Length of the segments. + strict : bool, optional + If False, the remainder segment will be added even if it is smaller than the desired length + tol : float, optional + Floating point error tolerance. + + Returns + ------- + list[:class:`~compas.geometry.Polyline`] + + Examples + -------- + >>> from compas.geometry import Polyline + >>> polyline = Polyline([(0, 0, 0), (1, 1, 0), (2, 3, 0), (4, 4, 0), (5, 2, 0)]) + >>> split_polylines = polyline.split_polyline_by_length(3) + >>> split_polylines + [Polyline([Point(0.000, 0.000, 0.000), Point(1.000, 1.000, 0.000), Point(1.709, 2.418, 0.000)]),\ + Polyline([Point(1.709, 2.418, 0.000), Point(2.000, 3.000, 0.000), Point(4.000, 4.000, 0.000),\ + Point(4.051, 3.898, 0.000)])] + + >>> from compas.geometry import Polyline + >>> polyline = Polyline([(0, 0, 0), (1, 1, 0), (2, 3, 0), (4, 4, 0), (5, 2, 0)]) + >>> split_polylines = polyline.split_polyline_by_length(3, strict=False) + >>> split_polylines + [Polyline([Point(0.000, 0.000, 0.000), Point(1.000, 1.000, 0.000), Point(1.709, 2.418, 0.000)]),\ + Polyline([Point(1.709, 2.418, 0.000), Point(2.000, 3.000, 0.000), Point(4.000, 4.000, 0.000),\ + Point(4.051, 3.898, 0.000)]), Polyline([Point(4.051, 3.898, 0.000), Point(5.000, 2.000, 0.000)])] + + """ + if length <= 0: + raise ValueError("Length should be bigger than 0.") + elif length > self.length: + raise ValueError("Polyline length {0} is smaller than input length {1}.".format(self.length, length)) + divided_polylines = [] + polyline_copy = self.copy() + segment = Polyline([self[0]]) # Start a new segment + i, current_length = 0, 0 + polyline_points_num = len(polyline_copy) + while i < polyline_points_num - 1: + pt1, pt2 = polyline_copy.points[i : i + 2] + line_length = pt1.distance_to_point(pt2) + current_length += line_length + if current_length <= length: + segment.points.append(pt2) + i += 1 + else: + amp = 1 - ((current_length - length) / line_length) + new_pt = pt1 + (pt2 - pt1).scaled(amp) + polyline_copy.points.insert(i + 1, new_pt) + segment.points.append(new_pt) + divided_polylines.append(segment) + segment = Polyline([new_pt]) # Start a new segment + current_length = 0 + i += 1 + polyline_points_num = len(polyline_copy) + if not strict and len(divided_polylines): + divided_polylines.append(segment) # Add the last segment + return divided_polylines + + split_by_length = split_polyline_by_length + + def split_polyline(self, num_segments): + """Split a polyline in equal segments. + + Parameters + ---------- + num_segments : int + + Returns + ------- + list + list[:class:`~compas.geometry.Polyline`] + + Examples + -------- + >>> from compas.geometry import Polyline + >>> polyline = Polyline([(0, 0, 0), (1, 1, 0), (2, 3, 0), (4, 4, 0), (5, 2, 0)]) + >>> split_polylines = polyline.split_polyline(3) + >>> split_polylines + [Polyline([Point(0.000, 0.000, 0.000), Point(1.000, 1.000, 0.000), Point(1.578, 2.157, 0.000)]),\ + Polyline([Point(1.578, 2.157, 0.000), Point(2.000, 3.000, 0.000), Point(3.578, 3.789, 0.000)]),\ + Polyline([Point(3.578, 3.789, 0.000), Point(4.000, 4.000, 0.000), Point(5.000, 2.000, 0.000)])] + """ + if num_segments < 1: + raise ValueError("Number of segments must be greater than or equal to 1.") + elif num_segments == 1: + return [self] + total_length = self.length + segment_length = total_length / num_segments + return self.split_polyline_by_length(segment_length, False) + + split = split_polyline + def extend(self, length): """Extends a polyline by a given length, by modifying the first and/or last point tangentially. - Parameters: - ----------- + Parameters + ---------- length: float or tuple[float, float] A single length value to extend the polyline only at the end, or two length values to extend at both ends. @@ -436,8 +546,8 @@ def extend(self, length): def extended(self, length): """Returns a copy of this polyline extended by a given length. - Parameters: - ----------- + Parameters + ---------- length: float or tuple[float, float] A single length value to extend the polyline only at the end, or two length values to extend at both ends. @@ -454,8 +564,8 @@ def extended(self, length): def shorten(self, length): """Shortens a polyline by a given length. - Parameters: - ----------- + Parameters + ---------- length: float or tuple[float, float] A single length value to shorten the polyline only at the end, or two length values to shorten at both ends. @@ -497,8 +607,8 @@ def shorten(self, length): def shortened(self, length): """Returns a copy of this polyline shortened by a given length. - Parameters: - ----------- + Parameters + ---------- length: float or tuple[float, float] A single length value to shorten the polyline only at the end, or two length values to shorten at both ends. diff --git a/src/compas/geometry/primitives/quaternion.py b/src/compas/geometry/primitives/quaternion.py index d9b14e5dbcc..f1c7d9a0965 100644 --- a/src/compas/geometry/primitives/quaternion.py +++ b/src/compas/geometry/primitives/quaternion.py @@ -12,7 +12,7 @@ from compas.geometry import quaternion_is_unit from compas.geometry import quaternion_from_matrix -from compas.geometry.primitives import Primitive +from ._primitive import Primitive class Quaternion(Primitive): @@ -111,6 +111,17 @@ class Quaternion(Primitive): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "w": {"type": "number"}, + "x": {"type": "number"}, + "y": {"type": "number"}, + "z": {"type": "number"}, + }, + "required": ["w", "x", "y", "z"], + } + __slots__ = ["_w", "_x", "_y", "_z"] def __init__(self, w, x, y, z, **kwargs): @@ -128,18 +139,6 @@ def __init__(self, w, x, y, z, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - from schema import Schema - - return Schema({"w": float, "x": float, "y": float, "z": float}) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "quaternion" - @property def data(self): """dict : Representation of the quaternion as a dict containing only native Python objects.""" @@ -348,8 +347,8 @@ def from_matrix(cls, M): :class:`~compas.geometry.Quaternion` The new quaternion. - Example - ------- + Examples + -------- >>> from compas.geometry import matrix_from_euler_angles >>> ea = [0.2, 0.6, 0.2] >>> M = matrix_from_euler_angles(ea) @@ -372,8 +371,8 @@ def from_rotation(cls, R): :class:`~compas.geometry.Quaternion` The new quaternion. - Example - ------- + Examples + -------- >>> from compas.geometry import Frame, Rotation >>> R = Rotation.from_frame(Frame.worldYZ()) >>> Quaternion.from_rotation(R) diff --git a/src/compas/geometry/primitives/vector.py b/src/compas/geometry/primitives/vector.py index f7ca259941c..a35fc423630 100644 --- a/src/compas/geometry/primitives/vector.py +++ b/src/compas/geometry/primitives/vector.py @@ -13,7 +13,7 @@ from compas.geometry import angles_vectors from compas.geometry import transform_vectors -from compas.geometry.primitives import Primitive +from ._primitive import Primitive class Vector(Primitive): @@ -66,6 +66,13 @@ class Vector(Primitive): """ + JSONSCHEMA = { + "type": "array", + "minItems": 3, + "maxItems": 3, + "items": {"type": "number"}, + } + __slots__ = ["_x", "_y", "_z"] def __init__(self, x, y, z=0.0, **kwargs): @@ -81,19 +88,6 @@ def __init__(self, x, y, z=0.0, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - from schema import Schema - from compas.data import is_float3 - - return Schema(is_float3) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "vector" - @property def data(self): """dict : The data dictionary that represents the vector.""" @@ -628,7 +622,8 @@ def cross_vectors(left, right): [Vector(0.000, 0.000, 1.000), Vector(0.000, -4.000, 0.000)] """ - return [Vector.cross(u, v) for u, v in zip(left, right)] + # cross_vectors(u,v) from src\compas\geometry\_core\_algebra.py + return [Vector(*cross_vectors(u, v)) for u, v in zip(left, right)] @staticmethod def angles_vectors(left, right): diff --git a/src/compas/geometry/quadmesh/__init__.py b/src/compas/geometry/quadmesh/__init__.py index 7b91d26504b..e69de29bb2d 100644 --- a/src/compas/geometry/quadmesh/__init__.py +++ b/src/compas/geometry/quadmesh/__init__.py @@ -1,8 +0,0 @@ -from __future__ import print_function -from __future__ import absolute_import -from __future__ import division - -from .planarization import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/quadmesh/planarization.py b/src/compas/geometry/quadmesh/planarization.py index 526a8cdc021..85d904db9a8 100644 --- a/src/compas/geometry/quadmesh/planarization.py +++ b/src/compas/geometry/quadmesh/planarization.py @@ -5,9 +5,6 @@ from compas.plugins import pluggable -__all__ = ["quadmesh_planarize"] - - @pluggable(category="quadmesh") def quadmesh_planarize(M, kmax=500, maxdev=0.005): """Planarize the faces of a quad mesh. diff --git a/src/compas/geometry/shapes/__init__.py b/src/compas/geometry/shapes/__init__.py index 6b393c2f096..e69de29bb2d 100644 --- a/src/compas/geometry/shapes/__init__.py +++ b/src/compas/geometry/shapes/__init__.py @@ -1,13 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from ._shape import Shape # noqa: F401 - -from .box import Box # noqa: F401 -from .capsule import Capsule # noqa: F401 -from .cone import Cone # noqa: F401 -from .cylinder import Cylinder # noqa: F401 -from .polyhedron import Polyhedron # noqa: F401 -from .sphere import Sphere # noqa: F401 -from .torus import Torus # noqa: F401 diff --git a/src/compas/geometry/shapes/_shape.py b/src/compas/geometry/shapes/_shape.py index 10006e02e86..a00e454e068 100644 --- a/src/compas/geometry/shapes/_shape.py +++ b/src/compas/geometry/shapes/_shape.py @@ -3,7 +3,7 @@ from __future__ import division import abc -from ..geometry import Geometry +from compas.geometry import Geometry class Shape(Geometry): diff --git a/src/compas/geometry/shapes/box.py b/src/compas/geometry/shapes/box.py index 1a6260999ba..97564ecb06c 100644 --- a/src/compas/geometry/shapes/box.py +++ b/src/compas/geometry/shapes/box.py @@ -96,6 +96,20 @@ class Box(Shape): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "frame": Frame.JSONSCHEMA, + "xsize": {"type": "number", "exclusiveMinimum": 0}, + "ysize": {"type": "number", "exclusiveMinimum": 0}, + "zsize": {"type": "number", "exclusiveMinimum": 0}, + }, + "additionalProperties": False, + "minProperties": 4, + } + + __slots__ = ["_frame", "_xsize", "_ysize", "_zsize"] + def __init__(self, frame, xsize, ysize, zsize, **kwargs): super(Box, self).__init__(**kwargs) self._frame = None @@ -111,30 +125,11 @@ def __init__(self, frame, xsize, ysize, zsize, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - import schema - - return schema.Schema( - { - "frame": Frame.DATASCHEMA.fget(None), - "xsize": schema.And(float, lambda x: x > 0), - "ysize": schema.And(float, lambda x: x > 0), - "zsize": schema.And(float, lambda x: x > 0), - } - ) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "box" - @property def data(self): """dict : Returns the data dictionary that represents the box.""" return { - "frame": self.frame.data, + "frame": self.frame, "xsize": self.xsize, "ysize": self.ysize, "zsize": self.zsize, @@ -142,7 +137,7 @@ def data(self): @data.setter def data(self, data): - self.frame = Frame.from_data(data["frame"]) + self.frame = data["frame"] self.xsize = data["xsize"] self.ysize = data["ysize"] self.zsize = data["zsize"] @@ -166,7 +161,7 @@ def from_data(cls, data): >>> data = {'frame': Frame.worldXY().data, 'xsize': 1.0, 'ysize': 1.0, 'zsize': 1.0} >>> box = Box.from_data(data) """ - return cls(Frame.from_data(data["frame"]), data["xsize"], data["ysize"], data["zsize"]) + return cls(data["frame"], data["xsize"], data["ysize"], data["zsize"]) # ========================================================================== # properties diff --git a/src/compas/geometry/shapes/capsule.py b/src/compas/geometry/shapes/capsule.py index 91dce82025e..5ea4532d3ff 100644 --- a/src/compas/geometry/shapes/capsule.py +++ b/src/compas/geometry/shapes/capsule.py @@ -49,6 +49,15 @@ class Capsule(Shape): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "line": Line.JSONSCHEMA, + "radius": {"type": "number", "exclusiveMinimum": 0}, + }, + "required": ["line", "radius"], + } + __slots__ = ["_line", "_radius"] def __init__(self, line, radius, **kwargs): @@ -62,31 +71,14 @@ def __init__(self, line, radius, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - import schema - - return schema.Schema( - { - "line": Line.DATASCHEMA.fget(None), - "radius": schema.And(float, lambda x: x > 0), - } - ) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "capsule" - @property def data(self): """dict : Returns the data dictionary that represents the capsule.""" - return {"line": self.line.data, "radius": self.radius} + return {"line": self.line, "radius": self.radius} @data.setter def data(self, data): - self.line = Line.from_data(data["line"]) + self.line = data["line"] self.radius = data["radius"] @classmethod @@ -104,7 +96,7 @@ def from_data(cls, data): The constructed capsule. """ - capsule = Capsule(Line.from_data(data["line"]), data["radius"]) + capsule = Capsule(data["line"], data["radius"]) return capsule # ========================================================================== diff --git a/src/compas/geometry/shapes/cone.py b/src/compas/geometry/shapes/cone.py index 30ed322b2fa..a0b8fa18c21 100644 --- a/src/compas/geometry/shapes/cone.py +++ b/src/compas/geometry/shapes/cone.py @@ -8,7 +8,6 @@ from math import sqrt from compas.utilities import pairwise - from compas.geometry import matrix_from_frame from compas.geometry import transform_points from compas.geometry import Circle @@ -59,6 +58,15 @@ class Cone(Shape): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "circle": Circle.JSONSCHEMA, + "height": {"type": "number", "exclusiveMinimum": 0}, + }, + "required": ["circle", "height"], + } + __slots__ = ["_circle", "_height"] def __init__(self, circle, height, **kwargs): @@ -72,34 +80,14 @@ def __init__(self, circle, height, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - import schema - - return schema.Schema( - { - "circle": { - "plane": Plane.DATASCHEMA.fget(None), - "radius": schema.And(float, lambda x: x > 0), - }, - "height": schema.And(float, lambda x: x > 0), - } - ) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "cone" - @property def data(self): """dict : Returns the data dictionary that represents the cone.""" - return {"circle": self.circle.data, "height": self.height} + return {"circle": self.circle, "height": self.height} @data.setter def data(self, data): - self.circle = Circle.from_data(data["circle"]) + self.circle = data["circle"] self.height = data["height"] @classmethod @@ -125,7 +113,7 @@ def from_data(cls, data): >>> cone = Cone.from_data(data) """ - cone = cls(Circle.from_data(data["circle"]), data["height"]) + cone = cls(data["circle"], data["height"]) return cone # ========================================================================== diff --git a/src/compas/geometry/shapes/cylinder.py b/src/compas/geometry/shapes/cylinder.py index 67dcb08ead5..38e8537081a 100644 --- a/src/compas/geometry/shapes/cylinder.py +++ b/src/compas/geometry/shapes/cylinder.py @@ -56,6 +56,15 @@ class Cylinder(Shape): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "circle": Circle.JSONSCHEMA, + "height": {"type": "number", "exclusiveMinimum": 0}, + }, + "required": ["circle", "height"], + } + __slots__ = ["_circle", "_height"] def __init__(self, circle, height, **kwargs): @@ -69,34 +78,14 @@ def __init__(self, circle, height, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - import schema - - return schema.Schema( - { - "circle": { - "plane": Plane.DATASCHEMA.fget(None), - "radius": schema.And(float, lambda x: x > 0), - }, - "height": schema.And(float, lambda x: x > 0), - } - ) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "cylinder" - @property def data(self): """dict : Returns the data dictionary that represents the cylinder.""" - return {"circle": self.circle.data, "height": self.height} + return {"circle": self.circle, "height": self.height} @data.setter def data(self, data): - self.circle = Circle.from_data(data["circle"]) + self.circle = data["circle"] self.height = data["height"] @classmethod @@ -122,7 +111,7 @@ def from_data(cls, data): >>> cylinder = Cylinder.from_data(data) """ - cylinder = cls(Circle.from_data(data["circle"]), data["height"]) + cylinder = cls(data["circle"], data["height"]) return cylinder # ========================================================================== diff --git a/src/compas/geometry/shapes/polyhedron.py b/src/compas/geometry/shapes/polyhedron.py index 33e6b7cb995..f13dad7c42e 100644 --- a/src/compas/geometry/shapes/polyhedron.py +++ b/src/compas/geometry/shapes/polyhedron.py @@ -3,6 +3,7 @@ from __future__ import division from math import sqrt + from compas.geometry import transform_points from compas.geometry import centroid_polygon from compas.utilities import pairwise @@ -167,6 +168,32 @@ class Polyhedron(Shape): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "vertices": { + "type": "array", + "minItems": 4, + "items": { + "type": "array", + "minItems": 3, + "maxItems": 3, + "items": {"type": "number"}, + }, + }, + "faces": { + "type": "array", + "minItems": 4, + "items": { + "type": "array", + "minItems": 3, + "items": {"type": "integer", "minimum": 0}, + }, + }, + }, + "required": ["vertices", "faces"], + } + __slots__ = ["_vertices", "_faces"] def __init__(self, vertices, faces, **kwargs): @@ -180,24 +207,6 @@ def __init__(self, vertices, faces, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - import schema - from compas.data import is_float3, is_sequence_of_int - - return schema.Schema( - { - "vertices": lambda items: all(is_float3(item) for item in items), - "faces": lambda items: all(is_sequence_of_int(item) for item in items), - } - ) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "polyhedron" - @property def data(self): """dict : Returns the data dictionary that represents the polyhedron.""" diff --git a/src/compas/geometry/shapes/sphere.py b/src/compas/geometry/shapes/sphere.py index a6dade3bab3..6eabd732617 100644 --- a/src/compas/geometry/shapes/sphere.py +++ b/src/compas/geometry/shapes/sphere.py @@ -51,6 +51,15 @@ class Sphere(Shape): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "point": Point.JSONSCHEMA, + "radius": {"type": "number", "exclusiveMinimum": 0}, + }, + "required": ["point", "radius"], + } + __slots__ = ["_point", "_radius"] def __init__(self, point, radius, **kwargs): @@ -72,19 +81,14 @@ def DATASCHEMA(self): return schema.Schema({"point": is_float3, "radius": schema.And(float, lambda x: x > 0)}) - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "sphere" - @property def data(self): """dict : Returns the data dictionary that represents the sphere.""" - return {"point": self.point.data, "radius": self.radius} + return {"point": self.point, "radius": self.radius} @data.setter def data(self, data): - self.point = Point.from_data(data["point"]) + self.point = data["point"] self.radius = data["radius"] @classmethod @@ -108,7 +112,7 @@ def from_data(cls, data): >>> sphere = Sphere.from_data(data) """ - sphere = cls(Point.from_data(data["point"]), data["radius"]) + sphere = cls(data["point"], data["radius"]) return sphere # ========================================================================== diff --git a/src/compas/geometry/shapes/torus.py b/src/compas/geometry/shapes/torus.py index c8cee95683e..15607347994 100644 --- a/src/compas/geometry/shapes/torus.py +++ b/src/compas/geometry/shapes/torus.py @@ -56,6 +56,16 @@ class Torus(Shape): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "plane": Plane.JSONSCHEMA, + "radius_axis": {"type": "number", "exclusiveMinimum": 0}, + "radius_pipe": {"type": "number", "exclusiveMinimum": 0}, + }, + "required": ["plane", "radius_axis", "radius_pipe"], + } + __slots__ = ["_plane", "_radius_axis", "_radius_pipe"] def __init__(self, plane, radius_axis, radius_pipe, **kwargs): @@ -71,36 +81,18 @@ def __init__(self, plane, radius_axis, radius_pipe, **kwargs): # data # ========================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : Schema of the data representation.""" - import schema - - return schema.Schema( - { - "plane": Plane.DATASCHEMA.fget(None), - "radius_axis": schema.And(float, lambda x: x > 0), - "radius_pipe": schema.And(float, lambda x: x > 0), - } - ) - - @property - def JSONSCHEMANAME(self): - """str : Name of the schema of the data representation in JSON format.""" - return "torus" - @property def data(self): """dict : Returns the data dictionary that represents the torus.""" return { - "plane": self.plane.data, + "plane": self.plane, "radius_axis": self.radius_axis, "radius_pipe": self.radius_pipe, } @data.setter def data(self, data): - self.plane = Plane.from_data(data["plane"]) + self.plane = data["plane"] self.radius_axis = data["radius_axis"] self.radius_pipe = data["radius_pipe"] @@ -125,7 +117,7 @@ def from_data(cls, data): >>> torus = Torus.from_data(data) """ - torus = cls(Plane.from_data(data["plane"]), data["radius_axis"], data["radius_pipe"]) + torus = cls(data["plane"], data["radius_axis"], data["radius_pipe"]) return torus # ========================================================================== diff --git a/src/compas/geometry/surfaces/__init__.py b/src/compas/geometry/surfaces/__init__.py index fd13c21f91a..e69de29bb2d 100644 --- a/src/compas/geometry/surfaces/__init__.py +++ b/src/compas/geometry/surfaces/__init__.py @@ -1,4 +0,0 @@ -from __future__ import absolute_import - -from .surface import Surface # noqa F401 -from .nurbs import NurbsSurface # noqa: F401 diff --git a/src/compas/geometry/surfaces/nurbs.py b/src/compas/geometry/surfaces/nurbs.py index cd58634fd1e..13ed815922f 100644 --- a/src/compas/geometry/surfaces/nurbs.py +++ b/src/compas/geometry/surfaces/nurbs.py @@ -64,6 +64,24 @@ class NurbsSurface(Surface): """ + JSONSCHEMA = { + "type": "object", + "properties": { + "points": {"type": "array", "items": {"type": "array", "items": Point.JSONSCHEMA}}, + "weights": {"type": "array", "items": {"type": "array", "items": {"type": "number"}}}, + "u_knots": {"type": "array", "items": {"type": "number"}}, + "v_knots": {"type": "array", "items": {"type": "number"}}, + "u_mults": {"type": "array", "items": {"type": "integer"}}, + "v_mults": {"type": "array", "items": {"type": "integer"}}, + "u_degree": {"type": "integer", "exclusiveMinimum": 0}, + "v_degree": {"type": "integer", "exclusiveMinimum": 0}, + "is_u_periodic": {"type": "boolean"}, + "is_v_periodic": {"type": "boolean"}, + }, + "additionalProperties": False, + "minProperties": 10, + } + def __new__(cls, *args, **kwargs): return new_nurbssurface(cls, *args, **kwargs) @@ -93,34 +111,6 @@ def __str__(self): # Data # ============================================================================== - @property - def DATASCHEMA(self): - """:class:`schema.Schema` : The schema of the data representation.""" - from schema import Schema - from compas.data import is_float3 - from compas.data import is_sequence_of_int - from compas.data import is_sequence_of_float - - return Schema( - { - "points": lambda points: all(is_float3(point) for point in points), - "weights": is_sequence_of_float, - "u_knots": is_sequence_of_float, - "v_knots": is_sequence_of_float, - "u_mults": is_sequence_of_int, - "v_mults": is_sequence_of_int, - "u_degree": int, - "v_degree": int, - "is_u_periodic": bool, - "is_v_periodic": bool, - } - ) - - @property - def JSONSCHEMANAME(self): - """dict : The schema of the data representation in JSON format.""" - raise NotImplementedError - @property def dtype(self): """str : The type of the object in the form of a '2-level' import and a class name.""" @@ -130,7 +120,7 @@ def dtype(self): def data(self): """dict : Representation of the curve as a dict containing only native Python objects.""" return { - "points": [[point.data for point in row] for row in self.points], + "points": self.points, "weights": self.weights, "u_knots": self.u_knots, "v_knots": self.v_knots, @@ -161,7 +151,7 @@ def from_data(cls, data): The constructed surface. """ - points = [[Point.from_data(point) for point in row] for row in data["points"]] + points = data["points"] weights = data["weights"] u_knots = data["u_knots"] v_knots = data["v_knots"] diff --git a/src/compas/geometry/transformations/__init__.py b/src/compas/geometry/transformations/__init__.py index e73756c33b0..e69de29bb2d 100644 --- a/src/compas/geometry/transformations/__init__.py +++ b/src/compas/geometry/transformations/__init__.py @@ -1,21 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas # noqa: F402 - -from .matrices import * # noqa: F401 F403 - -from .transformation import Transformation # noqa: F401 F402 -from .translation import Translation # noqa: F401 F402 -from .shear import Shear # noqa: F401 F402 -from .scale import Scale # noqa: F401 F402 -from .rotation import Rotation # noqa: F401 F402 -from .reflection import Reflection # noqa: F401 F402 -from .projection import Projection # noqa: F401 F402 -from .transformations import * # noqa: F401 F403 - -if not compas.IPY: - from .transformations_numpy import * # noqa: F401 F403 - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/transformations/matrices.py b/src/compas/geometry/transformations/matrices.py index 9b1d3ea5756..58efd51acf4 100644 --- a/src/compas/geometry/transformations/matrices.py +++ b/src/compas/geometry/transformations/matrices.py @@ -53,41 +53,6 @@ _NEXT_SPEC = [1, 2, 0, 1] -__all__ = [ - "matrix_determinant", - "matrix_inverse", - "decompose_matrix", - "compose_matrix", - "identity_matrix", - "matrix_from_frame", - "matrix_from_frame_to_frame", - "matrix_from_change_of_basis", - "matrix_from_euler_angles", - "matrix_from_axis_and_angle", - "matrix_from_axis_angle_vector", - "matrix_from_basis_vectors", - "matrix_from_translation", - "matrix_from_orthogonal_projection", - "matrix_from_parallel_projection", - "matrix_from_perspective_projection", - "matrix_from_perspective_entries", - "matrix_from_shear_entries", - "matrix_from_shear", - "matrix_from_scale_factors", - "matrix_from_quaternion", - "euler_angles_from_matrix", - "euler_angles_from_quaternion", - "axis_and_angle_from_matrix", - "axis_angle_vector_from_matrix", - "axis_angle_from_quaternion", - "quaternion_from_matrix", - "quaternion_from_euler_angles", - "quaternion_from_axis_angle", - "basis_vectors_from_matrix", - "translation_from_matrix", -] - - def is_matrix_square(M): """Verify that a matrix is square. diff --git a/src/compas/geometry/transformations/projection.py b/src/compas/geometry/transformations/projection.py index 96b627f3398..534f85f00f5 100644 --- a/src/compas/geometry/transformations/projection.py +++ b/src/compas/geometry/transformations/projection.py @@ -12,12 +12,13 @@ """ from compas.utilities import flatten from compas.geometry import allclose -from compas.geometry.transformations import decompose_matrix -from compas.geometry.transformations import matrix_from_orthogonal_projection -from compas.geometry.transformations import matrix_from_parallel_projection -from compas.geometry.transformations import matrix_from_perspective_projection -from compas.geometry.transformations import matrix_from_perspective_entries -from compas.geometry.transformations import Transformation +from .matrices import decompose_matrix +from .matrices import matrix_from_orthogonal_projection +from .matrices import matrix_from_parallel_projection +from .matrices import matrix_from_perspective_projection +from .matrices import matrix_from_perspective_entries + +from .transformation import Transformation class Projection(Transformation): diff --git a/src/compas/geometry/transformations/reflection.py b/src/compas/geometry/transformations/reflection.py index f803cacdbd8..43faf06308c 100644 --- a/src/compas/geometry/transformations/reflection.py +++ b/src/compas/geometry/transformations/reflection.py @@ -15,8 +15,8 @@ from compas.geometry import cross_vectors from compas.geometry import normalize_vector -from compas.geometry.transformations import identity_matrix -from compas.geometry.transformations import Transformation +from .matrices import identity_matrix +from .transformation import Transformation class Reflection(Transformation): diff --git a/src/compas/geometry/transformations/rotation.py b/src/compas/geometry/transformations/rotation.py index 623d95c9ad5..27374922531 100644 --- a/src/compas/geometry/transformations/rotation.py +++ b/src/compas/geometry/transformations/rotation.py @@ -17,15 +17,16 @@ from compas.geometry import length_vector from compas.geometry import allclose -from compas.geometry.transformations import decompose_matrix -from compas.geometry.transformations import matrix_from_euler_angles -from compas.geometry.transformations import euler_angles_from_matrix -from compas.geometry.transformations import matrix_from_axis_and_angle -from compas.geometry.transformations import axis_and_angle_from_matrix -from compas.geometry.transformations import matrix_from_quaternion -from compas.geometry.transformations import matrix_from_frame -from compas.geometry.transformations import basis_vectors_from_matrix -from compas.geometry.transformations import Transformation +from .matrices import decompose_matrix +from .matrices import matrix_from_euler_angles +from .matrices import euler_angles_from_matrix +from .matrices import matrix_from_axis_and_angle +from .matrices import axis_and_angle_from_matrix +from .matrices import matrix_from_quaternion +from .matrices import matrix_from_frame +from .matrices import basis_vectors_from_matrix + +from .transformation import Transformation class Rotation(Transformation): diff --git a/src/compas/geometry/transformations/scale.py b/src/compas/geometry/transformations/scale.py index 61900860daf..ba902fc4eb2 100644 --- a/src/compas/geometry/transformations/scale.py +++ b/src/compas/geometry/transformations/scale.py @@ -13,11 +13,13 @@ from compas.utilities import flatten from compas.geometry import allclose from compas.geometry import multiply_matrices -from compas.geometry.transformations import decompose_matrix -from compas.geometry.transformations import matrix_from_scale_factors -from compas.geometry.transformations import matrix_from_frame -from compas.geometry.transformations import matrix_inverse -from compas.geometry.transformations import Transformation + +from .matrices import decompose_matrix +from .matrices import matrix_from_scale_factors +from .matrices import matrix_from_frame +from .matrices import matrix_inverse + +from .transformation import Transformation class Scale(Transformation): diff --git a/src/compas/geometry/transformations/shear.py b/src/compas/geometry/transformations/shear.py index 9d7a2d2adee..a81595e3d0e 100644 --- a/src/compas/geometry/transformations/shear.py +++ b/src/compas/geometry/transformations/shear.py @@ -10,12 +10,10 @@ Many thanks to Christoph Gohlke, Martin John Baker, Sachin Joglekar and Andrew Ippoliti for providing code and documentation. """ -# from compas.utilities import flatten -# from compas.geometry import allclose -# from compas.geometry.transformations import decompose_matrix -from compas.geometry.transformations import matrix_from_shear_entries -from compas.geometry.transformations import matrix_from_shear -from compas.geometry.transformations import Transformation +from .matrices import matrix_from_shear_entries +from .matrices import matrix_from_shear + +from .transformation import Transformation class Shear(Transformation): diff --git a/src/compas/geometry/transformations/transformation.py b/src/compas/geometry/transformations/transformation.py index 25d1229eac5..f778cd3fe82 100644 --- a/src/compas/geometry/transformations/transformation.py +++ b/src/compas/geometry/transformations/transformation.py @@ -17,15 +17,15 @@ from compas.geometry import multiply_matrices from compas.geometry import transpose_matrix -from compas.geometry.transformations import basis_vectors_from_matrix -from compas.geometry.transformations import decompose_matrix -from compas.geometry.transformations import identity_matrix -from compas.geometry.transformations import matrix_determinant -from compas.geometry.transformations import matrix_from_euler_angles -from compas.geometry.transformations import matrix_from_frame -from compas.geometry.transformations import matrix_from_translation -from compas.geometry.transformations import matrix_inverse -from compas.geometry.transformations import translation_from_matrix +from .matrices import basis_vectors_from_matrix +from .matrices import decompose_matrix +from .matrices import identity_matrix +from .matrices import matrix_determinant +from .matrices import matrix_from_euler_angles +from .matrices import matrix_from_frame +from .matrices import matrix_from_translation +from .matrices import matrix_inverse +from .matrices import translation_from_matrix class Transformation(Data): diff --git a/src/compas/geometry/transformations/transformations.py b/src/compas/geometry/transformations/transformations.py index 3a06358f87c..f232303257f 100644 --- a/src/compas/geometry/transformations/transformations.py +++ b/src/compas/geometry/transformations/transformations.py @@ -23,45 +23,10 @@ from compas.geometry import closest_point_on_plane from compas.geometry import closest_point_on_line from compas.geometry import closest_point_on_line_xy -from compas.geometry import intersection_line_plane -from compas.geometry import intersection_line_triangle - -from compas.geometry.transformations import matrix_from_axis_and_angle -from compas.geometry.transformations import matrix_from_scale_factors -from compas.geometry.transformations import matrix_from_change_of_basis - - -__all__ = [ - "local_axes", - "orthonormalize_axes", - "transform_points", - "transform_vectors", - "transform_frames", - "local_to_world_coordinates", - "world_to_local_coordinates", - "translate_points", - "translate_points_xy", - "scale_points", - "scale_points_xy", - "rotate_points", - "rotate_points_xy", - "mirror_vector_vector", - "mirror_points_point", - "mirror_points_point_xy", - "mirror_points_line", - "mirror_points_line_xy", - "mirror_point_plane", - "mirror_points_plane", - "project_point_plane", - "project_points_plane", - "project_point_line", - "project_point_line_xy", - "project_points_line", - "project_points_line_xy", - "reflect_line_plane", - "reflect_line_triangle", - "orient_points", -] + +from .matrices import matrix_from_axis_and_angle +from .matrices import matrix_from_scale_factors +from .matrices import matrix_from_change_of_basis # this function will not always work @@ -1014,6 +979,8 @@ def reflect_line_plane(line, plane, tol=1e-6): ([0.0, 0.0, 0.0], [1.0, 1.0, 0.0]) """ + from compas.geometry import intersection_line_plane + x = intersection_line_plane(line, plane, tol=tol) if not x: return @@ -1064,6 +1031,8 @@ def reflect_line_triangle(line, triangle, tol=1e-6): ([0.0, 0.0, 0.0], [1.0, 1.0, 0.0]) """ + from compas.geometry import intersection_line_triangle + x = intersection_line_triangle(line, triangle, tol=tol) if not x: return diff --git a/src/compas/geometry/transformations/transformations_numpy.py b/src/compas/geometry/transformations/transformations_numpy.py index fd8b863e2c6..0d8b3190120 100644 --- a/src/compas/geometry/transformations/transformations_numpy.py +++ b/src/compas/geometry/transformations/transformations_numpy.py @@ -13,18 +13,6 @@ from compas.geometry import cross_vectors -__all__ = [ - "transform_points_numpy", - "transform_vectors_numpy", - "homogenize_numpy", - "dehomogenize_numpy", - "homogenize_and_flatten_frames_numpy", - "dehomogenize_and_unflatten_frames_numpy", - "world_to_local_coordinates_numpy", - "local_to_world_coordinates_numpy", -] - - def transform_points_numpy(points, T): """Transform multiple points with one Transformation using numpy. diff --git a/src/compas/geometry/transformations/translation.py b/src/compas/geometry/transformations/translation.py index 655115f68b0..a46a784a988 100644 --- a/src/compas/geometry/transformations/translation.py +++ b/src/compas/geometry/transformations/translation.py @@ -12,9 +12,11 @@ """ from compas.utilities import flatten from compas.geometry import allclose -from compas.geometry.transformations import decompose_matrix -from compas.geometry.transformations import matrix_from_translation -from compas.geometry.transformations import Transformation + +from .matrices import decompose_matrix +from .matrices import matrix_from_translation + +from .transformation import Transformation class Translation(Transformation): diff --git a/src/compas/geometry/triangulation/__init__.py b/src/compas/geometry/triangulation/__init__.py index ce563753ccd..87b98b9116d 100644 --- a/src/compas/geometry/triangulation/__init__.py +++ b/src/compas/geometry/triangulation/__init__.py @@ -2,14 +2,8 @@ from __future__ import division from __future__ import print_function -import compas from compas.plugins import pluggable -from .delaunay import * # noqa: F401 F403 - -if not compas.IPY: - from .delaunay_numpy import * # noqa: F401 F403 - @pluggable(category="triangulation") def delaunay_triangulation(points): @@ -96,6 +90,3 @@ def conforming_delaunay_triangulation(boundary, polylines=None, polygons=None, a """ raise NotImplementedError - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/triangulation/delaunay.py b/src/compas/geometry/triangulation/delaunay.py index 4b0f8eb7105..9a679ad1408 100644 --- a/src/compas/geometry/triangulation/delaunay.py +++ b/src/compas/geometry/triangulation/delaunay.py @@ -16,11 +16,6 @@ from compas.geometry import circle_from_points_xy -__all__ = [ - "delaunay_from_points", -] - - def delaunay_from_points(points, boundary=None, holes=None, tiny=1e-12): """Computes the delaunay triangulation for a list of points. @@ -124,7 +119,7 @@ def super_triangle(coords, ccw=True): circle = circle_from_points_xy(a, b, c) if is_point_in_circle_xy(point, circle): - fkey, nbr = trimesh_swap_edge(mesh, u, v) + fkey, nbr = trimesh_swap_edge(mesh, (u, v)) newtris.append(fkey) newtris.append(nbr) diff --git a/src/compas/geometry/triangulation/delaunay_numpy.py b/src/compas/geometry/triangulation/delaunay_numpy.py index 6dbb7cce1bb..d9eef25ccad 100644 --- a/src/compas/geometry/triangulation/delaunay_numpy.py +++ b/src/compas/geometry/triangulation/delaunay_numpy.py @@ -7,12 +7,6 @@ from scipy.spatial import Delaunay -__all__ = [ - "delaunay_from_points_numpy", - "voronoi_from_points_numpy", -] - - def delaunay_from_points_numpy(points): """Computes the delaunay triangulation for a list of points using Numpy. diff --git a/src/compas/geometry/trimesh/__init__.py b/src/compas/geometry/trimesh/__init__.py index 566670e59d5..e69de29bb2d 100644 --- a/src/compas/geometry/trimesh/__init__.py +++ b/src/compas/geometry/trimesh/__init__.py @@ -1,14 +0,0 @@ -from __future__ import print_function -from __future__ import absolute_import -from __future__ import division - -from .curvature import * # noqa: F401 F403 -from .geodistance import * # noqa: F401 F403 -from .isolines import * # noqa: F401 F403 -from .matrices import * # noqa: F401 F403 -from .parametrisation import * # noqa: F401 F403 -from .remesh import * # noqa: F401 F403 -from .slicing import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/geometry/trimesh/curvature.py b/src/compas/geometry/trimesh/curvature.py index 925bb9ce2db..1e0f688a055 100644 --- a/src/compas/geometry/trimesh/curvature.py +++ b/src/compas/geometry/trimesh/curvature.py @@ -5,13 +5,6 @@ from compas.plugins import pluggable -__all__ = [ - "trimesh_gaussian_curvature", - "trimesh_mean_curvature", - "trimesh_principal_curvature", -] - - @pluggable(category="trimesh") def trimesh_gaussian_curvature(M): """Compute the discrete gaussian curvature of a triangle mesh. diff --git a/src/compas/geometry/trimesh/geodistance.py b/src/compas/geometry/trimesh/geodistance.py index 0880852da8e..513aab0c516 100644 --- a/src/compas/geometry/trimesh/geodistance.py +++ b/src/compas/geometry/trimesh/geodistance.py @@ -5,9 +5,6 @@ from compas.plugins import pluggable -__all__ = ["trimesh_geodistance"] - - @pluggable(category="trimesh") def trimesh_geodistance(M, source, method="exact"): """Compute the geodesic distance from every vertex of the mesh to a source vertex. diff --git a/src/compas/geometry/trimesh/isolines.py b/src/compas/geometry/trimesh/isolines.py index 12317874937..4b0ecb0a3c4 100644 --- a/src/compas/geometry/trimesh/isolines.py +++ b/src/compas/geometry/trimesh/isolines.py @@ -5,9 +5,6 @@ from compas.plugins import pluggable -__all__ = ["trimesh_isolines"] - - @pluggable(category="trimesh") def trimesh_isolines(M, S, N=50): """Compute isolines on a triangle mesh using a scalarfield of data points diff --git a/src/compas/geometry/trimesh/matrices.py b/src/compas/geometry/trimesh/matrices.py index 9e37f98480e..d1aa7cc1501 100644 --- a/src/compas/geometry/trimesh/matrices.py +++ b/src/compas/geometry/trimesh/matrices.py @@ -5,9 +5,6 @@ from compas.plugins import pluggable -__all__ = ["trimesh_massmatrix"] - - @pluggable(category="trimesh") def trimesh_massmatrix(M): """Compute massmatrix on a triangle mesh using a scalarfield of data points diff --git a/src/compas/geometry/trimesh/parametrisation.py b/src/compas/geometry/trimesh/parametrisation.py index 8c4d139bab5..fd62c4c0c56 100644 --- a/src/compas/geometry/trimesh/parametrisation.py +++ b/src/compas/geometry/trimesh/parametrisation.py @@ -5,9 +5,6 @@ from compas.plugins import pluggable -__all__ = ["trimesh_harmonic", "trimesh_lscm"] - - @pluggable(category="trimesh") def trimesh_harmonic(M): """Compute the harmonic parametrisation of a triangle mesh within a fixed circular boundary. diff --git a/src/compas/geometry/trimesh/remesh.py b/src/compas/geometry/trimesh/remesh.py index 635b7b8528d..1879adf518c 100644 --- a/src/compas/geometry/trimesh/remesh.py +++ b/src/compas/geometry/trimesh/remesh.py @@ -5,13 +5,6 @@ from compas.plugins import pluggable -__all__ = [ - "trimesh_remesh", - "trimesh_remesh_constrained", - "trimesh_remesh_along_isoline", -] - - @pluggable(category="trimesh") def trimesh_remesh(mesh, target_edge_length, number_of_iterations=10, do_project=True): """Remeshing of a triangle mesh. diff --git a/src/compas/geometry/trimesh/slicing.py b/src/compas/geometry/trimesh/slicing.py index 0de83ee4033..635f430a000 100644 --- a/src/compas/geometry/trimesh/slicing.py +++ b/src/compas/geometry/trimesh/slicing.py @@ -5,9 +5,6 @@ from compas.plugins import pluggable -__all__ = ["trimesh_slice"] - - @pluggable(category="trimesh") def trimesh_slice(mesh, planes): """Slice a mesh by a list of planes. diff --git a/src/compas/numerical/__init__.py b/src/compas/numerical/__init__.py index c8465fd85b1..e55d3986525 100644 --- a/src/compas/numerical/__init__.py +++ b/src/compas/numerical/__init__.py @@ -1,106 +1,3 @@ -""" -******************************************************************************** -numerical -******************************************************************************** - -.. currentmodule:: compas.numerical - - -Solvers -======= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - descent_numpy - devo_numpy - dr - dr_numpy - fd_numpy - ga - moga - pca_numpy - topop_numpy - - -Isolines -======== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - scalarfield_contours_numpy - - -Linalg -====== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - nullspace - rank - dof - pivots - nonpivots - rref - rref_sympy - rref_matlab - chofactor - lufactorized - uvw_lengths - normrow - normalizerow - rot90 - solve_with_known - spsolve_with_known - - -Matrices -======== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - adjacency_matrix - connectivity_matrix - degree_matrix - equilibrium_matrix - face_matrix - laplacian_matrix - mass_matrix - stiffness_matrix - - -Operators -========= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - curl - div - grad - - -Utilities -========= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - float_formatter - set_array_print_precision - unset_array_print_precision - - -""" from __future__ import absolute_import import compas @@ -141,17 +38,17 @@ unset_array_print_precision, ) -if not compas.IPY: - from .descent import descent_numpy - from .topop import topop_numpy - from .pca import pca_numpy - from .fd import fd_numpy - from .dr import dr_numpy - from .devo import devo_numpy - from .isolines import scalarfield_contours_numpy - -from .dr import dr # noqa: E402 -from .ga import ga, moga # noqa: E402 + from .descent.descent_numpy import descent_numpy + from .topop.topop_numpy import topop_numpy + from .pca.pca_numpy import pca_numpy + from .fd.fd_numpy import fd_numpy + from .dr.dr_numpy import dr_numpy + from .devo.devo_numpy import devo_numpy + from .isolines.isolines_numpy import scalarfield_contours_numpy + +from .dr.dr import dr +from .ga.ga import ga +from .ga.moga import moga __all__ = [ "dr", diff --git a/src/compas/numerical/descent/__init__.py b/src/compas/numerical/descent/__init__.py index 9865acec0e0..e69de29bb2d 100644 --- a/src/compas/numerical/descent/__init__.py +++ b/src/compas/numerical/descent/__init__.py @@ -1,11 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas - -if not compas.IPY: - from .descent_numpy import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/numerical/descent/descent_numpy.py b/src/compas/numerical/descent/descent_numpy.py index 937c81acf9c..3a79da3d1c4 100644 --- a/src/compas/numerical/descent/descent_numpy.py +++ b/src/compas/numerical/descent/descent_numpy.py @@ -19,9 +19,6 @@ e = sqrt(eps) -__all__ = ["descent_numpy"] - - def descent_numpy(x0, fn, iterations=1000, gtol=10 ** (-6), bounds=None, limit=0, args=()): """A gradient descent optimisation solver. @@ -75,7 +72,6 @@ def phi(x, mu, *args): mu = 1 while i < iterations: - p0 = phi(x0, mu, *args) for j in range(n): diff --git a/src/compas/numerical/devo/__init__.py b/src/compas/numerical/devo/__init__.py index 251c10ed5d7..e69de29bb2d 100644 --- a/src/compas/numerical/devo/__init__.py +++ b/src/compas/numerical/devo/__init__.py @@ -1,11 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas - -if not compas.IPY: - from .devo_numpy import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/numerical/devo/devo_numpy.py b/src/compas/numerical/devo/devo_numpy.py index 64613546149..d3a010f4da6 100644 --- a/src/compas/numerical/devo/devo_numpy.py +++ b/src/compas/numerical/devo/devo_numpy.py @@ -24,9 +24,6 @@ from time import time -__all__ = ["devo_numpy"] - - def devo_numpy( fn, bounds, diff --git a/src/compas/numerical/dr/__init__.py b/src/compas/numerical/dr/__init__.py index 40a05fc13ec..e69de29bb2d 100644 --- a/src/compas/numerical/dr/__init__.py +++ b/src/compas/numerical/dr/__init__.py @@ -1,13 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas - -from .dr import * # noqa: F401 F403 - -if not compas.IPY: - from .dr_numpy import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/numerical/dr/dr_numpy.py b/src/compas/numerical/dr/dr_numpy.py index 89bb1091eda..762f0fddee8 100644 --- a/src/compas/numerical/dr/dr_numpy.py +++ b/src/compas/numerical/dr/dr_numpy.py @@ -14,9 +14,6 @@ from compas.numerical import normrow -__all__ = ["dr_numpy"] - - K = [ [0.0], [0.5, 0.5], diff --git a/src/compas/numerical/fd/__init__.py b/src/compas/numerical/fd/__init__.py index 30ab16da816..e69de29bb2d 100644 --- a/src/compas/numerical/fd/__init__.py +++ b/src/compas/numerical/fd/__init__.py @@ -1,11 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas - -if not compas.IPY: - from .fd_numpy import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/numerical/fd/fd_numpy.py b/src/compas/numerical/fd/fd_numpy.py index a4a222db9c1..78ec138441c 100644 --- a/src/compas/numerical/fd/fd_numpy.py +++ b/src/compas/numerical/fd/fd_numpy.py @@ -10,9 +10,6 @@ from compas.numerical import normrow -__all__ = ["fd_numpy"] - - def fd_numpy(vertices, edges, fixed, q, loads, **kwargs): """Implementation of the force density method to compute equilibrium of axial force networks. diff --git a/src/compas/numerical/ga/__init__.py b/src/compas/numerical/ga/__init__.py index b813f940aa2..e69de29bb2d 100644 --- a/src/compas/numerical/ga/__init__.py +++ b/src/compas/numerical/ga/__init__.py @@ -1,10 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - - -from .ga import * # noqa: F401 F403 -from .moga import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/numerical/ga/ga.py b/src/compas/numerical/ga/ga.py index 80b45de9aa4..a9b597c5042 100644 --- a/src/compas/numerical/ga/ga.py +++ b/src/compas/numerical/ga/ga.py @@ -8,9 +8,6 @@ import copy -__all__ = ["ga"] - - TPL = """ GA summary ========== @@ -298,7 +295,6 @@ def ga_optimize(self): start_gen_number = 0 for generation in range(start_gen_number, self.num_gen): - self.current_pop["decoded"] = self.decode_binary_pop(self.current_pop["binary"]) self.current_pop["scaled"] = self.scale_population(self.current_pop["decoded"]) diff --git a/src/compas/numerical/ga/moga.py b/src/compas/numerical/ga/moga.py index 8453378e2f9..06b83d618bd 100644 --- a/src/compas/numerical/ga/moga.py +++ b/src/compas/numerical/ga/moga.py @@ -7,9 +7,6 @@ import json -__all__ = ["moga"] - - TPL = """ ================================================================================ MOGA summary diff --git a/src/compas/numerical/isolines/__init__.py b/src/compas/numerical/isolines/__init__.py index 49b1fca4287..e69de29bb2d 100644 --- a/src/compas/numerical/isolines/__init__.py +++ b/src/compas/numerical/isolines/__init__.py @@ -1,11 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas - -if not compas.IPY: - from .isolines_numpy import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/numerical/isolines/isolines_numpy.py b/src/compas/numerical/isolines/isolines_numpy.py index 12f002da960..567e6a44c63 100644 --- a/src/compas/numerical/isolines/isolines_numpy.py +++ b/src/compas/numerical/isolines/isolines_numpy.py @@ -11,11 +11,6 @@ import matplotlib.pyplot as plt -__all__ = [ - "scalarfield_contours_numpy", -] - - # def trimesh_descent(trimesh): # """""" # vertices, faces = trimesh.to_vertices_and_faces() diff --git a/src/compas/numerical/lma/__init__.py b/src/compas/numerical/lma/__init__.py index 9dbd96b5920..e69de29bb2d 100644 --- a/src/compas/numerical/lma/__init__.py +++ b/src/compas/numerical/lma/__init__.py @@ -1,11 +0,0 @@ -# from __future__ import absolute_import -# from __future__ import division -# from __future__ import print_function - -# import compas - -# if not compas.IPY: -# from .lma_numpy import * # noqa: F401 F403 - - -# __all__ = [name for name in dir() if not name.startswith('_')] diff --git a/src/compas/numerical/mma/__init__.py b/src/compas/numerical/mma/__init__.py index e526048917b..e69de29bb2d 100644 --- a/src/compas/numerical/mma/__init__.py +++ b/src/compas/numerical/mma/__init__.py @@ -1,11 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas - -if not compas.IPY: - from .mma_numpy import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/numerical/mma/mma_numpy.py b/src/compas/numerical/mma/mma_numpy.py index fed322f869d..7b5f2f9ace2 100644 --- a/src/compas/numerical/mma/mma_numpy.py +++ b/src/compas/numerical/mma/mma_numpy.py @@ -3,8 +3,5 @@ from __future__ import print_function -__all__ = ["mma_numpy"] - - def mma_numpy(): raise NotImplementedError diff --git a/src/compas/numerical/pca/__init__.py b/src/compas/numerical/pca/__init__.py index 4ab1b16da3e..e69de29bb2d 100644 --- a/src/compas/numerical/pca/__init__.py +++ b/src/compas/numerical/pca/__init__.py @@ -1,11 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas - -if not compas.IPY: - from .pca_numpy import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/numerical/pca/pca_numpy.py b/src/compas/numerical/pca/pca_numpy.py index efcf64173e0..9ba2856b562 100644 --- a/src/compas/numerical/pca/pca_numpy.py +++ b/src/compas/numerical/pca/pca_numpy.py @@ -6,9 +6,6 @@ from scipy.linalg import svd -__all__ = ["pca_numpy"] - - def pca_numpy(data): """Compute the principle components of a set of data points. diff --git a/src/compas/numerical/topop/__init__.py b/src/compas/numerical/topop/__init__.py index 1e5640eef51..e69de29bb2d 100644 --- a/src/compas/numerical/topop/__init__.py +++ b/src/compas/numerical/topop/__init__.py @@ -1,11 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import compas - -if not compas.IPY: - from .topop_numpy import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/numerical/topop/topop_numpy.py b/src/compas/numerical/topop/topop_numpy.py index 0a63adbd3b0..76a3d0026a5 100644 --- a/src/compas/numerical/topop/topop_numpy.py +++ b/src/compas/numerical/topop/topop_numpy.py @@ -29,9 +29,6 @@ from scipy.sparse.linalg import spsolve -__all__ = ["topop_numpy"] - - def topop_numpy(nelx, nely, loads, supports, volfrac=0.5, penal=3, rmin=1.5, callback=None): """Topology optimisation in 2D. @@ -104,7 +101,6 @@ def topop_numpy(nelx, nely, loads, supports, volfrac=0.5, penal=3, rmin=1.5, cal fixed = [] for support, B in supports.items(): - jb, ib = [int(i) for i in support.split("-")] Bx, By = B node = int(jb * ny + ib) @@ -123,7 +119,6 @@ def topop_numpy(nelx, nely, loads, supports, volfrac=0.5, penal=3, rmin=1.5, cal cols = [] for load, P in loads.items(): - jp, ip = [int(i) for i in load.split("-")] Px, Py = P node = int(jp * ny + ip) @@ -143,12 +138,10 @@ def topop_numpy(nelx, nely, loads, supports, volfrac=0.5, penal=3, rmin=1.5, cal k = 0 for i1 in range(nelx): - max_i = int(max([i1 - (ceil(rmin) - 1), 0])) min_i = int(min([i1 + (ceil(rmin) - 1), nelx - 1])) for j1 in range(nely): - max_j = int(max([j1 - (ceil(rmin) - 1), 0])) min_j = int(min([j1 + (ceil(rmin) - 1), nely - 1])) @@ -176,7 +169,6 @@ def topop_numpy(nelx, nely, loads, supports, volfrac=0.5, penal=3, rmin=1.5, cal nones = ones((ne)) * 0.001 while change > 0.1: - # FE xrav = ravel(xP, order="F").transpose() @@ -203,7 +195,6 @@ def topop_numpy(nelx, nely, loads, supports, volfrac=0.5, penal=3, rmin=1.5, cal l2 = 10**9 while (l2 - l1) / (l1 + l2) > 0.001: - lmid = 0.5 * (l2 + l1) sdv = sqrt(-dc / dv / lmid) min1 = minimum(x + move, x * sdv) diff --git a/src/compas/plugins.py b/src/compas/plugins.py index f4978cf4e06..4babcb6ebc2 100644 --- a/src/compas/plugins.py +++ b/src/compas/plugins.py @@ -7,47 +7,7 @@ # Copyright (c) 2015 holger krekel (rather uses bitbucket/hpk42) # # https://github.com/pytest-dev/pluggy -""" -******************************************************************************** -plugins -******************************************************************************** -.. currentmodule:: compas.plugins - -COMPAS has an extensible architecture based on plugins that allows to -customize and extend the functionality of the core framework. - -Check out the developer guide to :ref:`plugins` for additional details. - -Decorators -========== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - pluggable - plugin - -Classes -======= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - PluginManager - -Exceptions -========== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - IncompletePluginImplError - PluginNotInstalledError -""" from __future__ import absolute_import from __future__ import division from __future__ import print_function diff --git a/src/compas/robots/__init__.py b/src/compas/robots/__init__.py index 67a3e78d409..cd0c807387f 100644 --- a/src/compas/robots/__init__.py +++ b/src/compas/robots/__init__.py @@ -1,159 +1,16 @@ -""" -******************************************************************************** -robots -******************************************************************************** - -.. currentmodule:: compas.robots - - -Model -===== - -The root of the model is the :class:`RobotModel` class, which -describes a robot consisting of a set of link elements, and a set of joint -elements connecting the links together. - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - RobotModel - Joint - Link - ToolModel - Configuration - - -Geometric description -===================== - -The robot itself as well as its links can be geometrically described -using the following classes. - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Geometry - MeshDescriptor - Material - Texture - Color - - -Link -==== - -The link is described as a rigid body with inertial, visual and collision values. - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Visual - Collision - Inertial - Mass - Inertia - - -Joint -===== - -The joint describes the kinematics and dynamics of the robot's joint. - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - ParentLink - ChildLink - Calibration - Dynamics - Limit - Axis - Mimic - SafetyController - - -Resources -========= - -Model descriptions usually do not contain embedded geometry information but only -descriptions, filenames or URLs for externally hosted resources. -For that purpose, this package provides various loader classes that help automate -the processing of these resources. - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - AbstractMeshLoader - DefaultMeshLoader - GithubPackageMeshLoader - LocalPackageMeshLoader - -Deprecated -========== - -.. deprecated:: 1.13.3 - Use `compas.geometry` primitives instead - -The following classes are available for backwards compatibility but are deprecated. - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Origin - Cylinder - Box - Sphere - Capsule - -""" from __future__ import absolute_import from .configuration import Configuration -from .model import ( - Axis, - Calibration, - ChildLink, - Collision, - Color, - Dynamics, - Geometry, - Inertia, - Inertial, - Joint, - Limit, - Link, - Mass, - Material, - MeshDescriptor, - Mimic, - ParentLink, - RobotModel, - SafetyController, - Texture, - ToolModel, - Visual, -) -from .resources import ( - AbstractMeshLoader, - DefaultMeshLoader, - GithubPackageMeshLoader, - LocalPackageMeshLoader, -) -# Deprecated aliases -from .model import ( - Origin, - Box, - Capsule, - Cylinder, - Sphere, -) +from .resources.basic import AbstractMeshLoader, DefaultMeshLoader, LocalPackageMeshLoader +from .resources.github import GithubPackageMeshLoader + +# from .model.base import FrameProxy, ProxyObject +from .model.geometry import Box, Capsule, Color, Cylinder, Geometry, Material, MeshDescriptor, Origin, Sphere, Texture +from .model.joint import Axis, Calibration, ChildLink, Dynamics, Joint, Limit, Mimic, ParentLink, SafetyController +from .model.link import Collision, Inertia, Inertial, Link, Mass, Visual +from .model.robot import RobotModel +from .model.tool import ToolModel __all__ = [ "Geometry", diff --git a/src/compas/robots/configuration.py b/src/compas/robots/configuration.py index 4f100d9f229..b052b589e6a 100644 --- a/src/compas/robots/configuration.py +++ b/src/compas/robots/configuration.py @@ -7,11 +7,6 @@ from compas.data import Data -__all__ = [ - "Configuration", - "FixedLengthList", -] - # These joint types known to configuration are a match # to the ones defined in `Joint` class, but we redefine here # to avoid a circular dependency @@ -484,7 +479,7 @@ def max_difference(self, other): The configuration to compare to. Returns - ------ + ------- float The maximum absolute difference. @@ -559,9 +554,9 @@ def merge(self, other): The other configuration takes precedence over this configuration in case a joint value is present in both. - Note - ---- - Caution: ``joint_names`` may be rearranged. + Notes + ----- + Caution: ``joint_names`` may be rearranged. Parameters ---------- @@ -589,9 +584,9 @@ def merged(self, other): The other configuration takes precedence over this configuration in case a joint value is present in both. - Note - ---- - Caution: ``joint_names`` may be rearranged. + Notes + ----- + Caution: ``joint_names`` may be rearranged. Parameters ---------- diff --git a/src/compas/robots/model/__init__.py b/src/compas/robots/model/__init__.py index 622c4b19953..e69de29bb2d 100644 --- a/src/compas/robots/model/__init__.py +++ b/src/compas/robots/model/__init__.py @@ -1,12 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from .base import * # noqa: F401 F403 -from .geometry import * # noqa: F401 F403 -from .joint import * # noqa: F401 F403 -from .link import * # noqa: F401 F403 -from .robot import * # noqa: F401 F403 -from .tool import * # noqa: F401 F403 - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/robots/model/base.py b/src/compas/robots/model/base.py index 3f7fba88b41..4381acd225e 100644 --- a/src/compas/robots/model/base.py +++ b/src/compas/robots/model/base.py @@ -2,15 +2,10 @@ from __future__ import division from __future__ import print_function -from compas.files.urdf import URDFElement -from compas.files.urdf import URDFGenericElement +from compas.files import URDFElement +from compas.files import URDFGenericElement from compas.geometry import Frame -__all__ = [ - "FrameProxy", - "ProxyObject", -] - def _parse_floats(values): return [float(i) for i in values.split()] diff --git a/src/compas/robots/model/geometry.py b/src/compas/robots/model/geometry.py index c2daa2a1291..e0e91225b55 100644 --- a/src/compas/robots/model/geometry.py +++ b/src/compas/robots/model/geometry.py @@ -5,27 +5,16 @@ import compas import compas.colors import compas.geometry + from compas.data import Data from compas.datastructures import Mesh -from compas.files.urdf import URDFElement +from compas.files import URDFElement from compas.geometry import Frame -from compas.robots.model.base import ProxyObject -from compas.robots.model.base import _attr_from_data -from compas.robots.model.base import _attr_to_data -from compas.robots.model.base import _parse_floats - -__all__ = [ - "Geometry", - "MeshDescriptor", - "Color", - "Texture", - "Material", - "Origin", - "Cylinder", - "Box", - "Sphere", - "Capsule", -] + +from .base import ProxyObject +from .base import _attr_from_data +from .base import _attr_to_data +from .base import _parse_floats class BoxProxy(ProxyObject): diff --git a/src/compas/robots/model/joint.py b/src/compas/robots/model/joint.py index 267c020c3bf..16d6f02fa6a 100644 --- a/src/compas/robots/model/joint.py +++ b/src/compas/robots/model/joint.py @@ -11,22 +11,11 @@ from compas.geometry import Translation from compas.geometry import Vector from compas.geometry import transform_vectors -from compas.robots.model.base import FrameProxy -from compas.robots.model.base import _attr_from_data -from compas.robots.model.base import _attr_to_data -from compas.robots.model.base import _parse_floats - -__all__ = [ - "Joint", - "ParentLink", - "ChildLink", - "Calibration", - "Dynamics", - "Limit", - "Axis", - "Mimic", - "SafetyController", -] + +from .base import FrameProxy +from .base import _attr_from_data +from .base import _attr_to_data +from .base import _parse_floats class ParentLink(Data): @@ -489,7 +478,6 @@ def __init__( mimic=None, **kwargs ): - type_idx = type if isinstance(type_idx, str) and type_idx in Joint.SUPPORTED_TYPES: diff --git a/src/compas/robots/model/link.py b/src/compas/robots/model/link.py index 2017a131a27..b9e41c8f5eb 100644 --- a/src/compas/robots/model/link.py +++ b/src/compas/robots/model/link.py @@ -11,20 +11,20 @@ from compas.geometry import Frame from compas.geometry import Sphere from compas.geometry import Transformation -from compas.robots.model.base import FrameProxy -from compas.robots.model.base import _attr_from_data -from compas.robots.model.base import _attr_to_data -from compas.robots.model.geometry import BoxProxy -from compas.robots.model.geometry import CapsuleProxy -from compas.robots.model.geometry import Color -from compas.robots.model.geometry import CylinderProxy -from compas.robots.model.geometry import Geometry -from compas.robots.model.geometry import Material -from compas.robots.model.geometry import MeshDescriptor -from compas.robots.model.geometry import SphereProxy -from compas.robots.model.geometry import Texture - -__all__ = ["Link", "Inertial", "Visual", "Collision", "Mass", "Inertia"] + +from .base import FrameProxy +from .base import _attr_from_data +from .base import _attr_to_data + +from .geometry import BoxProxy +from .geometry import CapsuleProxy +from .geometry import Color +from .geometry import CylinderProxy +from .geometry import Geometry +from .geometry import Material +from .geometry import MeshDescriptor +from .geometry import SphereProxy +from .geometry import Texture class Mass(Data): @@ -269,7 +269,7 @@ def from_primitive(cls, primitive, **kwargs): Parameters ---------- - primitive : :compas:`compas.geometry.Shape` + primitive : :class:`compas.geometry.Shape` A primitive shape. **kwargs : dict[str, Any], optional The keyword arguments (kwargs) collected in a dict. @@ -370,7 +370,7 @@ def from_primitive(cls, primitive, **kwargs): Parameters ---------- - primitive : :compas:`compas.geometry.Shape` + primitive : :class:`compas.geometry.Shape` A primitive shape. **kwargs : dict[str, Any], optional The keyword arguments (kwargs) collected in a dict. @@ -444,7 +444,7 @@ def data(self): @data.setter def data(self, data): - from compas.robots.model.joint import Joint + from .joint import Joint self.name = data["name"] self.type = data["type"] diff --git a/src/compas/robots/model/robot.py b/src/compas/robots/model/robot.py index aea4a8efbc9..a7480fb618d 100644 --- a/src/compas/robots/model/robot.py +++ b/src/compas/robots/model/robot.py @@ -13,25 +13,25 @@ from compas.files import URDFParser from compas.geometry import Frame from compas.geometry import Transformation -from compas.robots import Configuration -from compas.robots.model.base import _attr_from_data -from compas.robots.model.base import _attr_to_data -from compas.robots.model.geometry import Color -from compas.robots.model.geometry import Geometry -from compas.robots.model.geometry import Material -from compas.robots.model.geometry import MeshDescriptor -from compas.robots.model.geometry import Texture -from compas.robots.model.joint import Axis -from compas.robots.model.joint import Joint -from compas.robots.model.joint import Limit -from compas.robots.model.link import Collision -from compas.robots.model.link import Link -from compas.robots.model.link import Visual -from compas.robots.resources import DefaultMeshLoader -from compas.robots.resources import LocalPackageMeshLoader from compas.topology import shortest_path -__all__ = ["RobotModel"] +from compas.robots import Configuration +from compas.robots import DefaultMeshLoader +from compas.robots import LocalPackageMeshLoader + +from .base import _attr_from_data +from .base import _attr_to_data +from .geometry import Color +from .geometry import Geometry +from .geometry import Material +from .geometry import MeshDescriptor +from .geometry import Texture +from .joint import Axis +from .joint import Joint +from .joint import Limit +from .link import Collision +from .link import Link +from .link import Visual class RobotModel(Data): @@ -642,8 +642,8 @@ def random_configuration(self): :class:`~compas.robots.Configuration` Instance of a configuration with randomized joint values. - Note - ---- + Notes + ----- No collision checking is involved, the configuration may be invalid. """ diff --git a/src/compas/robots/model/tool.py b/src/compas/robots/model/tool.py index 31c75e1d4ae..47969ea89d0 100644 --- a/src/compas/robots/model/tool.py +++ b/src/compas/robots/model/tool.py @@ -4,7 +4,8 @@ from compas.geometry import Frame from compas.geometry import Transformation -from compas.robots.model.robot import RobotModel + +from .robot import RobotModel class ToolModel(RobotModel): diff --git a/src/compas/robots/resources/__init__.py b/src/compas/robots/resources/__init__.py index 34d26f4d592..e69de29bb2d 100644 --- a/src/compas/robots/resources/__init__.py +++ b/src/compas/robots/resources/__init__.py @@ -1,8 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from .basic import * # noqa: F401 F403 -from .github import * # noqa: F401 F403 - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas/robots/resources/basic.py b/src/compas/robots/resources/basic.py index 940080dc2dc..24da80cb33b 100644 --- a/src/compas/robots/resources/basic.py +++ b/src/compas/robots/resources/basic.py @@ -4,15 +4,13 @@ import os -from compas.datastructures import Mesh - -__all__ = ["AbstractMeshLoader", "DefaultMeshLoader", "LocalPackageMeshLoader"] - try: from urllib.parse import urlparse except ImportError: from urlparse import urlparse +from compas.datastructures import Mesh + SUPPORTED_FORMATS = ("obj", "stl", "ply") diff --git a/src/compas/robots/resources/github.py b/src/compas/robots/resources/github.py index 2dfd7490943..0d7d5e979fb 100644 --- a/src/compas/robots/resources/github.py +++ b/src/compas/robots/resources/github.py @@ -2,16 +2,14 @@ from __future__ import division from __future__ import print_function -from compas.robots.resources.basic import AbstractMeshLoader -from compas.robots.resources.basic import _mesh_import - -__all__ = ["GithubPackageMeshLoader"] - try: from urllib.request import urlopen except ImportError: from urllib2 import urlopen +from .basic import AbstractMeshLoader +from .basic import _mesh_import + class GithubPackageMeshLoader(AbstractMeshLoader): """Loads resources stored in Github. diff --git a/src/compas/rpc/__init__.py b/src/compas/rpc/__init__.py index cb2ac858d6c..89c69c2c645 100644 --- a/src/compas/rpc/__init__.py +++ b/src/compas/rpc/__init__.py @@ -1,49 +1,10 @@ -""" -******************************************************************************** -rpc -******************************************************************************** - -.. currentmodule:: compas.rpc - -.. rst-class:: lead - -COMPAS runs in many different environments, but in some environments the availablity of libraries is limited. -For example, when running COMPAS in an IronPython-based environment like Rhino/Grasshopper, -plenty of CPython libraries such as `numpy` and `scipy` are not available. -To workaround this limitation, COMPAS provides a mechanisms to access the -functionality of a CPython environment seemlessly from any other Python environment -through a "Remote Procedure Call" or RPC. - - -Classes -======= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - Dispatcher - Proxy - Server - - -Exceptions -========== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - RPCClientError - RPCServerError - -""" from __future__ import absolute_import from .errors import RPCClientError, RPCServerError from .proxy import Proxy from .server import Server from .dispatcher import Dispatcher +from .xfunc import XFunc -__all__ = ["RPCClientError", "RPCServerError", "Proxy", "Server", "Dispatcher"] +__all__ = ["RPCClientError", "RPCServerError", "Proxy", "Server", "Dispatcher", "XFunc"] diff --git a/src/compas/rpc/dispatcher.py b/src/compas/rpc/dispatcher.py index 0204775996c..85fd48bbcb7 100644 --- a/src/compas/rpc/dispatcher.py +++ b/src/compas/rpc/dispatcher.py @@ -8,8 +8,8 @@ import sys import traceback -from compas.utilities import DataDecoder -from compas.utilities import DataEncoder +from compas.data import DataDecoder +from compas.data import DataEncoder try: from cStringIO import StringIO diff --git a/src/compas/rpc/proxy.py b/src/compas/rpc/proxy.py index 56f9c650cd0..3d21fda8ff0 100644 --- a/src/compas/rpc/proxy.py +++ b/src/compas/rpc/proxy.py @@ -8,8 +8,8 @@ import compas import compas._os from compas.rpc import RPCServerError -from compas.utilities import DataDecoder -from compas.utilities import DataEncoder +from compas.data import DataDecoder +from compas.data import DataEncoder try: from xmlrpclib import ServerProxy diff --git a/src/compas/utilities/xfunc.py b/src/compas/rpc/xfunc.py similarity index 94% rename from src/compas/utilities/xfunc.py rename to src/compas/rpc/xfunc.py index 023e5a091dd..1b1da319f79 100644 --- a/src/compas/utilities/xfunc.py +++ b/src/compas/rpc/xfunc.py @@ -9,8 +9,8 @@ import compas import compas._os -from compas.utilities import DataEncoder -from compas.utilities import DataDecoder +from compas.data import DataEncoder +from compas.data import DataDecoder try: import cPickle as pickle @@ -27,9 +27,6 @@ compas.raise_if_ironpython() -__all__ = ["XFunc"] - - WRAPPER = """ import os import sys @@ -51,8 +48,8 @@ import pstats import traceback -from compas.utilities import DataEncoder -from compas.utilities import DataDecoder +from compas.data import DataEncoder +from compas.data import DataDecoder basedir = sys.argv[1] funcname = sys.argv[2] @@ -202,19 +199,19 @@ class XFunc(object): for key, attr in mesh.vertices(True): attr['is_fixed'] = mesh.vertex_degree(key) == 2 - key_index = mesh.key_index() - vertices = mesh.vertices_attributes('xyz') - edges = [(key_index[u], key_index[v]) for u, v in mesh.edges()] - fixed = [key_index[key] for key in mesh.vertices_where({'is_fixed': True})] - q = mesh.edges_attribute('q') - loads = mesh.vertices_attributes(('px', 'py', 'pz')) + vertex_index = mesh.vertex_index() + vertices = mesh.vertices_attributes('xyz') + edges = [(vertex_index[u], vertex_index[v]) for u, v in mesh.edges()] + fixed = [vertex_index[vertex] for vertex in mesh.vertices_where({'is_fixed': True})] + q = mesh.edges_attribute('q') + loads = mesh.vertices_attributes(('px', 'py', 'pz')) xyz, q, f, l, r = fd_numpy(vertices, edges, fixed, q, loads) - for key, attr in mesh.vertices(True): - attr['x'] = xyz[key][0] - attr['y'] = xyz[key][1] - attr['z'] = xyz[key][2] + for vertex, attr in mesh.vertices(True): + attr['x'] = xyz[vertex][0] + attr['y'] = xyz[vertex][1] + attr['z'] = xyz[vertex][2] artist = MeshArtist(mesh) artist.draw_vertices() diff --git a/src/compas/topology/__init__.py b/src/compas/topology/__init__.py index 4b10b31c8ad..e4b887e9c45 100644 --- a/src/compas/topology/__init__.py +++ b/src/compas/topology/__init__.py @@ -1,69 +1,3 @@ -""" -******************************************************************************** -topology -******************************************************************************** - -.. currentmodule:: compas.topology - -.. rst-class:: lead - - Package containing topological algorithms for traversal, connectivity, combinatorics, etc. - - -Connectivity -============ - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - adjacency_from_edges - - -Combinatorics -============= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - vertex_coloring - connected_components - - -Orientation -=========== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - face_adjacency - face_adjacency_numpy - face_adjacency_rhino - unify_cycles - unify_cycles_numpy - unify_cycles_rhino - - -Traversal -========= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - astar_lightest_path - astar_shortest_path - breadth_first_ordering - breadth_first_traverse - breadth_first_paths - depth_first_ordering - dijkstra_distances - dijkstra_path - shortest_path - -""" from __future__ import absolute_import import compas diff --git a/src/compas/topology/combinatorics.py b/src/compas/topology/combinatorics.py index 725bc2722ee..eb7e6808669 100644 --- a/src/compas/topology/combinatorics.py +++ b/src/compas/topology/combinatorics.py @@ -3,7 +3,7 @@ from __future__ import division from collections import deque -from compas.topology import breadth_first_traverse +from compas.topology.traversal import breadth_first_traverse def vertex_coloring(adjacency): diff --git a/src/compas/topology/orientation.py b/src/compas/topology/orientation.py index 194c146b791..4e46d4cb62f 100644 --- a/src/compas/topology/orientation.py +++ b/src/compas/topology/orientation.py @@ -6,7 +6,7 @@ from compas.utilities import pairwise from compas.geometry import centroid_points -from compas.topology import breadth_first_traverse +from compas.topology.traversal import breadth_first_traverse def unify_cycles(vertices, faces, root=0): diff --git a/src/compas/topology/orientation_numpy.py b/src/compas/topology/orientation_numpy.py index 283f2b79e3e..13655f1c5b6 100644 --- a/src/compas/topology/orientation_numpy.py +++ b/src/compas/topology/orientation_numpy.py @@ -6,7 +6,7 @@ from compas.utilities import pairwise from compas.geometry import centroid_points -from compas.topology import breadth_first_traverse +from compas.topology.traversal import breadth_first_traverse def unify_cycles_numpy(vertices, faces, root=0): diff --git a/src/compas/topology/orientation_rhino.py b/src/compas/topology/orientation_rhino.py index fb4435c639e..a6755875258 100644 --- a/src/compas/topology/orientation_rhino.py +++ b/src/compas/topology/orientation_rhino.py @@ -8,7 +8,7 @@ from compas.utilities import pairwise from compas.geometry import centroid_points -from compas.topology import breadth_first_traverse +from compas.topology.traversal import breadth_first_traverse def unify_cycles_rhino(vertices, faces, root=0): diff --git a/src/compas/utilities/__init__.py b/src/compas/utilities/__init__.py index 4beb942db33..3d8ac21a6de 100644 --- a/src/compas/utilities/__init__.py +++ b/src/compas/utilities/__init__.py @@ -1,100 +1,6 @@ -""" -******************************************************************************** -utilities -******************************************************************************** - -.. currentmodule:: compas.utilities - -.. rst-class:: lead - -This package collects miscellaneous functionality with the common characteristic -that it simply did not really fit anywhere else. - - -async -===== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - await_callback - - -colors -====== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - i_to_rgb - i_to_red - i_to_green - i_to_blue - i_to_white - i_to_black - rgb_to_hex - color_to_colordict - color_to_rgb - - -encoders -======== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - DataEncoder - DataDecoder - - -itertools -========= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - flatten - linspace - meshgrid - pairwise - window - iterable_like - normalize_values - remap_values - - -maps -==== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - geometric_key - reverse_geometric_key - geometric_key_xy - - -""" from __future__ import absolute_import from .azync import await_callback -from .coercing import ( - coerce_sequence_of_list, - coerce_sequence_of_tuple, - is_item_iterable, - is_sequence_of_dict, - is_sequence_of_float, - is_sequence_of_int, - is_sequence_of_iterable, - is_sequence_of_list, - is_sequence_of_str, - is_sequence_of_tuple, -) from .colors import ( Colormap, black, @@ -126,11 +32,10 @@ memoize, print_profile, ) -from .descriptors import Float, RGBColour -from .encoders import DataDecoder, DataEncoder from .images import gif_from_images from .itertools import ( flatten, + reshape, grouper, iterable_like, linspace, @@ -143,20 +48,9 @@ from .maps import geometric_key, geometric_key_xy, reverse_geometric_key from .remote import download_file_from_remote from .ssh import SSH -from .xfunc import XFunc __all__ = [ "await_callback", - "is_sequence_of_str", - "is_sequence_of_int", - "is_sequence_of_float", - "is_sequence_of_tuple", - "is_sequence_of_list", - "is_sequence_of_dict", - "is_sequence_of_iterable", - "is_item_iterable", - "coerce_sequence_of_tuple", - "coerce_sequence_of_list", "i_to_rgb", "i_to_red", "i_to_green", @@ -185,15 +79,12 @@ "abstractclassmethod", "memoize", "print_profile", - "Float", - "RGBColour", - "DataDecoder", - "DataEncoder", "gif_from_images", "normalize_values", "remap_values", "meshgrid", "linspace", + "reshape", "flatten", "pairwise", "window", @@ -204,5 +95,4 @@ "geometric_key_xy", "download_file_from_remote", "SSH", - "XFunc", ] diff --git a/src/compas/utilities/azync.py b/src/compas/utilities/azync.py index b45251774fe..8845e7f1e8b 100644 --- a/src/compas/utilities/azync.py +++ b/src/compas/utilities/azync.py @@ -6,9 +6,6 @@ import threading -__all__ = ["await_callback"] - - class ThreadExceptHookHandler(object): """Workaround to deal with a bug in the Python interpreter (!). diff --git a/src/compas/utilities/coercing.py b/src/compas/utilities/coercing.py deleted file mode 100644 index 90a98ef9665..00000000000 --- a/src/compas/utilities/coercing.py +++ /dev/null @@ -1,36 +0,0 @@ -from __future__ import print_function -from __future__ import absolute_import -from __future__ import division - -import warnings - -from compas.data.coercion import coerce_sequence_of_list -from compas.data.coercion import coerce_sequence_of_tuple -from compas.data.validators import is_sequence_of_str -from compas.data.validators import is_sequence_of_int -from compas.data.validators import is_sequence_of_float -from compas.data.validators import is_sequence_of_tuple -from compas.data.validators import is_sequence_of_list -from compas.data.validators import is_sequence_of_dict -from compas.data.validators import is_sequence_of_iterable -from compas.data.validators import is_item_iterable - - -__all__ = [ - "is_sequence_of_str", - "is_sequence_of_int", - "is_sequence_of_float", - "is_sequence_of_tuple", - "is_sequence_of_list", - "is_sequence_of_dict", - "is_sequence_of_iterable", - "is_item_iterable", - "coerce_sequence_of_tuple", - "coerce_sequence_of_list", -] - -warnings.warn( - "The coercing module in utilities is deprecated. Use the data module instead", - DeprecationWarning, - stacklevel=2, -) diff --git a/src/compas/utilities/datetime.py b/src/compas/utilities/datetime.py index 6895cf347d5..6fd18ca91dd 100644 --- a/src/compas/utilities/datetime.py +++ b/src/compas/utilities/datetime.py @@ -6,9 +6,6 @@ import datetime -__all__ = ["timestamp", "now"] - - def timestamp(): """Generate a timestamp using the current date and time. diff --git a/src/compas/utilities/decorators.py b/src/compas/utilities/decorators.py index d2c3d6cf159..c9ce27c0886 100644 --- a/src/compas/utilities/decorators.py +++ b/src/compas/utilities/decorators.py @@ -21,14 +21,6 @@ import profile as Profile -__all__ = [ - "abstractstaticmethod", - "abstractclassmethod", - "memoize", - "print_profile", -] - - class abstractstaticmethod(staticmethod): """Decorator for declaring a static method abstract. diff --git a/src/compas/utilities/descriptors.py b/src/compas/utilities/descriptors.py deleted file mode 100644 index 44656dfbc79..00000000000 --- a/src/compas/utilities/descriptors.py +++ /dev/null @@ -1,21 +0,0 @@ -from __future__ import print_function -from __future__ import absolute_import -from __future__ import division - -import warnings - - -__all__ = [ - "Float", - "RGBColour", -] - - -class Float(object): - def __init__(self): - warnings.warn("This class will be removed.", DeprecationWarning) - - -class RGBColour(object): - def __init__(self): - warnings.warn("This class will be removed.", DeprecationWarning) diff --git a/src/compas/utilities/encoders.py b/src/compas/utilities/encoders.py deleted file mode 100644 index ea1f21dbb12..00000000000 --- a/src/compas/utilities/encoders.py +++ /dev/null @@ -1,16 +0,0 @@ -from __future__ import print_function -from __future__ import absolute_import -from __future__ import division - -import warnings - -from compas.data import DataEncoder -from compas.data import DataDecoder - -__all__ = ["DataEncoder", "DataDecoder"] - -warnings.warn( - "The encoders module in utilities is deprecated. Use the encoders module from data instead", - DeprecationWarning, - stacklevel=2, -) diff --git a/src/compas/utilities/images.py b/src/compas/utilities/images.py index d191712e15b..b3cb30e3f0b 100644 --- a/src/compas/utilities/images.py +++ b/src/compas/utilities/images.py @@ -9,9 +9,6 @@ import imageio -__all__ = ["gif_from_images"] - - def gif_from_images( files, gif_path, diff --git a/src/compas/utilities/itertools.py b/src/compas/utilities/itertools.py index a776c9ec951..d7c0c98893b 100644 --- a/src/compas/utilities/itertools.py +++ b/src/compas/utilities/itertools.py @@ -8,6 +8,8 @@ from itertools import chain from itertools import repeat from itertools import tee +from functools import reduce +from operator import mul try: from itertools import zip_longest @@ -15,19 +17,6 @@ from itertools import izip_longest as zip_longest -__all__ = [ - "normalize_values", - "remap_values", - "meshgrid", - "linspace", - "flatten", - "pairwise", - "window", - "iterable_like", - "grouper", -] - - def normalize_values(values, new_min=0.0, new_max=1.0): """Normalize a list of numbers to the range between new_min and new_max. @@ -215,6 +204,53 @@ def flatten(list_of_lists): return chain.from_iterable(list_of_lists) +def reshape(lst, shape): + """Gives a new shape to an array without changing its data. + + This function mimics the functionality of ``numpy.reshape`` [1]_, but in a simpler form. + + Parameters + ---------- + lst : list + A list of items. + shape : int or tuple of ints + The new shape of the list + + + Examples + -------- + >>> a = [1, 2, 3, 4, 5, 6] + >>> reshape(a, (2, 3)) + [[1, 2, 3], [4, 5, 6]] + >>> reshape(a, (3, 2)) + [[1, 2], [3, 4], [5, 6]] + >>> a = [[1, 2], [3, 4], [5, 6]] + >>> reshape(a, (2, 3)) + [[1, 2, 3], [4, 5, 6]] + + + References + ---------- + .. [1] ``numpy.reshape`` Available at https://numpy.org/doc/stable/reference/generated/numpy.reshape.html + + """ + + def helper(l, shape): # noqa E741 + if len(shape) == 1: + if len(l) % shape[0] != 0: + raise ValueError("ValueError: cannot reshape array of size %d into shape %s" % (len(lst), shape)) + return l + else: + n = reduce(mul, shape[1:]) + return [helper(l[i * n : (i + 1) * n], shape[1:]) for i in range(len(l) // n)] + + shape = (shape,) if isinstance(shape, int) else shape + flattened_list = list(flatten(lst)) if isinstance(lst[0], list) else lst + if len(list(flattened_list)) != reduce(lambda x, y: x * y, shape): + raise ValueError("ValueError: cannot reshape array of size %d into shape %s" % (len(lst), shape)) + return helper(flattened_list, shape) + + def pairwise(iterable): """Returns a sliding window of size 2 over the data of the iterable. diff --git a/src/compas/utilities/maps.py b/src/compas/utilities/maps.py index 9e6c25f6807..c60e1607d91 100644 --- a/src/compas/utilities/maps.py +++ b/src/compas/utilities/maps.py @@ -5,13 +5,6 @@ import compas -__all__ = [ - "geometric_key", - "reverse_geometric_key", - "geometric_key_xy", -] - - def geometric_key(xyz, precision=None, sanitize=True): """Convert XYZ coordinates to a string that can be used as a dict key. diff --git a/src/compas/utilities/remote.py b/src/compas/utilities/remote.py index 07b8dafa58b..2845f1be701 100644 --- a/src/compas/utilities/remote.py +++ b/src/compas/utilities/remote.py @@ -24,9 +24,6 @@ # raise -__all__ = ["download_file_from_remote"] - - def download_file_from_remote(source, target, overwrite=True): """Download a file from a remote source and save it to a local destination. diff --git a/src/compas/utilities/ssh.py b/src/compas/utilities/ssh.py index e926c72450c..8ae61721185 100644 --- a/src/compas/utilities/ssh.py +++ b/src/compas/utilities/ssh.py @@ -11,9 +11,6 @@ import os -__all__ = ["SSH"] - - class SSH(object): """Initialse an SSH object. diff --git a/src/compas_blender/__init__.py b/src/compas_blender/__init__.py index 4e7b89d6405..06374fb7f0d 100644 --- a/src/compas_blender/__init__.py +++ b/src/compas_blender/__init__.py @@ -1,20 +1,3 @@ -""" -******************************************************************************** -compas_blender -******************************************************************************** - -.. currentmodule:: compas_blender - -.. toctree:: - :maxdepth: 1 - - compas_blender.artists - compas_blender.conversions - compas_blender.geometry - compas_blender.ui - compas_blender.utilities - -""" import os import compas diff --git a/src/compas_blender/artists/__init__.py b/src/compas_blender/artists/__init__.py index 13f51a23ddf..4642abd1ca1 100644 --- a/src/compas_blender/artists/__init__.py +++ b/src/compas_blender/artists/__init__.py @@ -1,90 +1,3 @@ -""" -******************************************************************************** -artists -******************************************************************************** - -.. currentmodule:: compas_blender.artists - -.. rst-class:: lead - -Artists for visualizing (painting) COMPAS geometry, robots, and data structures in Blender. -The artists in this package provide plugins for the pluggable methods of the base artists defined in :mod:`compas.artists`. -They can be used directly from here (:mod:`compas_blender.artists`), or through the base artist :class:`~compas.artists.Artist`. - - -Primitive Artists -================= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - CircleArtist - FrameArtist - LineArtist - PointArtist - PolygonArtist - PolylineArtist - VectorArtist - - -Shape Artists -============= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - BoxArtist - CapsuleArtist - ConeArtist - CylinderArtist - PolyhedronArtist - SphereArtist - - -Curve and Surface Artists -========================= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - CurveArtist - SurfaceArtist - - -Datastructure Artists -===================== - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - MeshArtist - NetworkArtist - - -Robot Artist -============ - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - RobotModelArtist - - -Base Classes -============ - -.. autosummary:: - :toctree: generated/ - - BlenderArtist - -""" - import compas_blender from compas.plugins import plugin diff --git a/src/compas_blender/artists/volmeshartist.py b/src/compas_blender/artists/volmeshartist.py index 84eb8317075..8e76fc55e73 100644 --- a/src/compas_blender/artists/volmeshartist.py +++ b/src/compas_blender/artists/volmeshartist.py @@ -310,7 +310,7 @@ def draw_cells( faces = self.volmesh.cell_faces(cell) vertex_index = dict((vertex, index) for index, vertex in enumerate(vertices)) vertices = [vertex_xyz[vertex] for vertex in vertices] - faces = [[vertex_index[vertex] for vertex in self.halfface_vertices(face)] for face in faces] + faces = [[vertex_index[vertex] for vertex in self.volmesh.halfface_vertices(face)] for face in faces] obj = compas_blender.draw_mesh( vertices, faces, diff --git a/src/compas_blender/conversions/__init__.py b/src/compas_blender/conversions/__init__.py index fde2b12d2ee..5ff1e7bbf74 100644 --- a/src/compas_blender/conversions/__init__.py +++ b/src/compas_blender/conversions/__init__.py @@ -1,22 +1,3 @@ -""" -******************************************************************************** -conversions -******************************************************************************** - -.. currentmodule:: compas_blender.conversions - -Classes -======= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - BlenderGeometry - BlenderCurve - BlenderMesh - -""" from ._geometry import BlenderGeometry from .curve import BlenderCurve from .mesh import BlenderMesh diff --git a/src/compas_blender/utilities/collections.py b/src/compas_blender/utilities/collections.py index f01c69c9baa..4c2725e7861 100644 --- a/src/compas_blender/utilities/collections.py +++ b/src/compas_blender/utilities/collections.py @@ -4,15 +4,6 @@ from compas_blender.utilities import delete_objects -__all__ = [ - "create_collection", - "create_collections", - "create_collections_from_path", - "clear_collection", - "clear_collections", -] - - def collection_path(collection, names=[]): for parent in bpy.data.collections: if collection.name in parent.children: @@ -40,7 +31,6 @@ def create_collection(name: Text, parent: bpy.types.Collection = None) -> bpy.ty return if not parent: - if name in bpy.data.collections: count = 1 newname = f"{name}.{count:04}" diff --git a/src/compas_blender/utilities/data.py b/src/compas_blender/utilities/data.py index 8ce1b865dd4..d03750cac21 100644 --- a/src/compas_blender/utilities/data.py +++ b/src/compas_blender/utilities/data.py @@ -1,11 +1,6 @@ import bpy -__all__ = [ - "delete_unused_data", -] - - def delete_unused_data(): """Delete all collections, mesh and curve objects, meshes, curves, materials. diff --git a/src/compas_blender/utilities/drawing.py b/src/compas_blender/utilities/drawing.py index b7e54f6d33c..27872124ab7 100644 --- a/src/compas_blender/utilities/drawing.py +++ b/src/compas_blender/utilities/drawing.py @@ -13,24 +13,6 @@ from compas.geometry import subtract_vectors -__all__ = [ - "draw_circles", - "draw_cylinders", - "draw_cubes", - "draw_faces", - "draw_lines", - "draw_mesh", - "draw_pipes", - "draw_planes", - "draw_pointcloud", - "draw_points", - "draw_polylines", - "draw_spheres", - "draw_texts", - "RGBColor", -] - - RGBColor = Union[Tuple[int, int, int], Tuple[float, float, float]] diff --git a/src/compas_blender/utilities/misc.py b/src/compas_blender/utilities/misc.py index 4bff1a15b84..acf68c61c3a 100644 --- a/src/compas_blender/utilities/misc.py +++ b/src/compas_blender/utilities/misc.py @@ -1,11 +1,6 @@ import sys -__all__ = [ - "unload_modules", -] - - def unload_modules(top_level_module_name): """Unloads all modules named starting with the specified string. diff --git a/src/compas_blender/utilities/objects.py b/src/compas_blender/utilities/objects.py index 61813490998..05c40e6939c 100644 --- a/src/compas_blender/utilities/objects.py +++ b/src/compas_blender/utilities/objects.py @@ -4,17 +4,6 @@ from compas_blender.utilities.data import delete_unused_data -__all__ = [ - "delete_object", - "delete_objects", - "delete_all_objects", - "delete_object_by_name", - "delete_objects_by_names", - "get_object_by_name", - "get_objects_by_names", -] - - # ============================================================================== # Delete # ============================================================================== diff --git a/src/compas_ghpython/artists/volmeshartist.py b/src/compas_ghpython/artists/volmeshartist.py index 4aa7e4bec07..db4065982e7 100644 --- a/src/compas_ghpython/artists/volmeshartist.py +++ b/src/compas_ghpython/artists/volmeshartist.py @@ -167,7 +167,7 @@ def draw_cells(self, cells=None, color=None): faces = self.volmesh.cell_faces(cell) vertex_index = dict((vertex, index) for index, vertex in enumerate(vertices)) vertices = [vertex_xyz[vertex] for vertex in vertices] - faces = [[vertex_index[vertex] for vertex in self.halfface_vertices(face)] for face in faces] + faces = [[vertex_index[vertex] for vertex in self.volmesh.halfface_vertices(face)] for face in faces] mesh = compas_ghpython.draw_mesh(vertices, faces, color=self.cell_color[cell].rgb255) meshes.append(mesh) return meshes diff --git a/src/compas_ghpython/utilities/__init__.py b/src/compas_ghpython/utilities/__init__.py index e88c205b06f..27cea309f23 100644 --- a/src/compas_ghpython/utilities/__init__.py +++ b/src/compas_ghpython/utilities/__init__.py @@ -104,7 +104,7 @@ def create_id(component, name): The resulting string can be used to store data elements in the global sticky dictionary. This can be useful when setting variable in a condition activated by a button. - Paramaters + Parameters ---------- components : `ghpythonlib.componentbase.executingcomponent` The components instance. Use `self` in advanced (SDK) mode and `ghenv.Components` otherwise. diff --git a/src/compas_plotters/core/drawing.py b/src/compas_plotters/core/drawing.py index 14a37a8b644..ee20b494a87 100644 --- a/src/compas_plotters/core/drawing.py +++ b/src/compas_plotters/core/drawing.py @@ -16,22 +16,6 @@ from compas.utilities import color_to_rgb -__all__ = [ - "create_axes_xy", - "create_axes_3d", - "draw_points_xy", - "draw_xpoints_xy", - "draw_points_3d", - "draw_lines_xy", - "draw_xlines_xy", - "draw_lines_3d", - "draw_xarrows_xy", - "draw_xlabels_xy", - "draw_xpolygons_xy", - "draw_xpolylines_xy", -] - - ZORDER_POLYGONS = 1000 ZORDER_LINES = 2000 ZORDER_POINTS = 3000 diff --git a/src/compas_plotters/core/helpers.py b/src/compas_plotters/core/helpers.py index 6650d446674..64717bf2235 100644 --- a/src/compas_plotters/core/helpers.py +++ b/src/compas_plotters/core/helpers.py @@ -8,17 +8,6 @@ from compas_plotters.core.utilities import assert_axes_dimension -__all__ = [ - "Axes2D", - "Axes3D", - "Bounds", - "Box", - "Cloud2D", - "Cloud3D", - "Hull", -] - - class Axes2D(object): """Definition of a 2D Axes object. diff --git a/src/compas_plotters/core/utilities.py b/src/compas_plotters/core/utilities.py index 48a9b56ae78..eef1399ecc6 100644 --- a/src/compas_plotters/core/utilities.py +++ b/src/compas_plotters/core/utilities.py @@ -1,11 +1,3 @@ -__all__ = [ - "get_axes_dimension", - "assert_axes_dimension", - "width_to_dict", - "size_to_sizedict", -] - - def get_axes_dimension(axes): """Returns the number of dimensions of a matplotlib axes object. diff --git a/src/compas_rhino/artists/volmeshartist.py b/src/compas_rhino/artists/volmeshartist.py index 3772bf77eea..93e137b5196 100644 --- a/src/compas_rhino/artists/volmeshartist.py +++ b/src/compas_rhino/artists/volmeshartist.py @@ -268,7 +268,7 @@ def draw_cells(self, cells=None, color=None): faces = self.volmesh.cell_faces(cell) vertex_index = dict((vertex, index) for index, vertex in enumerate(vertices)) vertices = [vertex_xyz[vertex] for vertex in vertices] - faces = [[vertex_index[vertex] for vertex in self.halfface_vertices(face)] for face in faces] + faces = [[vertex_index[vertex] for vertex in self.volmesh.halfface_vertices(face)] for face in faces] guid = compas_rhino.draw_mesh( vertices, faces, diff --git a/src/compas_rhino/forms/__init__.py b/src/compas_rhino/forms/__init__.py index b0930dc52f7..103314bcccd 100644 --- a/src/compas_rhino/forms/__init__.py +++ b/src/compas_rhino/forms/__init__.py @@ -40,8 +40,8 @@ from .slider import SliderForm try: - from .etoforms import ImageForm - from .etoforms import TextForm + from .etoforms.image import ImageForm + from .etoforms.text import TextForm except Exception: from .image import ImageForm from .text import TextForm @@ -57,8 +57,8 @@ ] try: - from .etoforms import PropertyListForm - from .etoforms import SettingsForm + from .etoforms.propertylist import PropertyListForm + from .etoforms.settings import SettingsForm except Exception: pass else: diff --git a/src/compas_rhino/forms/etoforms/__init__.py b/src/compas_rhino/forms/etoforms/__init__.py index bee4c5b146f..e69de29bb2d 100644 --- a/src/compas_rhino/forms/etoforms/__init__.py +++ b/src/compas_rhino/forms/etoforms/__init__.py @@ -1,33 +0,0 @@ -""" -******************************************************************************** -etoforms -******************************************************************************** - -.. currentmodule:: compas_rhino.etoforms - -.. note:: - - In the future, Eto forms will be merged into the normal forms package. - -Classes -======= - -.. autosummary:: - :toctree: generated/ - :nosignatures: - - ImageForm - PropertyListForm - SettingsForm - TextForm - -""" -from __future__ import absolute_import - -from .image import * # noqa: F401 F403 -from .propertylist import * # noqa: F401 F403 -from .settings import * # noqa: F401 F403 -from .text import * # noqa: F401 F403 - - -__all__ = [name for name in dir() if not name.startswith("_")] diff --git a/src/compas_rhino/forms/etoforms/image.py b/src/compas_rhino/forms/etoforms/image.py index 4ded51bf862..a1d1e30c9f4 100644 --- a/src/compas_rhino/forms/etoforms/image.py +++ b/src/compas_rhino/forms/etoforms/image.py @@ -22,9 +22,6 @@ import Eto.Forms # noqa: E402 -__all__ = ["ImageForm"] - - def image_from_remote(source): """Construct an image from a remote source. diff --git a/src/compas_rhino/forms/etoforms/propertylist.py b/src/compas_rhino/forms/etoforms/propertylist.py index bbb7b8bd908..2d36ad5875c 100644 --- a/src/compas_rhino/forms/etoforms/propertylist.py +++ b/src/compas_rhino/forms/etoforms/propertylist.py @@ -13,9 +13,6 @@ import Eto.Forms # noqa: E402 -__all__ = ["PropertyListForm"] - - class PropertyListForm(Eto.Forms.Dialog[bool]): def __init__(self, names, values, title="Properties", width=400, height=600): self.names = names diff --git a/src/compas_rhino/forms/etoforms/settings.py b/src/compas_rhino/forms/etoforms/settings.py index ebeb5af7651..a36cadb2ff5 100644 --- a/src/compas_rhino/forms/etoforms/settings.py +++ b/src/compas_rhino/forms/etoforms/settings.py @@ -15,9 +15,6 @@ import Eto.Forms # noqa: E402 -__all__ = ["SettingsForm"] - - class SettingsForm(Eto.Forms.Dialog[bool]): def __init__(self, settings, title="Settings"): # super(SettingsForm, self).__init__() diff --git a/src/compas_rhino/forms/etoforms/text.py b/src/compas_rhino/forms/etoforms/text.py index 49e966d70c0..6164144b163 100644 --- a/src/compas_rhino/forms/etoforms/text.py +++ b/src/compas_rhino/forms/etoforms/text.py @@ -13,9 +13,6 @@ import Eto.Forms # noqa: E402 -__all__ = ["TextForm"] - - class TextForm(Eto.Forms.Dialog[bool]): def __init__(self, text, title="Message"): self.text = text diff --git a/src/compas_rhino/geometry/__init__.py b/src/compas_rhino/geometry/__init__.py index 3d8e135d3d5..adbb0d3da95 100644 --- a/src/compas_rhino/geometry/__init__.py +++ b/src/compas_rhino/geometry/__init__.py @@ -83,15 +83,15 @@ from compas_rhino.conversions import RhinoSurface from compas_rhino.conversions import RhinoVector -from .curves import RhinoNurbsCurve -from .surfaces import RhinoNurbsSurface - -from .brep import RhinoBrep -from .brep import RhinoBrepLoop -from .brep import RhinoBrepVertex -from .brep import RhinoBrepFace -from .brep import RhinoBrepEdge -from .brep import RhinoBrepTrim +from .curves.nurbs import RhinoNurbsCurve +from .surfaces.nurbs import RhinoNurbsSurface + +from .brep.brep import RhinoBrep +from .brep.loop import RhinoBrepLoop +from .brep.vertex import RhinoBrepVertex +from .brep.face import RhinoBrepFace +from .brep.edge import RhinoBrepEdge +from .brep.trim import RhinoBrepTrim __all__ = [ "RhinoGeometry", diff --git a/src/compas_rhino/geometry/booleans/__init__.py b/src/compas_rhino/geometry/booleans/__init__.py index 4645c4b6c0a..969457eb117 100644 --- a/src/compas_rhino/geometry/booleans/__init__.py +++ b/src/compas_rhino/geometry/booleans/__init__.py @@ -7,13 +7,6 @@ from compas.plugins import plugin -__all__ = [ - "boolean_union_mesh_mesh", - "boolean_difference_mesh_mesh", - "boolean_intersection_mesh_mesh", -] - - @plugin(category="booleans", requires=["Rhino"]) def boolean_union_mesh_mesh(A, B, remesh=False): """Compute the boolean union of two triangle meshes. diff --git a/src/compas_rhino/geometry/brep/__init__.py b/src/compas_rhino/geometry/brep/__init__.py index 349bdcf26f1..6f9619a09f4 100644 --- a/src/compas_rhino/geometry/brep/__init__.py +++ b/src/compas_rhino/geometry/brep/__init__.py @@ -1,28 +1,8 @@ from compas.plugins import plugin - from .brep import RhinoBrep -from .face import RhinoBrepFace -from .edge import RhinoBrepEdge -from .vertex import RhinoBrepVertex -from .loop import RhinoBrepLoop -from .trim import RhinoBrepTrim - import Rhino -__all__ = [ - "RhinoBrep", - "RhinoBrepVertex", - "RhinoBrepEdge", - "RhinoBrepLoop", - "RhinoBrepFace", - "RhinoBrepTrim", - "new_brep", - "from_native", - "from_box", -] - - @plugin(category="factories", requires=["Rhino"]) def new_brep(*args, **kwargs): # Note: this is called inside Brep.__new__, thus Brep.__init__ will be ran by the interpreter diff --git a/src/compas_rhino/geometry/trimesh/__init__.py b/src/compas_rhino/geometry/trimesh/__init__.py index d459b9f5d16..9bc476dcc20 100644 --- a/src/compas_rhino/geometry/trimesh/__init__.py +++ b/src/compas_rhino/geometry/trimesh/__init__.py @@ -1,6 +1,7 @@ from __future__ import absolute_import -from .curvature import * # noqa : F401 F403 -from .slice import * # noqa : F401 F403 +from .curvature import trimesh_gaussian_curvature # noqa: F401 +from .curvature import trimesh_mean_curvature # noqa: F401 +from .curvature import trimesh_principal_curvature # noqa: F401 -__all__ = [name for name in dir() if not name.startswith("_")] +from .slice import trimesh_slice # noqa: F401 diff --git a/src/compas_rhino/geometry/trimesh/curvature.py b/src/compas_rhino/geometry/trimesh/curvature.py index f76e008a67f..5767eb3c2d6 100644 --- a/src/compas_rhino/geometry/trimesh/curvature.py +++ b/src/compas_rhino/geometry/trimesh/curvature.py @@ -17,16 +17,8 @@ from compas.plugins import plugin -__all__ = [ - "trimesh_gaussian_curvature", - "trimesh_mean_curvature", - "trimesh_principal_curvature", -] - - @plugin(category="trimesh", requires=["Rhino"]) def trimesh_gaussian_curvature(M): - r"""Compute the discrete Gaussian curvature of a triangle mesh. Parameters diff --git a/src/compas_rhino/geometry/trimesh/slice.py b/src/compas_rhino/geometry/trimesh/slice.py index adbe7682bab..f02f7cd25ba 100644 --- a/src/compas_rhino/geometry/trimesh/slice.py +++ b/src/compas_rhino/geometry/trimesh/slice.py @@ -9,11 +9,6 @@ from compas.plugins import plugin -__all__ = [ - "trimesh_slice", -] - - @plugin(category="trimesh", requires=["Rhino"]) def trimesh_slice(mesh, planes): """Slice a mesh by a list of planes. diff --git a/src/compas_rhino/utilities/objects.py b/src/compas_rhino/utilities/objects.py index 35f746d3a6f..95fa5b7ef5b 100644 --- a/src/compas_rhino/utilities/objects.py +++ b/src/compas_rhino/utilities/objects.py @@ -371,7 +371,7 @@ def get_object_attributes_from_name(guids, prefix=None): Therefore, to make the string representation of a dict a valid name it has to be prefixed with something. This prefix can be stripped automatically using this parameter. - Results + Returns ------- list[dict[str, Any]] The attribute dicts of the objects. diff --git a/tests/compas/compas_api.json b/tests/compas/compas_api.json index 15e57243b88..d65f5f4b15e 100644 --- a/tests/compas/compas_api.json +++ b/tests/compas/compas_api.json @@ -1,7 +1,7 @@ { "metadata": { - "compas_version": "1.0.0", - "generated_on": "20210318" + "compas_version": "1.17.5-31fce1b0", + "generated_on": "20230614" }, "modules": { "compas": [ @@ -10,10 +10,13 @@ "LINUX", "MONO", "OSX", + "PY2", + "PY3", "RHINO", "WINDOWS", "get", "is_blender", + "is_grasshopper", "is_ironpython", "is_linux", "is_mono", @@ -26,19 +29,41 @@ "json_loads", "set_precision" ], - "compas.base": [ - "Base" + "compas.data": [ + "Data", + "DataDecoder", + "DataEncoder", + "DecoderError", + "is_float3", + "is_float4x4", + "is_int3", + "is_item_iterable", + "is_sequence_of_float", + "is_sequence_of_int", + "is_sequence_of_uint", + "json_dump", + "json_dumps", + "json_load", + "json_loads", + "validate_data" ], "compas.datastructures": [ + "Assembly", + "AssemblyError", "BaseMesh", "BaseNetwork", "BaseVolMesh", "Datastructure", + "Feature", + "FeatureError", + "GeometricFeature", "Graph", "HalfEdge", "HalfFace", "Mesh", "Network", + "ParametricFeature", + "Part", "VolMesh", "mesh_add_vertex_to_face_edge", "mesh_adjacency_matrix", @@ -88,6 +113,7 @@ "mesh_smooth_centroid", "mesh_split_edge", "mesh_split_face", + "mesh_split_strip", "mesh_subdivide", "mesh_subdivide_catmullclark", "mesh_subdivide_corner", @@ -127,6 +153,7 @@ "network_join_edges", "network_laplacian_matrix", "network_polylines", + "network_shortest_path", "network_smooth_centroid", "network_split_edge", "network_transform", @@ -150,12 +177,18 @@ "volmesh_transformed" ], "compas.files": [ + "DXF", + "DXFParser", + "DXFReader", "GLTF", "GLTFContent", "GLTFExporter", "GLTFMesh", "GLTFParser", "GLTFReader", + "LAS", + "LASParser", + "LASReader", "OBJ", "OBJParser", "OBJReader", @@ -173,6 +206,7 @@ "STLWriter", "URDF", "URDFElement", + "URDFGenericElement", "URDFParser", "XML", "XMLElement", @@ -181,16 +215,33 @@ "prettify_string" ], "compas.geometry": [ + "Arc", "Bezier", "Box", + "Brep", + "BrepEdge", + "BrepError", + "BrepFace", + "BrepInvalidError", + "BrepLoop", + "BrepOrientation", + "BrepTrim", + "BrepTrimIsoStatus", + "BrepTrimmingError", + "BrepType", + "BrepVertex", "Capsule", "Circle", "Cone", + "Curve", "Cylinder", "Ellipse", "Frame", + "Geometry", "KDTree", "Line", + "NurbsCurve", + "NurbsSurface", "Plane", "Point", "Pointcloud", @@ -206,6 +257,7 @@ "Shape", "Shear", "Sphere", + "Surface", "Torus", "Transformation", "Translation", @@ -222,6 +274,8 @@ "angles_points", "angles_points_xy", "angles_vectors", + "angles_vectors", + "angles_vectors_xy", "angles_vectors_xy", "archimedean_spiral_evaluate", "area_polygon", @@ -283,6 +337,7 @@ "dehomogenize_numpy", "dehomogenize_vectors", "delaunay_from_points", + "delaunay_from_points", "delaunay_from_points_numpy", "delaunay_triangulation", "discrete_coons_patch", @@ -395,6 +450,7 @@ "midpoint_line_xy", "midpoint_point_point", "midpoint_point_point_xy", + "mirror_point_plane", "mirror_points_line", "mirror_points_line_xy", "mirror_points_plane", @@ -472,6 +528,7 @@ "trimesh_isolines", "trimesh_lscm", "trimesh_massmatrix", + "trimesh_mean_curvature", "trimesh_principal_curvature", "trimesh_remesh", "trimesh_remesh_along_isoline", @@ -495,6 +552,7 @@ "connectivity_matrix", "curl", "degree_matrix", + "descent_numpy", "devo_numpy", "div", "dof", @@ -531,8 +589,10 @@ "uvw_lengths" ], "compas.plugins": [ + "IncompletePluginImplError", "PluginManager", "PluginNotInstalledError", + "PluginValidator", "pluggable", "plugin", "plugin_manager" @@ -546,6 +606,7 @@ "ChildLink", "Collision", "Color", + "Configuration", "Cylinder", "DefaultMeshLoader", "Dynamics", @@ -575,10 +636,12 @@ "Proxy", "RPCClientError", "RPCServerError", - "Server" + "Server", + "XFunc" ], "compas.topology": [ "adjacency_from_edges", + "astar_lightest_path", "astar_shortest_path", "breadth_first_ordering", "breadth_first_paths", @@ -596,19 +659,12 @@ ], "compas.utilities": [ "Colormap", - "DataDecoder", - "DataEncoder", - "Float", - "RGBColour", "SSH", - "XFunc", "abstractclassmethod", "abstractstaticmethod", "await_callback", "black", "blue", - "coerce_sequence_of_list", - "coerce_sequence_of_tuple", "color_to_colordict", "color_to_rgb", "cyan", @@ -629,14 +685,6 @@ "is_color_hex", "is_color_light", "is_color_rgb", - "is_item_iterable", - "is_sequence_of_dict", - "is_sequence_of_float", - "is_sequence_of_int", - "is_sequence_of_iterable", - "is_sequence_of_list", - "is_sequence_of_str", - "is_sequence_of_tuple", "iterable_like", "linspace", "memoize", diff --git a/tests/compas/compas_api_ipy.json b/tests/compas/compas_api_ipy.json index 65c166d7bf0..e6a7b13ff8e 100644 --- a/tests/compas/compas_api_ipy.json +++ b/tests/compas/compas_api_ipy.json @@ -1,7 +1,7 @@ { "metadata": { - "compas_version": "1.0.0", - "generated_on": "20210318" + "compas_version": "1.17.5-31fce1b0", + "generated_on": "20230614" }, "modules": { "compas": [ @@ -10,10 +10,13 @@ "LINUX", "MONO", "OSX", + "PY2", + "PY3", "RHINO", "WINDOWS", "get", "is_blender", + "is_grasshopper", "is_ironpython", "is_linux", "is_mono", @@ -26,19 +29,41 @@ "json_loads", "set_precision" ], - "compas.base": [ - "Base" + "compas.data": [ + "Data", + "DataDecoder", + "DataEncoder", + "DecoderError", + "is_float3", + "is_float4x4", + "is_int3", + "is_item_iterable", + "is_sequence_of_float", + "is_sequence_of_int", + "is_sequence_of_uint", + "json_dump", + "json_dumps", + "json_load", + "json_loads", + "validate_data" ], "compas.datastructures": [ + "Assembly", + "AssemblyError", "BaseMesh", "BaseNetwork", "BaseVolMesh", "Datastructure", + "Feature", + "FeatureError", + "GeometricFeature", "Graph", "HalfEdge", "HalfFace", "Mesh", "Network", + "ParametricFeature", + "Part", "VolMesh", "mesh_add_vertex_to_face_edge", "mesh_bounding_box", @@ -78,6 +103,7 @@ "mesh_smooth_centroid", "mesh_split_edge", "mesh_split_face", + "mesh_split_strip", "mesh_subdivide", "mesh_subdivide_catmullclark", "mesh_subdivide_corner", @@ -111,6 +137,7 @@ "network_is_xy", "network_join_edges", "network_polylines", + "network_shortest_path", "network_smooth_centroid", "network_split_edge", "network_transform", @@ -128,12 +155,18 @@ "volmesh_transformed" ], "compas.files": [ + "DXF", + "DXFParser", + "DXFReader", "GLTF", "GLTFContent", "GLTFExporter", "GLTFMesh", "GLTFParser", "GLTFReader", + "LAS", + "LASParser", + "LASReader", "OBJ", "OBJParser", "OBJReader", @@ -151,6 +184,7 @@ "STLWriter", "URDF", "URDFElement", + "URDFGenericElement", "URDFParser", "XML", "XMLElement", @@ -159,16 +193,33 @@ "prettify_string" ], "compas.geometry": [ + "Arc", "Bezier", "Box", + "Brep", + "BrepEdge", + "BrepError", + "BrepFace", + "BrepInvalidError", + "BrepLoop", + "BrepOrientation", + "BrepTrim", + "BrepTrimIsoStatus", + "BrepTrimmingError", + "BrepType", + "BrepVertex", "Capsule", "Circle", "Cone", + "Curve", "Cylinder", "Ellipse", "Frame", + "Geometry", "KDTree", "Line", + "NurbsCurve", + "NurbsSurface", "Plane", "Point", "Pointcloud", @@ -184,6 +235,7 @@ "Shape", "Shear", "Sphere", + "Surface", "Torus", "Transformation", "Translation", @@ -200,6 +252,8 @@ "angles_points", "angles_points_xy", "angles_vectors", + "angles_vectors", + "angles_vectors_xy", "angles_vectors_xy", "archimedean_spiral_evaluate", "area_polygon", @@ -253,6 +307,7 @@ "decompose_matrix", "dehomogenize_vectors", "delaunay_from_points", + "delaunay_from_points", "delaunay_triangulation", "discrete_coons_patch", "distance_line_line", @@ -360,6 +415,7 @@ "midpoint_line_xy", "midpoint_point_point", "midpoint_point_point_xy", + "mirror_point_plane", "mirror_points_line", "mirror_points_line_xy", "mirror_points_plane", @@ -432,6 +488,7 @@ "trimesh_isolines", "trimesh_lscm", "trimesh_massmatrix", + "trimesh_mean_curvature", "trimesh_principal_curvature", "trimesh_remesh", "trimesh_remesh_along_isoline", @@ -447,14 +504,12 @@ "volume_polyhedron", "world_to_local_coordinates" ], - "compas.numerical": [ - "dr", - "ga", - "moga" - ], + "compas.numerical": [], "compas.plugins": [ + "IncompletePluginImplError", "PluginManager", "PluginNotInstalledError", + "PluginValidator", "pluggable", "plugin", "plugin_manager" @@ -468,6 +523,7 @@ "ChildLink", "Collision", "Color", + "Configuration", "Cylinder", "DefaultMeshLoader", "Dynamics", @@ -497,10 +553,12 @@ "Proxy", "RPCClientError", "RPCServerError", - "Server" + "Server", + "XFunc" ], "compas.topology": [ "adjacency_from_edges", + "astar_lightest_path", "astar_shortest_path", "breadth_first_ordering", "breadth_first_paths", @@ -510,27 +568,18 @@ "dijkstra_distances", "dijkstra_path", "face_adjacency", - "face_adjacency_rhino", "shortest_path", "unify_cycles", - "unify_cycles_rhino", "vertex_coloring" ], "compas.utilities": [ "Colormap", - "DataDecoder", - "DataEncoder", - "Float", - "RGBColour", "SSH", - "XFunc", "abstractclassmethod", "abstractstaticmethod", "await_callback", "black", "blue", - "coerce_sequence_of_list", - "coerce_sequence_of_tuple", "color_to_colordict", "color_to_rgb", "cyan", @@ -551,14 +600,6 @@ "is_color_hex", "is_color_light", "is_color_rgb", - "is_item_iterable", - "is_sequence_of_dict", - "is_sequence_of_float", - "is_sequence_of_int", - "is_sequence_of_iterable", - "is_sequence_of_list", - "is_sequence_of_str", - "is_sequence_of_tuple", "iterable_like", "linspace", "memoize", @@ -578,4 +619,4 @@ "yellow" ] } -} +} \ No newline at end of file diff --git a/tests/compas/data/test_json.py b/tests/compas/data/test_json.py index 31005182393..89b5dfec15c 100644 --- a/tests/compas/data/test_json.py +++ b/tests/compas/data/test_json.py @@ -49,8 +49,8 @@ def test_json_network(): assert before.attributes == after.attributes assert all(before.has_node(node) for node in after.nodes()) assert all(after.has_node(node) for node in before.nodes()) - assert all(before.has_edge(*edge) for edge in after.edges()) - assert all(after.has_edge(*edge) for edge in before.edges()) + assert all(before.has_edge(edge) for edge in after.edges()) + assert all(after.has_edge(edge) for edge in before.edges()) assert before.guid == after.guid diff --git a/tests/compas/data/test_jsonschema.py b/tests/compas/data/test_jsonschema.py index a29f248ffe2..47868a26692 100644 --- a/tests/compas/data/test_jsonschema.py +++ b/tests/compas/data/test_jsonschema.py @@ -1,209 +1,76 @@ -import os -import json import pytest import compas -if not compas.IPY: - import jsonschema - - -if not compas.IPY: - - @pytest.fixture - def resolver(): - path = os.path.join(compas.HERE, "data", "schemas", "compas.json") - with open(path) as f: - definitions = json.load(f) - return jsonschema.RefResolver.from_schema(definitions) - - @pytest.fixture - def point_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "point.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def vector_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "vector.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def line_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "line.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def plane_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "plane.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def circle_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "circle.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def ellipse_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "ellipse.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def frame_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "frame.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def quaternion_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "quaternion.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def polygon_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "polygon.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def polyline_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "polyline.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def box_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "box.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def capsule_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "capsule.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def cone_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "cone.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def cylinder_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "cylinder.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def polyhedron_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "polyhedron.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def sphere_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "sphere.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def torus_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "torus.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def pointcloud_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "pointcloud.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def graph_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "graph.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def halfedge_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "halfedge.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - - @pytest.fixture - def halfface_validator(resolver): - path = os.path.join(compas.HERE, "data", "schemas", "halfface.json") - with open(path) as f: - schema = json.load(f) - validator = jsonschema.Draft7Validator(schema, resolver=resolver) - return validator - +from compas.geometry import Point +from compas.geometry import Vector +from compas.geometry import Line +from compas.geometry import Plane +from compas.geometry import Circle +from compas.geometry import Ellipse +from compas.geometry import Frame +from compas.geometry import Quaternion +from compas.geometry import Polygon +from compas.geometry import Polyline +from compas.geometry import Box +from compas.geometry import Capsule +from compas.geometry import Cone +from compas.geometry import Cylinder +from compas.geometry import Polyhedron +from compas.geometry import Sphere +from compas.geometry import Torus +from compas.geometry import Pointcloud + +from compas.datastructures import Graph +from compas.datastructures import HalfEdge if not compas.IPY: + import jsonschema.exceptions - @pytest.mark.parametrize("point", [[0, 0, 0], [0.0, 0, 0], [0.0, 0.0, 0.0]]) - def test_schema_point_valid(point_validator, point): - point_validator.validate(point) + @pytest.mark.parametrize( + "point", + [ + [0, 0, 0], + [0.0, 0, 0], + [0.0, 0.0, 0.0], + ], + ) + def test_schema_point_valid(point): + Point.validate_jsondata(point) - @pytest.mark.parametrize("point", [[0, 0], [0, 0, 0, 0], [0, 0, "0"]]) - def test_schema_point_invalid(point_validator, point): + @pytest.mark.parametrize( + "point", + [ + [0, 0], + [0, 0, 0, 0], + [0, 0, "0"], + ], + ) + def test_schema_point_invalid(point): with pytest.raises(jsonschema.exceptions.ValidationError): - point_validator.validate(point) + Point.validate_jsondata(point) - @pytest.mark.parametrize("vector", [[0, 0, 0], [0.0, 0, 0], [0.0, 0.0, 0.0]]) - def test_schema_vector_valid(vector_validator, vector): - vector_validator.validate(vector) + @pytest.mark.parametrize( + "vector", + [ + [0, 0, 0], + [0.0, 0, 0], + [0.0, 0.0, 0.0], + ], + ) + def test_schema_vector_valid(vector): + Vector.validate_jsondata(vector) - @pytest.mark.parametrize("vector", [[0, 0], [0, 0, 0, 0], [0, 0, "0"]]) - def test_schema_vector_invalid(vector_validator, vector): + @pytest.mark.parametrize( + "vector", + [ + [0, 0], + [0, 0, 0, 0], + [0, 0, "0"], + ], + ) + def test_schema_vector_invalid(vector): with pytest.raises(jsonschema.exceptions.ValidationError): - vector_validator.validate(vector) + Vector.validate_jsondata(vector) @pytest.mark.parametrize( "line", @@ -212,26 +79,48 @@ def test_schema_vector_invalid(vector_validator, vector): {"start": [0, 0, 0], "end": [0, 0, 0], "extra": 0}, ], ) - def test_schema_line_valid(line_validator, line): - line_validator.validate(line) + def test_schema_line_valid(line): + Line.validate_jsondata(line) - @pytest.mark.parametrize("line", [[[0, 0, 0], [0, 0, 0]], {"START": [0, 0, 0], "END": [0, 0, 0]}]) - def test_schema_line_invalid(line_validator, line): + @pytest.mark.parametrize( + "line", + [ + [[0, 0, 0], [0, 0, 0]], + {"START": [0, 0, 0], "END": [0, 0, 0]}, + ], + ) + def test_schema_line_invalid(line): with pytest.raises(jsonschema.exceptions.ValidationError): - line_validator.validate(line) + Line.validate_jsondata(line) - @pytest.mark.parametrize("plane", [{"point": [0, 0, 0], "normal": [0, 0, 1]}]) - def test_schema_plane_valid(plane_validator, plane): - plane_validator.validate(plane) + @pytest.mark.parametrize( + "plane", + [ + {"point": [0, 0, 0], "normal": [0, 0, 1]}, + ], + ) + def test_schema_plane_valid(plane): + Plane.validate_jsondata(plane) - @pytest.mark.parametrize("plane", [[[0, 0, 0], [0, 0, 1]], {"POINT": [0, 0, 0], "NORMAL": [0, 0, 1]}]) - def test_schema_plane_invalid(plane_validator, plane): + @pytest.mark.parametrize( + "plane", + [ + [[0, 0, 0], [0, 0, 1]], + {"POINT": [0, 0, 0], "NORMAL": [0, 0, 1]}, + ], + ) + def test_schema_plane_invalid(plane): with pytest.raises(jsonschema.exceptions.ValidationError): - plane_validator.validate(plane) + Plane.validate_jsondata(plane) - @pytest.mark.parametrize("circle", [{"plane": {"point": [0, 0, 0], "normal": [0, 0, 1]}, "radius": 1.0}]) - def test_schema_circle_valid(circle_validator, circle): - circle_validator.validate(circle) + @pytest.mark.parametrize( + "circle", + [ + {"plane": {"point": [0, 0, 0], "normal": [0, 0, 1]}, "radius": 1.0}, + ], + ) + def test_schema_circle_valid(circle): + Circle.validate_jsondata(circle) @pytest.mark.parametrize( "circle", @@ -241,9 +130,9 @@ def test_schema_circle_valid(circle_validator, circle): {"PLANE": {"point": [0, 0, 0], "normal": [0, 0, 1]}, "RADIUS": 1.0}, ], ) - def test_schema_circle_invalid(circle_validator, circle): + def test_schema_circle_invalid(circle): with pytest.raises(jsonschema.exceptions.ValidationError): - circle_validator.validate(circle) + Circle.validate_jsondata(circle) @pytest.mark.parametrize( "ellipse", @@ -255,8 +144,8 @@ def test_schema_circle_invalid(circle_validator, circle): } ], ) - def test_schema_ellipse_valid(ellipse_validator, ellipse): - ellipse_validator.validate(ellipse) + def test_schema_ellipse_valid(ellipse): + Ellipse.validate_jsondata(ellipse) @pytest.mark.parametrize( "ellipse", @@ -284,9 +173,9 @@ def test_schema_ellipse_valid(ellipse_validator, ellipse): }, ], ) - def test_schema_ellipse_invalid(ellipse_validator, ellipse): + def test_schema_ellipse_invalid(ellipse): with pytest.raises(jsonschema.exceptions.ValidationError): - ellipse_validator.validate(ellipse) + Ellipse.validate_jsondata(ellipse) @pytest.mark.parametrize( "frame", @@ -307,8 +196,8 @@ def test_schema_ellipse_invalid(ellipse_validator, ellipse): }, ], ) - def test_schema_frame_valid(frame_validator, frame): - frame_validator.validate(frame) + def test_schema_frame_valid(frame): + Frame.validate_jsondata(frame) @pytest.mark.parametrize( "frame", @@ -317,9 +206,9 @@ def test_schema_frame_valid(frame_validator, frame): {"point": [0, 0, 0], "xaxis": [1, 0, 0], "zaxis": [0, 0, 1]}, ], ) - def test_schema_frame_invalid(frame_validator, frame): + def test_schema_frame_invalid(frame): with pytest.raises(jsonschema.exceptions.ValidationError): - frame_validator.validate(frame) + Frame.validate_jsondata(frame) @pytest.mark.parametrize( "quaternion", @@ -329,8 +218,8 @@ def test_schema_frame_invalid(frame_validator, frame): {"x": 0, "z": 0, "y": 0, "w": 0}, ], ) - def test_schema_quaternion_valid(quaternion_validator, quaternion): - quaternion_validator.validate(quaternion) + def test_schema_quaternion_valid(quaternion): + Quaternion.validate_jsondata(quaternion) @pytest.mark.parametrize( "quaternion", @@ -341,9 +230,9 @@ def test_schema_quaternion_valid(quaternion_validator, quaternion): {"X": 0, "Y": 0, "Z": 0, "W": 0}, ], ) - def test_schema_quaternion_invalid(quaternion_validator, quaternion): + def test_schema_quaternion_invalid(quaternion): with pytest.raises(jsonschema.exceptions.ValidationError): - quaternion_validator.validate(quaternion) + Quaternion.validate_jsondata(quaternion) @pytest.mark.parametrize( "polygon", @@ -352,8 +241,8 @@ def test_schema_quaternion_invalid(quaternion_validator, quaternion): {"points": [[0, 0, 0], [1, 0, 0], [1, 1, 0]]}, ], ) - def test_schema_polygon_valid(polygon_validator, polygon): - polygon_validator.validate(polygon) + def test_schema_polygon_valid(polygon): + Polygon.validate_jsondata(polygon) @pytest.mark.parametrize( "polygon", @@ -363,9 +252,9 @@ def test_schema_polygon_valid(polygon_validator, polygon): {"POINTS": [[0, 0, 0], [1, 0, 0]]}, ], ) - def test_schema_polygon_invalid(polygon_validator, polygon): + def test_schema_polygon_invalid(polygon): with pytest.raises(jsonschema.exceptions.ValidationError): - polygon_validator.validate(polygon) + Polygon.validate_jsondata(polygon) @pytest.mark.parametrize( "polyline", @@ -374,8 +263,8 @@ def test_schema_polygon_invalid(polygon_validator, polygon): {"points": [[0, 0, 0], [1, 0, 0], [1, 1, 0]]}, ], ) - def test_schema_polyline_valid(polyline_validator, polyline): - polyline_validator.validate(polyline) + def test_schema_polyline_valid(polyline): + Polyline.validate_jsondata(polyline) @pytest.mark.parametrize( "polyline", @@ -385,9 +274,9 @@ def test_schema_polyline_valid(polyline_validator, polyline): {"POINTS": [[0, 0, 0], [1, 0, 0]]}, ], ) - def test_schema_polyline_invalid(polyline_validator, polyline): + def test_schema_polyline_invalid(polyline): with pytest.raises(jsonschema.exceptions.ValidationError): - polyline_validator.validate(polyline) + Polyline.validate_jsondata(polyline) @pytest.mark.parametrize( "box", @@ -400,8 +289,8 @@ def test_schema_polyline_invalid(polyline_validator, polyline): } ], ) - def test_schema_box_valid(box_validator, box): - box_validator.validate(box) + def test_schema_box_valid(box): + Box.validate_jsondata(box) @pytest.mark.parametrize( "box", @@ -432,13 +321,13 @@ def test_schema_box_valid(box_validator, box): }, ], ) - def test_schema_box_invalid(box_validator, box): + def test_schema_box_invalid(box): with pytest.raises(jsonschema.exceptions.ValidationError): - box_validator.validate(box) + Box.validate_jsondata(box) @pytest.mark.parametrize("capsule", [{"line": {"start": [0, 0, 0], "end": [1, 0, 0]}, "radius": 1.0}]) - def test_schema_capsule_valid(capsule_validator, capsule): - capsule_validator.validate(capsule) + def test_schema_capsule_valid(capsule): + Capsule.validate_jsondata(capsule) @pytest.mark.parametrize( "capsule", @@ -449,9 +338,9 @@ def test_schema_capsule_valid(capsule_validator, capsule): {"LINE": {"start": [0, 0, 0], "end": [1, 0, 0]}, "RADIUS": 1.0}, ], ) - def test_schema_capsule_invalid(capsule_validator, capsule): + def test_schema_capsule_invalid(capsule): with pytest.raises(jsonschema.exceptions.ValidationError): - capsule_validator.validate(capsule) + Capsule.validate_jsondata(capsule) @pytest.mark.parametrize( "cone", @@ -465,8 +354,8 @@ def test_schema_capsule_invalid(capsule_validator, capsule): } ], ) - def test_schema_cone_valid(cone_validator, cone): - cone_validator.validate(cone) + def test_schema_cone_valid(cone): + Cone.validate_jsondata(cone) @pytest.mark.parametrize( "cone", @@ -501,9 +390,9 @@ def test_schema_cone_valid(cone_validator, cone): }, ], ) - def test_schema_cone_invalid(cone_validator, cone): + def test_schema_cone_invalid(cone): with pytest.raises(jsonschema.exceptions.ValidationError): - cone_validator.validate(cone) + Cone.validate_jsondata(cone) @pytest.mark.parametrize( "cylinder", @@ -517,8 +406,8 @@ def test_schema_cone_invalid(cone_validator, cone): } ], ) - def test_schema_cylinder_valid(cylinder_validator, cylinder): - cylinder_validator.validate(cylinder) + def test_schema_cylinder_valid(cylinder): + Cylinder.validate_jsondata(cylinder) @pytest.mark.parametrize( "cylinder", @@ -553,9 +442,9 @@ def test_schema_cylinder_valid(cylinder_validator, cylinder): }, ], ) - def test_schema_cylinder_invalid(cylinder_validator, cylinder): + def test_schema_cylinder_invalid(cylinder): with pytest.raises(jsonschema.exceptions.ValidationError): - cylinder_validator.validate(cylinder) + Cylinder.validate_jsondata(cylinder) @pytest.mark.parametrize( "polyhedron", @@ -566,8 +455,8 @@ def test_schema_cylinder_invalid(cylinder_validator, cylinder): }, ], ) - def test_schema_polyhedron_valid(polyhedron_validator, polyhedron): - polyhedron_validator.validate(polyhedron) + def test_schema_polyhedron_valid(polyhedron): + Polyhedron.validate_jsondata(polyhedron) @pytest.mark.parametrize( "polyhedron", @@ -585,13 +474,13 @@ def test_schema_polyhedron_valid(polyhedron_validator, polyhedron): {"vertices": [], "faces": []}, ], ) - def test_schema_polyhedron_invalid(polyhedron_validator, polyhedron): + def test_schema_polyhedron_invalid(polyhedron): with pytest.raises(jsonschema.exceptions.ValidationError): - polyhedron_validator.validate(polyhedron) + Polyhedron.validate_jsondata(polyhedron) @pytest.mark.parametrize("sphere", [{"point": [0, 0, 0], "radius": 1.0}]) - def test_schema_sphere_valid(sphere_validator, sphere): - sphere_validator.validate(sphere) + def test_schema_sphere_valid(sphere): + Sphere.validate_jsondata(sphere) @pytest.mark.parametrize( "sphere", @@ -602,9 +491,9 @@ def test_schema_sphere_valid(sphere_validator, sphere): {"POINT": [0, 0, 0], "RADIUS": 1}, ], ) - def test_schema_sphere_invalid(sphere_validator, sphere): + def test_schema_sphere_invalid(sphere): with pytest.raises(jsonschema.exceptions.ValidationError): - sphere_validator.validate(sphere) + Sphere.validate_jsondata(sphere) @pytest.mark.parametrize( "torus", @@ -616,8 +505,8 @@ def test_schema_sphere_invalid(sphere_validator, sphere): } ], ) - def test_schema_torus_valid(torus_validator, torus): - torus_validator.validate(torus) + def test_schema_torus_valid(torus): + Torus.validate_jsondata(torus) @pytest.mark.parametrize( "torus", @@ -639,9 +528,9 @@ def test_schema_torus_valid(torus_validator, torus): }, ], ) - def test_schema_torus_invalid(torus_validator, torus): + def test_schema_torus_invalid(torus): with pytest.raises(jsonschema.exceptions.ValidationError): - torus_validator.validate(torus) + Torus.validate_jsondata(torus) @pytest.mark.parametrize( "pointcloud", @@ -651,8 +540,8 @@ def test_schema_torus_invalid(torus_validator, torus): {"points": [[0, 0, 0], [0, 0, 0]]}, ], ) - def test_schema_pointcloud_valid(pointcloud_validator, pointcloud): - pointcloud_validator.validate(pointcloud) + def test_schema_pointcloud_valid(pointcloud): + Pointcloud.validate_jsondata(pointcloud) @pytest.mark.parametrize( "pointcloud", @@ -663,9 +552,9 @@ def test_schema_pointcloud_valid(pointcloud_validator, pointcloud): {"POINTS": []}, ], ) - def test_schema_pointcloud_invalid(pointcloud_validator, pointcloud): + def test_schema_pointcloud_invalid(pointcloud): with pytest.raises(jsonschema.exceptions.ValidationError): - pointcloud_validator.validate(pointcloud) + Pointcloud.validate_jsondata(pointcloud) @pytest.mark.parametrize( "graph", @@ -699,8 +588,8 @@ def test_schema_pointcloud_invalid(pointcloud_validator, pointcloud): }, ], ) - def test_schema_graph_valid(graph_validator, graph): - graph_validator.validate(graph) + def test_schema_graph_valid(graph): + Graph.validate_jsondata(graph) @pytest.mark.parametrize( "graph", @@ -772,9 +661,9 @@ def test_schema_graph_valid(graph_validator, graph): }, ], ) - def test_schema_graph_invalid(graph_validator, graph): + def test_schema_graph_invalid(graph): with pytest.raises(jsonschema.exceptions.ValidationError): - graph_validator.validate(graph) + Graph.validate_jsondata(graph) @pytest.mark.parametrize( "halfedge", @@ -859,14 +748,14 @@ def test_schema_graph_invalid(graph_validator, graph): "vertex": {"0": {}, "1": {}, "2": {}}, "face": {"0": [0, 1, 2]}, "facedata": {"0": {}}, - "edgedata": {"0-1": {}}, + "edgedata": {"(0,1)": {}}, "max_vertex": -1, "max_face": -1, }, ], ) - def test_schema_halfedge_valid(halfedge_validator, halfedge): - halfedge_validator.validate(halfedge) + def test_schema_halfedge_valid(halfedge): + HalfEdge.validate_jsondata(halfedge) @pytest.mark.parametrize( "halfedge", @@ -921,9 +810,9 @@ def test_schema_halfedge_valid(halfedge_validator, halfedge): }, ], ) - def test_schema_halfedge_invalid(halfedge_validator, halfedge): + def test_schema_halfedge_invalid(halfedge): with pytest.raises(jsonschema.exceptions.ValidationError): - halfedge_validator.validate(halfedge) + HalfEdge.validate_jsondata(halfedge) @pytest.mark.parametrize( "halfedge", @@ -954,6 +843,6 @@ def test_schema_halfedge_invalid(halfedge_validator, halfedge): }, ], ) - def test_schema_halfedge_failing(halfedge_validator, halfedge): + def test_schema_halfedge_failing(halfedge): with pytest.raises(TypeError): - halfedge_validator.validate(halfedge) + HalfEdge.validate_jsondata(halfedge) diff --git a/tests/compas/datastructures/test_graph.py b/tests/compas/datastructures/test_graph.py index 2b77807cd79..80c69e61416 100644 --- a/tests/compas/datastructures/test_graph.py +++ b/tests/compas/datastructures/test_graph.py @@ -11,7 +11,7 @@ @pytest.fixture def graph(): - edges = [[0, 1], [0, 2], [0, 3], [0, 4]] + edges = [(0, 1), (0, 2), (0, 3), (0, 4)] graph = Graph() for u, v in edges: graph.add_edge(u, v) @@ -32,26 +32,12 @@ def graph(): def test_edgedata_io(graph): graph.update_default_edge_attributes({"index": 0}) - for index, (u, v) in enumerate(graph.edges()): - graph.edge_attribute((u, v), "index", index) + for index, edge in enumerate(graph.edges()): + graph.edge_attribute(edge, "index", index) other = Graph.from_data(graph.data) assert all(other.edge_attribute(edge, "index") == index for index, edge in enumerate(other.edges())) -def test_data_schema(graph): - if compas.IPY: - return - - graph.validate_data() - - -def test_graph_json_schema(graph): - if compas.IPY: - return - - graph.validate_json() - - # ============================================================================== # Tests - Samples # ============================================================================== @@ -66,9 +52,9 @@ def test_node_sample(graph): def test_edge_sample(graph): for edge in graph.edge_sample(): - assert graph.has_edge(*edge) + assert graph.has_edge(edge) for edge in graph.edge_sample(size=graph.number_of_edges()): - assert graph.has_edge(*edge) + assert graph.has_edge(edge) # ============================================================================== diff --git a/tests/compas/datastructures/test_halfedge.py b/tests/compas/datastructures/test_halfedge.py index 388eb109a38..894330e995e 100644 --- a/tests/compas/datastructures/test_halfedge.py +++ b/tests/compas/datastructures/test_halfedge.py @@ -1,8 +1,6 @@ import pytest import random -import compas - from compas.geometry import Sphere from compas.geometry import Box @@ -82,16 +80,6 @@ def test_edgedata_io(mesh): assert all(other.edge_attribute(edge, "index") == index for index, edge in enumerate(other.edges())) -def test_data_schema(mesh): - if not compas.IPY: - mesh.validate_data() - - -def test_json_schema(mesh): - if not compas.IPY: - mesh.validate_json() - - # ============================================================================== # Tests - Samples # ============================================================================== @@ -139,12 +127,12 @@ def test_vertex_attributes_key_not_found(mesh): def test_vertex_attributes_from_defaults(mesh): mesh.update_default_vertex_attributes({"foo": "bar"}) - assert mesh.vertex_attributes(mesh.get_any_vertex())["foo"] == "bar" + assert mesh.vertex_attributes(mesh.vertex_sample(size=1)[0])["foo"] == "bar" def test_vertex_attributes_not_in_defaults(mesh): mesh.update_default_vertex_attributes({"foo": "bar"}) - attrs = mesh.vertex_attributes(mesh.get_any_vertex()) + attrs = mesh.vertex_attributes(mesh.vertex_sample(size=1)[0]) with pytest.raises(KeyError): attrs["baz"] @@ -184,17 +172,17 @@ def test_default_face_attributes(): def test_face_attributes_is_empty(mesh): - assert mesh.face_attributes(mesh.get_any_face()) == {} + assert mesh.face_attributes(mesh.face_sample(size=1)[0]) == {} def test_face_attributes_from_defaults(mesh): mesh.update_default_face_attributes({"foo": "bar"}) - assert mesh.face_attributes(mesh.get_any_face())["foo"] == "bar" + assert mesh.face_attributes(mesh.face_sample(size=1)[0])["foo"] == "bar" def test_face_attributes_not_in_defaults(mesh): mesh.update_default_face_attributes({"foo": "bar"}) - attrs = mesh.face_attributes(mesh.get_any_face()) + attrs = mesh.face_attributes(mesh.face_sample(size=1)[0]) with pytest.raises(KeyError): attrs["baz"] @@ -279,10 +267,10 @@ def test_halfedge_after_on_boundary(grid): corner = corners[0] nbrs = grid.vertex_neighbors(corner, ordered=True) nbr = nbrs[-1] - edge = grid.halfedge_after(nbr, corner) + edge = grid.halfedge_after((nbr, corner)) assert edge[0] == corner - assert grid.is_edge_on_boundary(*edge) - assert grid.halfedge_face(*edge) is None + assert grid.is_edge_on_boundary(edge) + assert grid.halfedge_face(edge) is None def test_halfedge_before_on_boundary(grid): @@ -290,10 +278,10 @@ def test_halfedge_before_on_boundary(grid): corner = corners[0] nbrs = grid.vertex_neighbors(corner, ordered=True) nbr = nbrs[0] - edge = grid.halfedge_before(corner, nbr) + edge = grid.halfedge_before((corner, nbr)) assert edge[1] == corner - assert grid.is_edge_on_boundary(*edge) - assert grid.halfedge_face(*edge) is None + assert grid.is_edge_on_boundary(edge) + assert grid.halfedge_face(edge) is None # ============================================================================== @@ -318,7 +306,7 @@ def test_loops_and_strips_closed(sphere): assert strip[0] == strip[-1] for edge in meridian[1:-1]: - ring = sphere.edge_loop(sphere.halfedge_before(*edge)) + ring = sphere.edge_loop(sphere.halfedge_before(edge)) assert len(ring) == 16, ring assert ring[0][0] == ring[-1][1] @@ -333,8 +321,8 @@ def test_loops_and_strips_open(grid): assert edge in strip assert len(strip) == 11 - assert grid.is_edge_on_boundary(*strip[0]) - assert grid.is_edge_on_boundary(*strip[-1]) + assert grid.is_edge_on_boundary(strip[0]) + assert grid.is_edge_on_boundary(strip[-1]) assert edge in loop assert len(loop) == 10 @@ -351,8 +339,8 @@ def test_loops_and_strips_open_corner(grid): assert edge in strip assert len(strip) == 11 - assert grid.is_edge_on_boundary(*strip[0]) - assert grid.is_edge_on_boundary(*strip[-1]) + assert grid.is_edge_on_boundary(strip[0]) + assert grid.is_edge_on_boundary(strip[-1]) assert edge == strip[-1] assert edge in loop @@ -365,8 +353,8 @@ def test_loops_and_strips_open_corner(grid): assert edge in strip assert len(strip) == 11 - assert grid.is_edge_on_boundary(*strip[0]) - assert grid.is_edge_on_boundary(*strip[-1]) + assert grid.is_edge_on_boundary(strip[0]) + assert grid.is_edge_on_boundary(strip[-1]) assert edge == strip[0] assert edge in loop @@ -385,8 +373,8 @@ def test_loops_and_strips_open_boundary(grid): assert edge in strip assert len(strip) == 11 - assert grid.is_edge_on_boundary(*strip[0]) - assert grid.is_edge_on_boundary(*strip[-1]) + assert grid.is_edge_on_boundary(strip[0]) + assert grid.is_edge_on_boundary(strip[-1]) assert edge in loop assert len(loop) == 10 @@ -432,7 +420,7 @@ def test_strip_faces_closed(box): assert len(strip) == 5 assert len(faces) == 4 - assert box.edge_faces(*strip[0]) == box.edge_faces(*strip[-1]) + assert box.edge_faces(strip[0]) == box.edge_faces(strip[-1]) def test_strip_faces_open(grid): diff --git a/tests/compas/datastructures/test_mesh.py b/tests/compas/datastructures/test_mesh.py index 81bc2975a57..a69d9c39fd0 100644 --- a/tests/compas/datastructures/test_mesh.py +++ b/tests/compas/datastructures/test_mesh.py @@ -468,14 +468,14 @@ def test_has_edge(cube): def test_edge_faces(cube): - u, v = next(cube.edges()) - assert len(cube.edge_faces(u, v)) == 2 + edge = next(cube.edges()) + assert len(cube.edge_faces(edge)) == 2 def test_is_edge_on_boundary(): mesh = Mesh.from_obj(compas.get("faces.obj")) - assert mesh.is_edge_on_boundary(0, 1) - assert not mesh.is_edge_on_boundary(15, 16) + assert mesh.is_edge_on_boundary((0, 1)) + assert not mesh.is_edge_on_boundary((15, 16)) # -------------------------------------------------------------------------- @@ -600,7 +600,6 @@ def test_vertex_area(): def test_vertex_laplacian(): - mesh = Mesh.from_obj(compas.get("faces.obj")) assert mesh.vertex_laplacian(0) == [1.0, 1.0, 0.0] assert mesh.vertex_laplacian(1) == [0.0, 0.6666666666666666, 0.0] @@ -773,7 +772,7 @@ def test_faces_on_boundaries_triangleboundarychain(triangleboundarychain): def test_face_attributes_includes_all_defaults(box): box.update_default_face_attributes({"attr1": "value1", "attr2": "value2"}) - random_fkey = box.get_any_face() + random_fkey = box.face_sample(size=1)[0] assert sorted(box.face_attributes(random_fkey).keys()) == ["attr1", "attr2"] box.face_attribute(random_fkey, "attr3", "value3") diff --git a/tests/compas/datastructures/test_mesh_operations.py b/tests/compas/datastructures/test_mesh_operations.py index fddaa9f9d7b..22385d3d721 100644 --- a/tests/compas/datastructures/test_mesh_operations.py +++ b/tests/compas/datastructures/test_mesh_operations.py @@ -35,13 +35,13 @@ def mesh_quads(): def test_insert_vertex_on_edge(mesh_0): - mesh_insert_vertex_on_edge(mesh_0, 0, 1) + mesh_insert_vertex_on_edge(mesh_0, (0, 1)) assert len(mesh_0.face_vertices(0)) == 4 assert len(mesh_0.face_vertices(1)) == 4 assert mesh_0.face_vertex_descendant(0, 0) == 5 assert mesh_0.face_vertex_descendant(1, 1) == 5 - mesh_insert_vertex_on_edge(mesh_0, 0, 2, 4) + mesh_insert_vertex_on_edge(mesh_0, (0, 2), 4) assert len(mesh_0.face_vertices(0)) == 5 assert mesh_0.face_vertex_descendant(0, 2) == 4 diff --git a/tests/compas/datastructures/test_network.py b/tests/compas/datastructures/test_network.py index 31308018ad1..6c6c38e55a3 100644 --- a/tests/compas/datastructures/test_network.py +++ b/tests/compas/datastructures/test_network.py @@ -50,5 +50,5 @@ def test_planar(k5_network): from compas.datastructures import network_is_planar - k5_network.delete_edge("a", "b") # Delete (a, b) edge to make K5 planar + k5_network.delete_edge(("a", "b")) # Delete (a, b) edge to make K5 planar assert network_is_planar(k5_network) is True diff --git a/tests/compas/datastructures/test_volmesh.py b/tests/compas/datastructures/test_volmesh.py index f2ab2412fd3..ad4abb338f9 100644 --- a/tests/compas/datastructures/test_volmesh.py +++ b/tests/compas/datastructures/test_volmesh.py @@ -3,36 +3,17 @@ def test_volmesh_data(): - - # if not os.path.exists("temp"): - # os.mkdir("temp") - vmesh1 = VolMesh.from_obj(compas.get("boxes.obj")) data1 = vmesh1.to_data() - - # vmesh1.to_json('temp/vmesh1.json') - # vmesh1.from_json('temp/vmesh1.json') - - # vmesh1.validate_data() - # vmesh1.validate_json() - data1_ = vmesh1.to_data() assert data1 == data1_ vmesh2 = VolMesh.from_data(data1_) - # vmesh2.validate_data() - # vmesh2.validate_json() - data2 = vmesh2.to_data() - - # vmesh2.to_json('temp/vmesh2.json') - # vmesh2.from_json('temp/vmesh2.json') - data2_ = vmesh2.to_data() assert data2 == data2_ - assert data1 == data2 diff --git a/tests/compas/geometry/predicates/test_predicates_2.py b/tests/compas/geometry/predicates/test_predicates_2.py index 310a1a0f617..a3102a98f09 100644 --- a/tests/compas/geometry/predicates/test_predicates_2.py +++ b/tests/compas/geometry/predicates/test_predicates_2.py @@ -1,8 +1,10 @@ from compas.geometry import Circle from compas.geometry import Plane from compas.geometry import Point +from compas.geometry import Polygon from compas.geometry import Vector -from compas.geometry import is_point_in_circle_xy +from compas.geometry import is_point_in_circle_xy, is_polygon_in_polygon_xy +from compas.geometry.predicates.predicates_2 import polygon_to_polygon_relationship_xy, point_to_polygon_relationship_xy, is_intersection_polygon_polygon_xy def test_is_point_in_circle_xy(): @@ -24,3 +26,89 @@ def test_is_point_in_circle_xy_class_input(): pt_outside = Point(15, 15, 0) assert is_point_in_circle_xy(pt_outside, circle) is False + + +def test_is_polygon_in_polygon_xy(): + polygon_contour = Polygon([(0, 0, 0), (4, 2, 0), (10, 0, 0), (11, 10, 0), (8, 12, 0), (0, 10, 0)]) + polygon_inside = Polygon([(5, 5, 0), (10, 5, 0), (10, 10, 0), (5, 10, 0)]) + assert is_polygon_in_polygon_xy(polygon_contour, polygon_inside) + + polygon_outside = Polygon([(15, 5, 0), (20, 5, 0), (20, 10, 0), (15, 10, 0)]) + assert not is_polygon_in_polygon_xy(polygon_contour, polygon_outside) + + polygon_intersecting = Polygon([(10, 10, 0), (10, 5, 0), (15, 5, 0), (15, 10, 0)]) + assert not is_polygon_in_polygon_xy(polygon_contour, polygon_intersecting) + + # shifting the vertices list of the same polygon shouldn't affect the containment check output anymore + polygon_intersecting_shifted = Polygon(polygon_intersecting[1:] + polygon_intersecting[:1]) + assert not is_polygon_in_polygon_xy(polygon_contour, polygon_intersecting_shifted) + + +def test_polygon_to_polygon_relationship_xy(): + polygon_contour = Polygon([(0, 0, 0), (4, 2, 0), (10, 0, 0), (11, 10, 0), (8, 12, 0), (0, 10, 0)]) + polygon_inside = Polygon([(5, 5, 0), (10, 5, 0), (10, 10 ,0), (5, 10, 0)]) + polygon_intersecting = Polygon([(10, 10, 0), (10, 5, 0), (15, 5, 0), (15, 10, 0)]) + polygon_outside = Polygon([(15, 5, 0), (20, 5, 0), (20, 10, 0), (15, 10, 0)]) + polygon_containing = Polygon([(-5, -5, 0), (15, -5, 0), (15, 15, 0), (-5, 15, 0)]) + + assert polygon_to_polygon_relationship_xy(polygon_inside, polygon_contour) == 1 + assert polygon_to_polygon_relationship_xy(polygon_intersecting, polygon_contour) == 0 + assert polygon_to_polygon_relationship_xy(polygon_outside, polygon_contour) == -1 + assert polygon_to_polygon_relationship_xy(polygon_containing, polygon_contour) == -2 + + +def test_point_to_polygon_relationship_xy(): + polygon = Polygon([(0, 0, 0), (4, 0, 0), (4, 4, 0), (0, 4, 0)]) + pt_inside = Point(1, 2, 0) + pt_boundary = Point(2, 0, 0) + pt_outside = Point(5, 5, 0) + + assert point_to_polygon_relationship_xy(pt_inside, polygon) == 1 + assert point_to_polygon_relationship_xy(pt_boundary, polygon) == 0 + assert point_to_polygon_relationship_xy(pt_outside, polygon) == -1 + + +def test_is_intersection_polygon_polygon_xy(): + polygon_contour = Polygon([(0, 0, 0), (4, 2, 0), (10, 0, 0), (11, 10, 0), (8, 12, 0), (0, 10, 0)]) + polygon_inside = Polygon([(5, 5, 0), (10, 5, 0), (10, 10 ,0), (5, 10, 0)]) + polygon_intersecting = Polygon([(10, 10, 0), (10, 5, 0), (15, 5, 0), (15, 10, 0)]) + polygon_outside = Polygon([(15, 5, 0), (20, 5, 0), (20, 10, 0), (15, 10, 0)]) + + assert is_intersection_polygon_polygon_xy(polygon_inside, polygon_contour) is False + assert is_intersection_polygon_polygon_xy(polygon_intersecting, polygon_contour) is True + assert is_intersection_polygon_polygon_xy(polygon_outside, polygon_contour) is False + + +def test_polygon_to_polygon_relationship_xy(): + polygon_contour = Polygon([(0, 0, 0), (4, 2, 0), (10, 0, 0), (11, 10, 0), (8, 12, 0), (0, 10, 0)]) + polygon_inside = Polygon([(5, 5, 0), (10, 5, 0), (10, 10 ,0), (5, 10, 0)]) + polygon_intersecting = Polygon([(10, 10, 0), (10, 5, 0), (15, 5, 0), (15, 10, 0)]) + polygon_outside = Polygon([(15, 5, 0), (20, 5, 0), (20, 10, 0), (15, 10, 0)]) + polygon_containing = Polygon([(-5, -5, 0), (15, -5, 0), (15, 15, 0), (-5, 15, 0)]) + + assert polygon_to_polygon_relationship_xy(polygon_inside, polygon_contour) == 1 + assert polygon_to_polygon_relationship_xy(polygon_intersecting, polygon_contour) == 0 + assert polygon_to_polygon_relationship_xy(polygon_outside, polygon_contour) == -1 + assert polygon_to_polygon_relationship_xy(polygon_containing, polygon_contour) == -2 + + +def test_point_to_polygon_relationship_xy(): + polygon = Polygon([(0, 0, 0), (4, 0, 0), (4, 4, 0), (0, 4, 0)]) + pt_inside = Point(1, 2, 0) + pt_boundary = Point(2, 0, 0) + pt_outside = Point(5, 5, 0) + + assert point_to_polygon_relationship_xy(pt_inside, polygon) == 1 + assert point_to_polygon_relationship_xy(pt_boundary, polygon) == 0 + assert point_to_polygon_relationship_xy(pt_outside, polygon) == -1 + + +def test_is_intersection_polygon_polygon_xy(): + polygon_contour = Polygon([(0, 0, 0), (4, 2, 0), (10, 0, 0), (11, 10, 0), (8, 12, 0), (0, 10, 0)]) + polygon_inside = Polygon([(5, 5, 0), (10, 5, 0), (10, 10 ,0), (5, 10, 0)]) + polygon_intersecting = Polygon([(10, 10, 0), (10, 5, 0), (15, 5, 0), (15, 10, 0)]) + polygon_outside = Polygon([(15, 5, 0), (20, 5, 0), (20, 10, 0), (15, 10, 0)]) + + assert is_intersection_polygon_polygon_xy(polygon_inside, polygon_contour) is False + assert is_intersection_polygon_polygon_xy(polygon_intersecting, polygon_contour) is True + assert is_intersection_polygon_polygon_xy(polygon_outside, polygon_contour) is False \ No newline at end of file diff --git a/tests/compas/geometry/test_frame.py b/tests/compas/geometry/test_frame.py new file mode 100644 index 00000000000..77d96adf2df --- /dev/null +++ b/tests/compas/geometry/test_frame.py @@ -0,0 +1,10 @@ +from compas.geometry import Frame + + +def test_axes_are_orthonormal(): + pt = [1, 2, 3] + vec1 = [1, 0, 0] + vec2 = [0, 0.9, 0] + + frame = Frame(pt, vec1, vec2) + assert frame == [[1, 2, 3], [1, 0, 0], [0, 1, 0]] diff --git a/tests/compas/geometry/test_plane.py b/tests/compas/geometry/test_plane.py new file mode 100644 index 00000000000..ec84e9bbf08 --- /dev/null +++ b/tests/compas/geometry/test_plane.py @@ -0,0 +1,19 @@ +from compas.geometry import Plane + + +def test_from_point_and_two_vectors(): + pt = [1, 2, 3] + vec1 = [1, 0, 0] + vec2 = [0, 1, 0] + + result = Plane.from_point_and_two_vectors(pt, vec1, vec2) + assert result == [[1, 2, 3], [0, 0, 1]] + + +def test_from_three_points(): + pt1 = [0, 0, 0] + pt2 = [1, 0, 0] + pt3 = [0, 1, 0] + + result = Plane.from_three_points(pt1, pt2, pt3) + assert result == ([0, 0, 0], [0, 0, 1]) diff --git a/tests/compas/geometry/test_point.py b/tests/compas/geometry/test_point.py index 58d33122511..a487d855089 100644 --- a/tests/compas/geometry/test_point.py +++ b/tests/compas/geometry/test_point.py @@ -1,18 +1,6 @@ -import compas from compas.geometry import Point -if not compas.IPY: - - def test_data(): - p = Point(0, 0, "0") - assert p.data == p.validate_data() - o = Point.from_data(p.data) - assert p == o - assert not (p is o) - assert o.data == o.validate_data() - - def test_point(): p = Point(1, 0, "0") assert p.x == 1.0 and p.y == 0.0 and p.z == 0.0 diff --git a/tests/compas/geometry/test_pointcloud.py b/tests/compas/geometry/test_pointcloud.py index 2fe1b3bec52..63de3128374 100644 --- a/tests/compas/geometry/test_pointcloud.py +++ b/tests/compas/geometry/test_pointcloud.py @@ -1,20 +1,7 @@ import random -import compas - from compas.geometry import Pointcloud -if not compas.IPY: - - def test_data(): - p = Pointcloud.from_bounds(10, 10, 10, 100) - assert p.data == p.validate_data() - o = Pointcloud.from_data(p.data) - assert p == o - assert not (p is o) - assert o.data == o.validate_data() - - def test_equality(): a = Pointcloud.from_bounds(10, 10, 10, 10) points = a.points[:] diff --git a/tests/compas/geometry/test_polygon.py b/tests/compas/geometry/test_polygon.py index db621bdbe28..f35c0b6a159 100644 --- a/tests/compas/geometry/test_polygon.py +++ b/tests/compas/geometry/test_polygon.py @@ -1,5 +1,3 @@ -import random -import compas import pytest from compas.geometry import Point @@ -7,17 +5,6 @@ from compas.utilities import pairwise -if not compas.IPY: - - def test_data(): - p = Polygon([Point(random.random(), random.random(), random.random()) for i in range(10)]) - assert p.data == p.validate_data() - o = Polygon.from_data(p.data) - assert p == o - assert not (p is o) - assert o.data == o.validate_data() - - def test_polygon(): points = [[0, 0, x] for x in range(5)] polygon = Polygon(points) diff --git a/tests/compas/geometry/test_polyline.py b/tests/compas/geometry/test_polyline.py index 4e3cc90f5fa..c4e34238413 100644 --- a/tests/compas/geometry/test_polyline.py +++ b/tests/compas/geometry/test_polyline.py @@ -1,24 +1,11 @@ import math import pytest -import random -import compas from compas.geometry import Point from compas.geometry import Polyline from compas.utilities import pairwise -if not compas.IPY: - - def test_data(): - p = Polyline([Point(random.random(), random.random(), random.random()) for i in range(10)]) - assert p.data == p.validate_data() - o = Polyline.from_data(p.data) - assert p == o - assert not (p is o) - assert o.data == o.validate_data() - - def test_polyline(): points = [[0, 0, x] for x in range(5)] polyline = Polyline(points) @@ -196,6 +183,165 @@ def test_polyline_split_at_corners(coords, input, expected): assert expected == Polyline(coords).split_at_corners(input) +@pytest.mark.parametrize( + "coords,segments_number,expected", + [ + ( + [[0.0, 0.0, 0.0], [100.0, 0.0, 0.0]], + 5, + [ + ([0.0, 0.0, 0.0], [20.0, 0.0, 0.0]), + ([20.0, 0.0, 0.0], [40.0, 0.0, 0.0]), + ([40.0, 0.0, 0.0], [60.0, 0.0, 0.0]), + ([60.0, 0.0, 0.0], [80.0, 0.0, 0.0]), + ([80.0, 0.0, 0.0], [100.0, 0.0, 0.0]), + ], + ), + ( + [[0.0, 0.0, 0.0], [100.0, 0.0, 0.0], [300.0, 0.0, 0.0]], + 5, + [ + ([0.0, 0.0, 0.0], [60.0, 0.0, 0.0]), + ([60.0, 0.0, 0.0], [100.0, 0.0, 0.0], [120.0, 0.0, 0.0]), + ([120.0, 0.0, 0.0], [180.0, 0.0, 0.0]), + ([180.0, 0.0, 0.0], [240.0, 0.0, 0.0]), + ([240.0, 0.0, 0.0], [300.0, 0.0, 0.0]), + ], + ), + ( + [ + [0.0, 0.0, 0.0], + [200.0, 0.0, 0.0], + [200.0, 200.0, 0.0], + [0.0, 200.0, 0.0], + [0.0, 0.0, 0.0], + ], + 5, + [ + ([0.0, 0.0, 0.0], [160.0, 0.0, 0.0]), + ([160.0, 0.0, 0.0], [200.0, 0.0, 0.0], [200.0, 120.0, 0.0]), + ([200.0, 120.0, 0.0], [200.0, 200.0, 0.0], [120.0, 200.0, 0.0]), + ([120.0, 200.0, 0.0], [0.0, 200.0, 0.0], [0.0, 160.0, 0.0]), + ([0.0, 160.0, 0.0], [0.0, 0.0, 0.0]), + ], + ), + ([[0.0, 0.0, 0.0], [100.0, 0.0, 0.0]], 1, [([0.0, 0.0, 0.0], [100.0, 0.0, 0.0])]), + ([[0.0, 0.0, 0.0], [100.0, 0.0, 0.0]], 0, "error"), + ], +) +def test_polyline_split(coords, segments_number, expected): + if segments_number > 0: + assert expected == Polyline(coords).split(segments_number) + else: + pytest.raises(ValueError) + + +@pytest.mark.parametrize( + "coords,length,expected", + [ + ( + [[0.0, 0.0, 0.0], [100.0, 0.0, 0.0]], + 70, + [ + ([0.0, 0.0, 0.0], [70.0, 0.0, 0.0]), + ([70.0, 0.0, 0.0], [100.0, 0.0, 0.0]), + ], + ), + ( + [[0.0, 0.0, 0.0], [100.0, 0.0, 0.0], [300.0, 0.0, 0.0]], + 70, + [ + ([0.0, 0.0, 0.0], [70.0, 0.0, 0.0]), + ([70.0, 0.0, 0.0], [100.0, 0.0, 0.0], [140.0, 0.0, 0.0]), + ([140.0, 0.0, 0.0], [210.0, 0.0, 0.0]), + ([210.0, 0.0, 0.0], [280.0, 0.0, 0.0]), + ([280.0, 0.0, 0.0], [300.0, 0.0, 0.0]), + ], + ), + ( + [ + [0.0, 0.0, 0.0], + [100.0, 0.0, 0.0], + [100.0, 100.0, 0.0], + [0.0, 100.0, 0.0], + [0.0, 0.0, 0.0], + ], + 70, + [ + ([0.0, 0.0, 0.0], [70.0, 0.0, 0.0]), + ([70.0, 0.0, 0.0], [100.0, 0.0, 0.0], [100.0, 40.0, 0.0]), + ([100.0, 40.0, 0.0], [100.0, 100.0, 0.0], [90.0, 100.0, 0.0]), + ( + [90.0, 100.0, 0.0], + [20.0, 100.0, 0.0], + ), + ([20.0, 100.0, 0.0], [0.0, 100.0, 0.0], [0.0, 50.0, 0.0]), + ([0.0, 50.0, 0.0], [0.0, 0.0, 0.0]), + ], + ), + ( + [[0.0, 0.0, 0.0], [60.0, 0.0, 0.0]], + 70, + "error", + ), + ( + [[0.0, 0.0, 0.0], [60.0, 0.0, 0.0]], + 0, + "error", + ), + ], +) +def test_polyline_split_by_length_strict1(coords, length, expected): + polyline = Polyline(coords) + if length > 0 and length < polyline.length: + assert expected == polyline.split_by_length(length, strict=False) + else: + pytest.raises(ValueError) + + +@pytest.mark.parametrize( + "coords,expected", + [ + ( + [[0.0, 0.0, 0.0], [100.0, 0.0, 0.0]], + [ + ([0.0, 0.0, 0.0], [70.0, 0.0, 0.0]), + ], + ), + ( + [[0.0, 0.0, 0.0], [100.0, 0.0, 0.0], [300.0, 0.0, 0.0]], + [ + ([0.0, 0.0, 0.0], [70.0, 0.0, 0.0]), + ([70.0, 0.0, 0.0], [100.0, 0.0, 0.0], [140.0, 0.0, 0.0]), + ([140.0, 0.0, 0.0], [210.0, 0.0, 0.0]), + ([210.0, 0.0, 0.0], [280.0, 0.0, 0.0]), + ], + ), + ( + [ + [0.0, 0.0, 0.0], + [100.0, 0.0, 0.0], + [100.0, 100.0, 0.0], + [0.0, 100.0, 0.0], + [0.0, 0.0, 0.0], + ], + [ + ([0.0, 0.0, 0.0], [70.0, 0.0, 0.0]), + ([70.0, 0.0, 0.0], [100.0, 0.0, 0.0], [100.0, 40.0, 0.0]), + ([100.0, 40.0, 0.0], [100.0, 100.0, 0.0], [90.0, 100.0, 0.0]), + ( + [90.0, 100.0, 0.0], + [20.0, 100.0, 0.0], + ), + ([20.0, 100.0, 0.0], [0.0, 100.0, 0.0], [0.0, 50.0, 0.0]), + ], + ), + ], +) +def test_polyline_split_by_length_strict2(coords, expected): + assert expected == Polyline(coords).split_by_length(70, strict=True) + + @pytest.mark.parametrize( "coords,input,expected", [ diff --git a/tests/compas/geometry/test_vector.py b/tests/compas/geometry/test_vector.py new file mode 100644 index 00000000000..e617a7500db --- /dev/null +++ b/tests/compas/geometry/test_vector.py @@ -0,0 +1,18 @@ +from compas.geometry import Vector + + +def test_cross_vectors(): + vec_list1 = [[1, 2, 3], [7, 8, 9]] + vec_list2 = [[2, 3, 4], [5, 6, 7]] + + result = Vector.cross_vectors(vec_list1, vec_list2) + assert result == [[-1, 2, -1], [2, -4, 2]] + + +def test_cross(): + vec1 = Vector(1, 2, 3) + vec2 = [5, 6, 7] + + result = vec1.cross(vec2) + assert result == (-4, 8, -4) + assert result == Vector(-4, 8, -4) diff --git a/tests/compas/stubs.py b/tests/compas/stubs.py index e1cd305fc69..35d6741c0da 100644 --- a/tests/compas/stubs.py +++ b/tests/compas/stubs.py @@ -81,5 +81,4 @@ def check_compas_stubs(api, stubs): # ============================================================================== if __name__ == "__main__": - check_compas_stubs(compas_api(), compas_stubs()) diff --git a/tests/compas/test_api_completeness.py b/tests/compas/test_api_completeness.py index 5b3db39da3d..7db2f3429d1 100644 --- a/tests/compas/test_api_completeness.py +++ b/tests/compas/test_api_completeness.py @@ -1,116 +1,116 @@ -from __future__ import absolute_import - -import os -import pytest -import shutil -import subprocess -import importlib -import inspect -import compas - - -def get_names_in_module(module_name): - exceptions = ["absolute_import", "division", "print_function"] - module = importlib.import_module(module_name) - all_names = module.__all__ if hasattr(module, "__all__") else dir(module) - return sorted( - [ - i - for i in all_names - if not i.startswith("_") and i not in exceptions and not inspect.ismodule(getattr(module, i)) - ] - ) - - -@pytest.fixture -def compas_api(): - if compas.IPY: - return - - modules = [ - "compas.data", - "compas.datastructures", - "compas.files", - "compas.geometry", - "compas.numerical", - "compas.plugins", - "compas.robots", - "compas.rpc", - "compas.topology", - "compas.utilities", - ] - api = {} - for module_name in modules: - api[module_name] = get_names_in_module(module_name) - return api - - -@pytest.fixture -def compas_stubs(): - if compas.IPY: - return - - env = compas._os.prepare_environment() - - HERE = os.path.dirname(__file__) - HOME = os.path.abspath(os.path.join(HERE, "../..")) - TEMP = os.path.abspath(os.path.join(HOME, "temp/stubs")) - DOCS = os.path.abspath(os.path.join(HOME, "docs")) - API = os.path.abspath(os.path.join(DOCS, "api")) - - shutil.rmtree(TEMP, ignore_errors=True) - - _, _, filenames = next(os.walk(API)) - stubs = [] - for name in filenames: - if name == "compas.rst" or not name.startswith("compas."): - continue - stub = os.path.abspath(os.path.join(API, name)) - subprocess.call("sphinx-autogen -o {} {}".format(TEMP, stub), shell=True, env=env) - - _, _, filenames = next(os.walk(TEMP)) - - shutil.rmtree(TEMP, ignore_errors=True) - - stubs = {} - for name in filenames: - parts = name.split(".") - if len(parts) != 4: - continue - package = parts[0] - module = parts[1] - item = parts[2] - if package == "compas": - packmod = "{}.{}".format(package, module) - if packmod not in stubs: - stubs[packmod] = [] - stubs[packmod].append(item) - - return stubs - - -def test_compas_api_stubs(compas_api, compas_stubs): - if compas.IPY: - return - - for packmod in compas_api: - parts = packmod.split(".") - if len(parts) != 2: - continue - assert packmod in compas_stubs - for name in compas_api[packmod]: - if name in [ - "BaseMesh", - "BaseNetwork", - "BaseVolMesh", - "Datastructure", - "Graph", - "HalfEdge", - "HalfFace", - ]: - continue - if parts[1] == "plugins": - continue - if parts[1] == "utilities": - continue - assert name in compas_stubs[packmod] +# from __future__ import absolute_import + +# import os +# import pytest +# import shutil +# import subprocess +# import importlib +# import inspect +# import compas + + +# def get_names_in_module(module_name): +# exceptions = ["absolute_import", "division", "print_function"] +# module = importlib.import_module(module_name) +# all_names = module.__all__ if hasattr(module, "__all__") else dir(module) +# return sorted( +# [ +# i +# for i in all_names +# if not i.startswith("_") and i not in exceptions and not inspect.ismodule(getattr(module, i)) +# ] +# ) + + +# @pytest.fixture +# def compas_api(): +# if compas.IPY: +# return + +# modules = [ +# "compas.data", +# "compas.datastructures", +# "compas.files", +# "compas.geometry", +# "compas.numerical", +# "compas.plugins", +# "compas.robots", +# "compas.rpc", +# "compas.topology", +# "compas.utilities", +# ] +# api = {} +# for module_name in modules: +# api[module_name] = get_names_in_module(module_name) +# return api + + +# @pytest.fixture +# def compas_stubs(): +# if compas.IPY: +# return + +# env = compas._os.prepare_environment() + +# HERE = os.path.dirname(__file__) +# HOME = os.path.abspath(os.path.join(HERE, "../..")) +# TEMP = os.path.abspath(os.path.join(HOME, "temp/stubs")) +# DOCS = os.path.abspath(os.path.join(HOME, "docs")) +# API = os.path.abspath(os.path.join(DOCS, "reference")) + +# shutil.rmtree(TEMP, ignore_errors=True) + +# _, _, filenames = next(os.walk(API)) +# stubs = [] +# for name in filenames: +# if name == "compas.rst" or not name.startswith("compas."): +# continue +# stub = os.path.abspath(os.path.join(API, name)) +# subprocess.call("sphinx-autogen -o {} {}".format(TEMP, stub), shell=True, env=env) + +# _, _, filenames = next(os.walk(TEMP)) + +# shutil.rmtree(TEMP, ignore_errors=True) + +# stubs = {} +# for name in filenames: +# parts = name.split(".") +# if len(parts) != 4: +# continue +# package = parts[0] +# module = parts[1] +# item = parts[2] +# if package == "compas": +# packmod = "{}.{}".format(package, module) +# if packmod not in stubs: +# stubs[packmod] = [] +# stubs[packmod].append(item) + +# return stubs + + +# def test_compas_api_stubs(compas_api, compas_stubs): +# if compas.IPY: +# return + +# for packmod in compas_api: +# parts = packmod.split(".") +# if len(parts) != 2: +# continue +# assert packmod in compas_stubs +# for name in compas_api[packmod]: +# if name in [ +# "BaseMesh", +# "BaseNetwork", +# "BaseVolMesh", +# "Datastructure", +# "Graph", +# "HalfEdge", +# "HalfFace", +# ]: +# continue +# if parts[1] == "plugins": +# continue +# if parts[1] == "utilities": +# continue +# assert name in compas_stubs[packmod] diff --git a/tests/compas/test_api_stability.py b/tests/compas/test_api_stability.py index c82e8c373cf..a0fcbf310ac 100644 --- a/tests/compas/test_api_stability.py +++ b/tests/compas/test_api_stability.py @@ -70,7 +70,7 @@ def get_names_in_module(module_name): modules = [ "compas", - "compas.base", + "compas.data", "compas.datastructures", "compas.files", "compas.geometry", diff --git a/tests/compas/topology/test_traversal.py b/tests/compas/topology/test_traversal.py index d3af4677f84..ffe1db3aa06 100644 --- a/tests/compas/topology/test_traversal.py +++ b/tests/compas/topology/test_traversal.py @@ -43,7 +43,7 @@ def test_astar_shortest_path_disconnected(): def test_astar_shortest_path_mesh(): mesh = Mesh.from_shape(Box(Frame.worldXY(), 1, 1, 1)) - a, b = mesh.get_any_vertices(2) + a, b = mesh.vertex_sample(size=2) path = astar_shortest_path(mesh, a, b) assert path is not None diff --git a/tests/compas/utilities/test_itertools.py b/tests/compas/utilities/test_itertools.py index b5026a0d8ac..8c42a330f1c 100644 --- a/tests/compas/utilities/test_itertools.py +++ b/tests/compas/utilities/test_itertools.py @@ -3,6 +3,9 @@ from compas.datastructures import Mesh from compas.utilities import iterable_like +from compas.utilities import reshape +from compas.utilities import flatten +from compas.geometry import allclose # ============================================================================== @@ -37,3 +40,20 @@ def test_iterable_cap_generator(mesh_a, mesh_b): mb = Mesh.from_obj(compas.get(mesh_b)) a = list(iterable_like(ma.faces(), mb.faces())) assert len(a) == len(list(ma.faces())) + + +def test_reshape(): + a = [1, 2, 3, 4, 5, 6] + assert allclose(reshape(a, (2, 3)), [[1, 2, 3], [4, 5, 6]]) + assert allclose(reshape(a, (3, 2)), [[1, 2], [3, 4], [5, 6]]) + a = [[1, 2], [3, 4], [5, 6]] + assert allclose(reshape(a, (2, 3)), [[1, 2, 3], [4, 5, 6]]) + a = [1, 2, 3, 4] + assert allclose(reshape(a, (4, 1)), [[1], [2], [3], [4]]) + + +def test_flatten(): + a = [[1, 2, 3], [4, 5, 6]] + assert allclose(flatten(a), [1, 2, 3, 4, 5, 6]) + a = [[1], [2], [3], [4]] + assert allclose(flatten(a), [1, 2, 3, 4]) diff --git a/tests/gen.py b/tests/gen.py deleted file mode 100644 index 7c38b0de3cd..00000000000 --- a/tests/gen.py +++ /dev/null @@ -1,23 +0,0 @@ -from compas.geometry.transformations import ( - transformations as src, -) # change this line to different modules - - -temp = "" -print(src.__all__) - -for func in src.__all__: - temp += "from compas.geometry.transformations import {}\n".format(func) - -temp += "\n\n" - -for func in src.__all__: - temp += """ -def test_{}(): - pass - -""".format( - func - ) - -print(temp)