COMPAS 2.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- compas/__init__.py +274 -0
- compas/__main__.py +31 -0
- compas/_iotools.py +80 -0
- compas/_os.py +746 -0
- compas/colors/__init__.py +14 -0
- compas/colors/cmcrameri/acton.txt +256 -0
- compas/colors/cmcrameri/actonS.txt +100 -0
- compas/colors/cmcrameri/bam.txt +256 -0
- compas/colors/cmcrameri/bamO.txt +256 -0
- compas/colors/cmcrameri/bamako.txt +256 -0
- compas/colors/cmcrameri/bamakoS.txt +100 -0
- compas/colors/cmcrameri/batlow.txt +256 -0
- compas/colors/cmcrameri/batlowK.txt +256 -0
- compas/colors/cmcrameri/batlowS.txt +100 -0
- compas/colors/cmcrameri/batlowW.txt +256 -0
- compas/colors/cmcrameri/berlin.txt +256 -0
- compas/colors/cmcrameri/bilbao.txt +256 -0
- compas/colors/cmcrameri/bilbaoS.txt +100 -0
- compas/colors/cmcrameri/broc.txt +256 -0
- compas/colors/cmcrameri/brocO.txt +256 -0
- compas/colors/cmcrameri/buda.txt +256 -0
- compas/colors/cmcrameri/budaS.txt +100 -0
- compas/colors/cmcrameri/bukavu.txt +256 -0
- compas/colors/cmcrameri/cork.txt +256 -0
- compas/colors/cmcrameri/corkO.txt +256 -0
- compas/colors/cmcrameri/davos.txt +256 -0
- compas/colors/cmcrameri/davosS.txt +100 -0
- compas/colors/cmcrameri/devon.txt +256 -0
- compas/colors/cmcrameri/devonS.txt +100 -0
- compas/colors/cmcrameri/fes.txt +256 -0
- compas/colors/cmcrameri/grayC.txt +256 -0
- compas/colors/cmcrameri/grayCS.txt +100 -0
- compas/colors/cmcrameri/hawaii.txt +256 -0
- compas/colors/cmcrameri/hawaiiS.txt +100 -0
- compas/colors/cmcrameri/imola.txt +256 -0
- compas/colors/cmcrameri/imolaS.txt +100 -0
- compas/colors/cmcrameri/lajolla.txt +256 -0
- compas/colors/cmcrameri/lajollaS.txt +100 -0
- compas/colors/cmcrameri/lapaz.txt +256 -0
- compas/colors/cmcrameri/lapazS.txt +100 -0
- compas/colors/cmcrameri/lisbon.txt +256 -0
- compas/colors/cmcrameri/nuuk.txt +256 -0
- compas/colors/cmcrameri/nuukS.txt +100 -0
- compas/colors/cmcrameri/oleron.txt +256 -0
- compas/colors/cmcrameri/oslo.txt +256 -0
- compas/colors/cmcrameri/osloS.txt +100 -0
- compas/colors/cmcrameri/roma.txt +256 -0
- compas/colors/cmcrameri/romaO.txt +256 -0
- compas/colors/cmcrameri/tofino.txt +256 -0
- compas/colors/cmcrameri/tokyo.txt +256 -0
- compas/colors/cmcrameri/tokyoS.txt +100 -0
- compas/colors/cmcrameri/turku.txt +256 -0
- compas/colors/cmcrameri/turkuS.txt +100 -0
- compas/colors/cmcrameri/vanimo.txt +256 -0
- compas/colors/cmcrameri/vik.txt +256 -0
- compas/colors/cmcrameri/vikO.txt +256 -0
- compas/colors/color.py +1118 -0
- compas/colors/colordict.py +103 -0
- compas/colors/colormap.py +306 -0
- compas/colors/html_colors.py +149 -0
- compas/colors/mpl_colormap.py +1064 -0
- compas/data/__init__.py +31 -0
- compas/data/coercion.py +71 -0
- compas/data/conftest.py +10 -0
- compas/data/data.py +342 -0
- compas/data/encoders.py +240 -0
- compas/data/exceptions.py +2 -0
- compas/data/json.py +240 -0
- compas/data/samples/boxes.obj +250 -0
- compas/data/samples/butt_model.obj +2829 -0
- compas/data/samples/cone.stl +0 -0
- compas/data/samples/cube.off +16 -0
- compas/data/samples/cube_ascii.stl +56114 -0
- compas/data/samples/cube_binary.stl +0 -0
- compas/data/samples/cube_binary_2.stl +0 -0
- compas/data/samples/doosabin.json +1 -0
- compas/data/samples/faces.obj +63 -0
- compas/data/samples/faces_big.obj +9663 -0
- compas/data/samples/faces_reversed.obj +63 -0
- compas/data/samples/fink.obj +135 -0
- compas/data/samples/grid_irregular.obj +303 -0
- compas/data/samples/hypar.obj +148 -0
- compas/data/samples/lines.json +1 -0
- compas/data/samples/lines.obj +282 -0
- compas/data/samples/lines_big.obj +40322 -0
- compas/data/samples/lines_bigger.obj +161282 -0
- compas/data/samples/lines_noleaves.obj +422 -0
- compas/data/samples/mesh.obj +874 -0
- compas/data/samples/mesh_100_faces.json +1893 -0
- compas/data/samples/mesh_110_faces.json +2081 -0
- compas/data/samples/open_edges.obj +424 -0
- compas/data/samples/point.json +1 -0
- compas/data/samples/quadmesh.obj +183 -0
- compas/data/samples/quadmesh_planar.obj +181 -0
- compas/data/samples/saddle.obj +314 -0
- compas/data/samples/spline.obj +72 -0
- compas/data/samples/tubemesh.json +1 -0
- compas/data/samples/tubemesh.obj +378 -0
- compas/data/samples/tubemesh.off +374 -0
- compas/data/samples/tubemesh.ply +551 -0
- compas/data/schema.py +137 -0
- compas/data/validators.py +243 -0
- compas/datastructures/__init__.py +75 -0
- compas/datastructures/_mutablemapping.py +148 -0
- compas/datastructures/assembly/__init__.py +0 -0
- compas/datastructures/assembly/assembly.py +234 -0
- compas/datastructures/assembly/exceptions.py +6 -0
- compas/datastructures/assembly/part.py +228 -0
- compas/datastructures/attributes.py +85 -0
- compas/datastructures/cell_network/__init__.py +0 -0
- compas/datastructures/cell_network/cell_network.py +4190 -0
- compas/datastructures/datastructure.py +309 -0
- compas/datastructures/graph/__init__.py +0 -0
- compas/datastructures/graph/duality.py +197 -0
- compas/datastructures/graph/graph.py +2478 -0
- compas/datastructures/graph/operations/__init__.py +0 -0
- compas/datastructures/graph/operations/join.py +124 -0
- compas/datastructures/graph/operations/split.py +63 -0
- compas/datastructures/graph/planarity.py +292 -0
- compas/datastructures/graph/smoothing.py +59 -0
- compas/datastructures/mesh/__init__.py +0 -0
- compas/datastructures/mesh/conway.py +553 -0
- compas/datastructures/mesh/duality.py +104 -0
- compas/datastructures/mesh/mesh.py +5103 -0
- compas/datastructures/mesh/operations/__init__.py +0 -0
- compas/datastructures/mesh/operations/collapse.py +350 -0
- compas/datastructures/mesh/operations/extrude.py +0 -0
- compas/datastructures/mesh/operations/insert.py +120 -0
- compas/datastructures/mesh/operations/merge.py +83 -0
- compas/datastructures/mesh/operations/split.py +263 -0
- compas/datastructures/mesh/operations/substitute.py +37 -0
- compas/datastructures/mesh/operations/swap.py +62 -0
- compas/datastructures/mesh/operations/weld.py +107 -0
- compas/datastructures/mesh/remesh.py +234 -0
- compas/datastructures/mesh/slice.py +170 -0
- compas/datastructures/mesh/smoothing.py +187 -0
- compas/datastructures/mesh/subdivision.py +754 -0
- compas/datastructures/tree/__init__.py +0 -0
- compas/datastructures/tree/tree.py +504 -0
- compas/datastructures/volmesh/__init__.py +0 -0
- compas/datastructures/volmesh/volmesh.py +4203 -0
- compas/files/__init__.py +27 -0
- compas/files/_xml/__init__.py +0 -0
- compas/files/_xml/xml_cli.py +213 -0
- compas/files/_xml/xml_cpython.py +32 -0
- compas/files/_xml/xml_pre_38.py +58 -0
- compas/files/_xml/xml_shared.py +40 -0
- compas/files/gltf/__init__.py +0 -0
- compas/files/gltf/constants.py +59 -0
- compas/files/gltf/data_classes.py +657 -0
- compas/files/gltf/extensions.py +317 -0
- compas/files/gltf/gltf.py +92 -0
- compas/files/gltf/gltf_children.py +64 -0
- compas/files/gltf/gltf_content.py +615 -0
- compas/files/gltf/gltf_exporter.py +465 -0
- compas/files/gltf/gltf_mesh.py +273 -0
- compas/files/gltf/gltf_node.py +348 -0
- compas/files/gltf/gltf_parser.py +115 -0
- compas/files/gltf/gltf_reader.py +310 -0
- compas/files/gltf/gltf_scene.py +125 -0
- compas/files/gltf/helpers.py +59 -0
- compas/files/obj.py +680 -0
- compas/files/off.py +296 -0
- compas/files/ply.py +697 -0
- compas/files/stl.py +436 -0
- compas/files/xml.py +328 -0
- compas/geometry/__init__.py +772 -0
- compas/geometry/_core/__init__.py +0 -0
- compas/geometry/_core/_algebra.py +2826 -0
- compas/geometry/_core/angles.py +408 -0
- compas/geometry/_core/centroids.py +573 -0
- compas/geometry/_core/distance.py +895 -0
- compas/geometry/_core/normals.py +149 -0
- compas/geometry/_core/nurbs.py +367 -0
- compas/geometry/_core/predicates_2.py +582 -0
- compas/geometry/_core/predicates_3.py +1111 -0
- compas/geometry/_core/quaternions.py +196 -0
- compas/geometry/_core/size.py +204 -0
- compas/geometry/_core/tangent.py +56 -0
- compas/geometry/_core/transformations.py +1121 -0
- compas/geometry/_core/transformations_numpy.py +279 -0
- compas/geometry/bbox.py +145 -0
- compas/geometry/bbox_numpy.py +306 -0
- compas/geometry/bestfit.py +77 -0
- compas/geometry/bestfit_numpy.py +259 -0
- compas/geometry/booleans.py +297 -0
- compas/geometry/booleans_shapely.py +147 -0
- compas/geometry/brep/__init__.py +112 -0
- compas/geometry/brep/brep.py +1131 -0
- compas/geometry/brep/edge.py +302 -0
- compas/geometry/brep/errors.py +22 -0
- compas/geometry/brep/face.py +329 -0
- compas/geometry/brep/loop.py +87 -0
- compas/geometry/brep/trim.py +46 -0
- compas/geometry/brep/vertex.py +46 -0
- compas/geometry/contours.py +32 -0
- compas/geometry/curves/__init__.py +0 -0
- compas/geometry/curves/arc.py +429 -0
- compas/geometry/curves/bezier.py +345 -0
- compas/geometry/curves/circle.py +500 -0
- compas/geometry/curves/conic.py +16 -0
- compas/geometry/curves/curve.py +614 -0
- compas/geometry/curves/ellipse.py +408 -0
- compas/geometry/curves/hyperbola.py +336 -0
- compas/geometry/curves/line.py +431 -0
- compas/geometry/curves/nurbs.py +412 -0
- compas/geometry/curves/parabola.py +256 -0
- compas/geometry/curves/polyline.py +724 -0
- compas/geometry/frame.py +769 -0
- compas/geometry/geometry.py +296 -0
- compas/geometry/hull.py +146 -0
- compas/geometry/hull_numpy.py +82 -0
- compas/geometry/icp_numpy.py +104 -0
- compas/geometry/interpolation_barycentric.py +38 -0
- compas/geometry/interpolation_coons.py +102 -0
- compas/geometry/interpolation_tweening.py +87 -0
- compas/geometry/intersection.py +121 -0
- compas/geometry/intersections.py +1105 -0
- compas/geometry/kdtree.py +153 -0
- compas/geometry/offset.py +208 -0
- compas/geometry/pca_numpy.py +87 -0
- compas/geometry/plane.py +657 -0
- compas/geometry/point.py +664 -0
- compas/geometry/pointcloud.py +409 -0
- compas/geometry/polygon.py +473 -0
- compas/geometry/polyhedron.py +650 -0
- compas/geometry/projection.py +155 -0
- compas/geometry/quadmesh_planarize.py +30 -0
- compas/geometry/quadmesh_planarize_none.py +114 -0
- compas/geometry/quaternion.py +544 -0
- compas/geometry/reflection.py +102 -0
- compas/geometry/rotation.py +354 -0
- compas/geometry/scale.py +100 -0
- compas/geometry/shapes/__init__.py +0 -0
- compas/geometry/shapes/box.py +747 -0
- compas/geometry/shapes/capsule.py +472 -0
- compas/geometry/shapes/cone.py +309 -0
- compas/geometry/shapes/cylinder.py +355 -0
- compas/geometry/shapes/shape.py +300 -0
- compas/geometry/shapes/sphere.py +362 -0
- compas/geometry/shapes/torus.py +294 -0
- compas/geometry/shear.py +115 -0
- compas/geometry/surfaces/__init__.py +0 -0
- compas/geometry/surfaces/conical.py +166 -0
- compas/geometry/surfaces/cylindrical.py +251 -0
- compas/geometry/surfaces/extrusion.py +0 -0
- compas/geometry/surfaces/nurbs.py +380 -0
- compas/geometry/surfaces/planar.py +223 -0
- compas/geometry/surfaces/revolution.py +0 -0
- compas/geometry/surfaces/spherical.py +259 -0
- compas/geometry/surfaces/surface.py +689 -0
- compas/geometry/surfaces/toroidal.py +198 -0
- compas/geometry/transformation.py +554 -0
- compas/geometry/translation.py +104 -0
- compas/geometry/triangulation_delaunay.py +102 -0
- compas/geometry/triangulation_earclip.py +300 -0
- compas/geometry/trimesh_curvature.py +113 -0
- compas/geometry/trimesh_descent_numpy.py +26 -0
- compas/geometry/trimesh_geodistance.py +35 -0
- compas/geometry/trimesh_gradient_numpy.py +74 -0
- compas/geometry/trimesh_isolines.py +41 -0
- compas/geometry/trimesh_matrices.py +31 -0
- compas/geometry/trimesh_matrices_numpy.py +191 -0
- compas/geometry/trimesh_parametrisation.py +55 -0
- compas/geometry/trimesh_pull_points_numpy.py +216 -0
- compas/geometry/trimesh_remeshing.py +97 -0
- compas/geometry/trimesh_samplepoints_numpy.py +108 -0
- compas/geometry/trimesh_slicing.py +28 -0
- compas/geometry/trimesh_smoothing_numpy.py +34 -0
- compas/geometry/vector.py +889 -0
- compas/itertools.py +441 -0
- compas/linalg.py +634 -0
- compas/matrices.py +314 -0
- compas/plugins.py +488 -0
- compas/rpc/__init__.py +20 -0
- compas/rpc/__main__.py +77 -0
- compas/rpc/dispatcher.py +181 -0
- compas/rpc/errors.py +11 -0
- compas/rpc/proxy.py +437 -0
- compas/rpc/server.py +79 -0
- compas/rpc/services/__init__.py +0 -0
- compas/rpc/services/default.py +87 -0
- compas/rpc/services/watcher.py +43 -0
- compas/scene/__init__.py +56 -0
- compas/scene/assemblyobject.py +3 -0
- compas/scene/context.py +154 -0
- compas/scene/descriptors/__init__.py +0 -0
- compas/scene/descriptors/attribute.py +30 -0
- compas/scene/descriptors/color.py +91 -0
- compas/scene/descriptors/colordict.py +101 -0
- compas/scene/descriptors/protocol.py +12 -0
- compas/scene/exceptions.py +7 -0
- compas/scene/geometryobject.py +58 -0
- compas/scene/graphobject.py +173 -0
- compas/scene/meshobject.py +238 -0
- compas/scene/scene.py +144 -0
- compas/scene/sceneobject.py +253 -0
- compas/scene/volmeshobject.py +252 -0
- compas/tolerance.py +879 -0
- compas/topology/__init__.py +45 -0
- compas/topology/combinatorics.py +108 -0
- compas/topology/connectivity.py +129 -0
- compas/topology/orientation.py +204 -0
- compas/topology/traversal.py +567 -0
- compas/utilities/__init__.py +25 -0
- compas/utilities/azync.py +155 -0
- compas/utilities/datetime.py +40 -0
- compas/utilities/decorators.py +136 -0
- compas/utilities/remote.py +54 -0
- compas/utilities/ssh.py +169 -0
- compas-2.1.1.dist-info/AUTHORS.md +42 -0
- compas-2.1.1.dist-info/LICENSE +21 -0
- compas-2.1.1.dist-info/METADATA +132 -0
- compas-2.1.1.dist-info/RECORD +468 -0
- compas-2.1.1.dist-info/WHEEL +5 -0
- compas-2.1.1.dist-info/entry_points.txt +2 -0
- compas-2.1.1.dist-info/top_level.txt +4 -0
- compas_blender/__init__.py +250 -0
- compas_blender/collections.py +130 -0
- compas_blender/conversions/__init__.py +48 -0
- compas_blender/conversions/breps.py +0 -0
- compas_blender/conversions/colors.py +23 -0
- compas_blender/conversions/curves.py +125 -0
- compas_blender/conversions/geometry.py +161 -0
- compas_blender/conversions/meshes.py +148 -0
- compas_blender/conversions/surfaces.py +48 -0
- compas_blender/conversions/transformations.py +46 -0
- compas_blender/data.py +30 -0
- compas_blender/geometry/__init__.py +14 -0
- compas_blender/geometry/booleans.py +100 -0
- compas_blender/install.py +338 -0
- compas_blender/objects.py +326 -0
- compas_blender/print_python_path.py +18 -0
- compas_blender/scene/__init__.py +116 -0
- compas_blender/scene/boxobject.py +64 -0
- compas_blender/scene/capsuleobject.py +73 -0
- compas_blender/scene/circleobject.py +53 -0
- compas_blender/scene/coneobject.py +70 -0
- compas_blender/scene/curveobject.py +58 -0
- compas_blender/scene/cylinderobject.py +70 -0
- compas_blender/scene/frameobject.py +105 -0
- compas_blender/scene/graphobject.py +257 -0
- compas_blender/scene/lineobject.py +60 -0
- compas_blender/scene/meshobject.py +508 -0
- compas_blender/scene/planeobject.py +81 -0
- compas_blender/scene/pointcloudobject.py +67 -0
- compas_blender/scene/pointobject.py +71 -0
- compas_blender/scene/polygonobject.py +57 -0
- compas_blender/scene/polyhedronobject.py +57 -0
- compas_blender/scene/polylineobject.py +54 -0
- compas_blender/scene/sceneobject.py +249 -0
- compas_blender/scene/sphereobject.py +72 -0
- compas_blender/scene/surfaceobject.py +54 -0
- compas_blender/scene/torusobject.py +73 -0
- compas_blender/scene/vectorobject.py +69 -0
- compas_blender/scene/volmeshobject.py +475 -0
- compas_blender/utilities/__init__.py +38 -0
- compas_blender/utilities/drawing.py +768 -0
- compas_ghpython/__init__.py +124 -0
- compas_ghpython/components/Compas_FromJson/code.py +18 -0
- compas_ghpython/components/Compas_Info/code.py +15 -0
- compas_ghpython/components/Compas_RpcCall/code.py +31 -0
- compas_ghpython/components/Compas_ToJson/code.py +19 -0
- compas_ghpython/components/Compas_ToRhinoGeometry/code.py +15 -0
- compas_ghpython/components/__init__.py +99 -0
- compas_ghpython/install.py +29 -0
- compas_ghpython/scene/__init__.py +115 -0
- compas_ghpython/scene/boxobject.py +40 -0
- compas_ghpython/scene/brepobject.py +40 -0
- compas_ghpython/scene/capsuleobject.py +41 -0
- compas_ghpython/scene/circleobject.py +40 -0
- compas_ghpython/scene/coneobject.py +40 -0
- compas_ghpython/scene/curveobject.py +42 -0
- compas_ghpython/scene/cylinderobject.py +38 -0
- compas_ghpython/scene/ellipseobject.py +40 -0
- compas_ghpython/scene/frameobject.py +67 -0
- compas_ghpython/scene/graphobject.py +77 -0
- compas_ghpython/scene/lineobject.py +39 -0
- compas_ghpython/scene/meshobject.py +137 -0
- compas_ghpython/scene/planeobject.py +61 -0
- compas_ghpython/scene/pointobject.py +38 -0
- compas_ghpython/scene/polygonobject.py +48 -0
- compas_ghpython/scene/polyhedronobject.py +48 -0
- compas_ghpython/scene/polylineobject.py +39 -0
- compas_ghpython/scene/sceneobject.py +12 -0
- compas_ghpython/scene/sphereobject.py +39 -0
- compas_ghpython/scene/surfaceobject.py +42 -0
- compas_ghpython/scene/torusobject.py +39 -0
- compas_ghpython/scene/vectorobject.py +51 -0
- compas_ghpython/scene/volmeshobject.py +154 -0
- compas_ghpython/sets.py +83 -0
- compas_ghpython/timer.py +36 -0
- compas_ghpython/uninstall.py +31 -0
- compas_ghpython/utilities/__init__.py +33 -0
- compas_ghpython/utilities/drawing.py +457 -0
- compas_rhino/__init__.py +607 -0
- compas_rhino/conduits/__init__.py +16 -0
- compas_rhino/conduits/base.py +121 -0
- compas_rhino/conduits/faces.py +91 -0
- compas_rhino/conduits/labels.py +102 -0
- compas_rhino/conduits/lines.py +109 -0
- compas_rhino/conduits/points.py +111 -0
- compas_rhino/conversions/__init__.py +168 -0
- compas_rhino/conversions/breps.py +122 -0
- compas_rhino/conversions/curves.py +453 -0
- compas_rhino/conversions/docobjects.py +0 -0
- compas_rhino/conversions/exceptions.py +7 -0
- compas_rhino/conversions/extrusions.py +80 -0
- compas_rhino/conversions/geometry.py +187 -0
- compas_rhino/conversions/meshes.py +281 -0
- compas_rhino/conversions/shapes.py +291 -0
- compas_rhino/conversions/surfaces.py +355 -0
- compas_rhino/conversions/transformations.py +45 -0
- compas_rhino/geometry/__init__.py +44 -0
- compas_rhino/geometry/booleans.py +118 -0
- compas_rhino/geometry/brep/__init__.py +40 -0
- compas_rhino/geometry/brep/brep.py +554 -0
- compas_rhino/geometry/brep/builder.py +184 -0
- compas_rhino/geometry/brep/edge.py +202 -0
- compas_rhino/geometry/brep/face.py +285 -0
- compas_rhino/geometry/brep/loop.py +129 -0
- compas_rhino/geometry/brep/trim.py +99 -0
- compas_rhino/geometry/brep/vertex.py +76 -0
- compas_rhino/geometry/curves/__init__.py +43 -0
- compas_rhino/geometry/curves/curve.py +382 -0
- compas_rhino/geometry/curves/nurbs.py +298 -0
- compas_rhino/geometry/surfaces/__init__.py +50 -0
- compas_rhino/geometry/surfaces/nurbs.py +370 -0
- compas_rhino/geometry/surfaces/surface.py +407 -0
- compas_rhino/geometry/trimesh_curvature.py +344 -0
- compas_rhino/geometry/trimesh_slicing.py +65 -0
- compas_rhino/install.py +382 -0
- compas_rhino/install_plugin.py +169 -0
- compas_rhino/install_with_pip.py +20 -0
- compas_rhino/layers.py +347 -0
- compas_rhino/objects.py +1141 -0
- compas_rhino/print_python_path.py +18 -0
- compas_rhino/scene/__init__.py +123 -0
- compas_rhino/scene/boxobject.py +44 -0
- compas_rhino/scene/brepobject.py +41 -0
- compas_rhino/scene/capsuleobject.py +45 -0
- compas_rhino/scene/circleobject.py +43 -0
- compas_rhino/scene/coneobject.py +43 -0
- compas_rhino/scene/curveobject.py +43 -0
- compas_rhino/scene/cylinderobject.py +43 -0
- compas_rhino/scene/ellipseobject.py +44 -0
- compas_rhino/scene/frameobject.py +99 -0
- compas_rhino/scene/graphobject.py +364 -0
- compas_rhino/scene/helpers.py +33 -0
- compas_rhino/scene/lineobject.py +43 -0
- compas_rhino/scene/meshobject.py +673 -0
- compas_rhino/scene/planeobject.py +71 -0
- compas_rhino/scene/pointobject.py +43 -0
- compas_rhino/scene/polygonobject.py +45 -0
- compas_rhino/scene/polyhedronobject.py +45 -0
- compas_rhino/scene/polylineobject.py +43 -0
- compas_rhino/scene/sceneobject.py +123 -0
- compas_rhino/scene/sphereobject.py +43 -0
- compas_rhino/scene/surfaceobject.py +42 -0
- compas_rhino/scene/torusobject.py +43 -0
- compas_rhino/scene/vectorobject.py +49 -0
- compas_rhino/scene/volmeshobject.py +518 -0
- compas_rhino/ui.py +114 -0
- compas_rhino/uninstall.py +243 -0
- compas_rhino/uninstall_plugin.py +91 -0
- compas_rhino/utilities/__init__.py +37 -0
- compas_rhino/utilities/constructors.py +71 -0
- compas_rhino/utilities/drawing.py +1081 -0
compas/geometry/plane.py
ADDED
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
from __future__ import absolute_import
|
|
2
|
+
from __future__ import division
|
|
3
|
+
from __future__ import print_function
|
|
4
|
+
|
|
5
|
+
from math import sqrt
|
|
6
|
+
|
|
7
|
+
from compas.geometry import Geometry
|
|
8
|
+
from compas.geometry import bestfit_plane
|
|
9
|
+
from compas.geometry import cross_vectors
|
|
10
|
+
from compas.tolerance import TOL
|
|
11
|
+
|
|
12
|
+
from .point import Point
|
|
13
|
+
from .vector import Vector
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Plane(Geometry):
|
|
17
|
+
"""A plane is defined by a base point and a normal vector.
|
|
18
|
+
|
|
19
|
+
Parameters
|
|
20
|
+
----------
|
|
21
|
+
point : [float, float, float] | :class:`compas.geometry.Point`
|
|
22
|
+
The base point of the plane.
|
|
23
|
+
normal : [float, float, float] | :class:`compas.geometry.Vector`
|
|
24
|
+
The normal vector of the plane.
|
|
25
|
+
name : str, optional
|
|
26
|
+
The name of the plane.
|
|
27
|
+
|
|
28
|
+
Attributes
|
|
29
|
+
----------
|
|
30
|
+
abcd : list[float], read-only
|
|
31
|
+
The coefficients of the plane equation.
|
|
32
|
+
d : float, read-only
|
|
33
|
+
The *d* parameter of the linear equation describing the plane.
|
|
34
|
+
normal : :class:`compas.geometry.Vector`
|
|
35
|
+
The normal vector of the plane.
|
|
36
|
+
point : :class:`compas.geometry.Plane`
|
|
37
|
+
The base point of the plane.
|
|
38
|
+
|
|
39
|
+
Examples
|
|
40
|
+
--------
|
|
41
|
+
>>> plane = Plane([0, 0, 0], [0, 0, 1])
|
|
42
|
+
>>> plane.point
|
|
43
|
+
Point(0.000, 0.000, 0.000)
|
|
44
|
+
>>> plane.normal
|
|
45
|
+
Vector(0.000, 0.000, 1.000)
|
|
46
|
+
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
DATASCHEMA = {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"properties": {
|
|
52
|
+
"point": Point.DATASCHEMA,
|
|
53
|
+
"normal": Vector.DATASCHEMA,
|
|
54
|
+
},
|
|
55
|
+
"required": ["point", "normal"],
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def __data__(self):
|
|
60
|
+
return {
|
|
61
|
+
"point": self.point.__data__,
|
|
62
|
+
"normal": self.normal.__data__,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
def __init__(self, point, normal, name=None):
|
|
66
|
+
super(Plane, self).__init__(name=name)
|
|
67
|
+
self._point = None
|
|
68
|
+
self._normal = None
|
|
69
|
+
self.point = point
|
|
70
|
+
self.normal = normal
|
|
71
|
+
|
|
72
|
+
def __repr__(self):
|
|
73
|
+
return "{0}(point={1!r}, normal={2!r})".format(
|
|
74
|
+
type(self).__name__,
|
|
75
|
+
self.point,
|
|
76
|
+
self.normal,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
def __len__(self):
|
|
80
|
+
return 2
|
|
81
|
+
|
|
82
|
+
def __getitem__(self, key):
|
|
83
|
+
if key == 0:
|
|
84
|
+
return self.point
|
|
85
|
+
if key == 1:
|
|
86
|
+
return self.normal
|
|
87
|
+
raise KeyError
|
|
88
|
+
|
|
89
|
+
def __setitem__(self, key, value):
|
|
90
|
+
if key == 0:
|
|
91
|
+
self.point = value
|
|
92
|
+
return
|
|
93
|
+
if key == 1:
|
|
94
|
+
self.normal = value
|
|
95
|
+
return
|
|
96
|
+
raise KeyError
|
|
97
|
+
|
|
98
|
+
def __iter__(self):
|
|
99
|
+
return iter([self.point, self.normal])
|
|
100
|
+
|
|
101
|
+
def __eq__(self, other):
|
|
102
|
+
return self.point == other[0] and self.normal == other[1]
|
|
103
|
+
|
|
104
|
+
# ==========================================================================
|
|
105
|
+
# Properties
|
|
106
|
+
# ==========================================================================
|
|
107
|
+
|
|
108
|
+
@property
|
|
109
|
+
def point(self):
|
|
110
|
+
if not self._point:
|
|
111
|
+
raise ValueError("The plane has no point.")
|
|
112
|
+
return self._point
|
|
113
|
+
|
|
114
|
+
@point.setter
|
|
115
|
+
def point(self, point):
|
|
116
|
+
self._point = Point(*point)
|
|
117
|
+
|
|
118
|
+
@property
|
|
119
|
+
def normal(self):
|
|
120
|
+
if not self._normal:
|
|
121
|
+
raise ValueError("The plane has no normal.")
|
|
122
|
+
return self._normal
|
|
123
|
+
|
|
124
|
+
@normal.setter
|
|
125
|
+
def normal(self, vector):
|
|
126
|
+
self._normal = Vector(*vector)
|
|
127
|
+
self._normal.unitize()
|
|
128
|
+
|
|
129
|
+
@property
|
|
130
|
+
def d(self):
|
|
131
|
+
a, b, c = self.normal
|
|
132
|
+
x, y, z = self.point
|
|
133
|
+
return -a * x - b * y - c * z
|
|
134
|
+
|
|
135
|
+
@property
|
|
136
|
+
def abcd(self):
|
|
137
|
+
a, b, c = self.normal
|
|
138
|
+
d = self.d
|
|
139
|
+
return a, b, c, d
|
|
140
|
+
|
|
141
|
+
# ==========================================================================
|
|
142
|
+
# Constructors
|
|
143
|
+
# ==========================================================================
|
|
144
|
+
|
|
145
|
+
@classmethod
|
|
146
|
+
def from_three_points(cls, a, b, c): # type: (...) -> Plane
|
|
147
|
+
"""Construct a plane from three points in three-dimensional space.
|
|
148
|
+
|
|
149
|
+
Parameters
|
|
150
|
+
----------
|
|
151
|
+
a : [float, float, float] | :class:`compas.geometry.Point`
|
|
152
|
+
The first point.
|
|
153
|
+
b : [float, float, float] | :class:`compas.geometry.Point`
|
|
154
|
+
The second point.
|
|
155
|
+
c : [float, float, float] | :class:`compas.geometry.Point`
|
|
156
|
+
The second point.
|
|
157
|
+
|
|
158
|
+
Returns
|
|
159
|
+
-------
|
|
160
|
+
:class:`compas.geometry.Plane`
|
|
161
|
+
A plane with base point `a` and normal vector defined as the unitized
|
|
162
|
+
cross product of the vectors `ab` and `ac`.
|
|
163
|
+
|
|
164
|
+
Examples
|
|
165
|
+
--------
|
|
166
|
+
>>> plane = Plane.from_three_points([0.0, 0.0, 0.0], [2.0, 1.0, 0.0], [0.0, 3.0, 0.0])
|
|
167
|
+
>>> plane.point
|
|
168
|
+
Point(0.000, 0.000, 0.000)
|
|
169
|
+
>>> plane.normal
|
|
170
|
+
Vector(0.000, 0.000, 1.000)
|
|
171
|
+
|
|
172
|
+
"""
|
|
173
|
+
a = Point(*a)
|
|
174
|
+
b = Point(*b)
|
|
175
|
+
c = Point(*c)
|
|
176
|
+
normal = Vector(*cross_vectors(b - a, c - a))
|
|
177
|
+
return cls(a, normal)
|
|
178
|
+
|
|
179
|
+
@classmethod
|
|
180
|
+
def from_point_and_two_vectors(cls, point, u, v): # type: (...) -> Plane
|
|
181
|
+
"""Construct a plane from a base point and two vectors.
|
|
182
|
+
|
|
183
|
+
Parameters
|
|
184
|
+
----------
|
|
185
|
+
point : [float, float, float] | :class:`compas.geometry.Point`
|
|
186
|
+
The base point.
|
|
187
|
+
u : [float, float, float] | :class:`compas.geometry.Vector`
|
|
188
|
+
The first vector.
|
|
189
|
+
v : [float, float, float] | :class:`compas.geometry.Vector`
|
|
190
|
+
The second vector.
|
|
191
|
+
|
|
192
|
+
Returns
|
|
193
|
+
-------
|
|
194
|
+
:class:`compas.geometry.Plane`
|
|
195
|
+
A plane with base point `point` and normal vector defined as the unitized
|
|
196
|
+
cross product of vectors `u` and `v`.
|
|
197
|
+
|
|
198
|
+
Examples
|
|
199
|
+
--------
|
|
200
|
+
>>> 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])
|
|
201
|
+
>>> plane.point
|
|
202
|
+
Point(0.000, 0.000, 0.000)
|
|
203
|
+
>>> plane.normal
|
|
204
|
+
Vector(0.000, 0.000, 1.000)
|
|
205
|
+
|
|
206
|
+
"""
|
|
207
|
+
normal = Vector(*cross_vectors(u, v))
|
|
208
|
+
return cls(point, normal)
|
|
209
|
+
|
|
210
|
+
@classmethod
|
|
211
|
+
def from_abcd(cls, abcd): # type: (...) -> Plane
|
|
212
|
+
"""Construct a plane from the plane equation coefficients.
|
|
213
|
+
|
|
214
|
+
Parameters
|
|
215
|
+
----------
|
|
216
|
+
abcd : [float, float, float, float]
|
|
217
|
+
The equation coefficients.
|
|
218
|
+
|
|
219
|
+
Returns
|
|
220
|
+
-------
|
|
221
|
+
:class:`compas.geometry.Plane`
|
|
222
|
+
|
|
223
|
+
"""
|
|
224
|
+
a, b, c, d = abcd
|
|
225
|
+
x = 1 / sqrt(a**2 + b**2 + c**2)
|
|
226
|
+
normal = [a, b, c]
|
|
227
|
+
point = [a * d * x, b * d * x, c * d * x]
|
|
228
|
+
return cls(point, normal)
|
|
229
|
+
|
|
230
|
+
@classmethod
|
|
231
|
+
def worldXY(cls): # type: (...) -> Plane
|
|
232
|
+
"""Construct the world XY plane.
|
|
233
|
+
|
|
234
|
+
Returns
|
|
235
|
+
-------
|
|
236
|
+
:class:`compas.geometry.Plane`
|
|
237
|
+
The world XY plane.
|
|
238
|
+
|
|
239
|
+
"""
|
|
240
|
+
return cls([0, 0, 0], [0, 0, 1])
|
|
241
|
+
|
|
242
|
+
@classmethod
|
|
243
|
+
def worldYZ(cls): # type: (...) -> Plane
|
|
244
|
+
"""Construct the world YZ plane.
|
|
245
|
+
|
|
246
|
+
Returns
|
|
247
|
+
-------
|
|
248
|
+
:class:`compas.geometry.Plane`
|
|
249
|
+
The world YZ plane.
|
|
250
|
+
|
|
251
|
+
"""
|
|
252
|
+
return cls([0, 0, 0], [1, 0, 0])
|
|
253
|
+
|
|
254
|
+
@classmethod
|
|
255
|
+
def worldZX(cls): # type: (...) -> Plane
|
|
256
|
+
"""Construct the world ZX plane.
|
|
257
|
+
|
|
258
|
+
Returns
|
|
259
|
+
-------
|
|
260
|
+
:class:`compas.geometry.Plane`
|
|
261
|
+
The world ZX plane.
|
|
262
|
+
|
|
263
|
+
"""
|
|
264
|
+
return cls([0, 0, 0], [0, 1, 0])
|
|
265
|
+
|
|
266
|
+
@classmethod
|
|
267
|
+
def from_frame(cls, frame): # type: (...) -> Plane
|
|
268
|
+
"""Construct a plane from a frame.
|
|
269
|
+
|
|
270
|
+
Returns
|
|
271
|
+
-------
|
|
272
|
+
:class:`compas.geometry.Plane`
|
|
273
|
+
A plane with the frame's `point` and the frame's `normal`.
|
|
274
|
+
|
|
275
|
+
Examples
|
|
276
|
+
--------
|
|
277
|
+
>>> from compas.geometry import Frame
|
|
278
|
+
>>> frame = Frame([1, 1, 1], [0.68, 0.68, 0.27], [-0.67, 0.73, -0.15])
|
|
279
|
+
>>> Plane.from_frame(frame)
|
|
280
|
+
Plane(Point(1.000, 1.000, 1.000), Vector(-0.299, -0.079, 0.951))
|
|
281
|
+
|
|
282
|
+
"""
|
|
283
|
+
return cls(frame.point, frame.normal)
|
|
284
|
+
|
|
285
|
+
@classmethod
|
|
286
|
+
def from_points(cls, points): # type: (...) -> Plane
|
|
287
|
+
"""Construct a plane from a list of points.
|
|
288
|
+
|
|
289
|
+
If the list contains more than three points, a plane is constructed that minimizes the distance to all points.
|
|
290
|
+
|
|
291
|
+
Parameters
|
|
292
|
+
----------
|
|
293
|
+
points : list of [float, float, float] | :class:`compas.geometry.Point`
|
|
294
|
+
The points.
|
|
295
|
+
|
|
296
|
+
Returns
|
|
297
|
+
-------
|
|
298
|
+
:class:`compas.geometry.Plane`
|
|
299
|
+
The plane defined by the points.
|
|
300
|
+
|
|
301
|
+
See Also
|
|
302
|
+
--------
|
|
303
|
+
:func:`compas.geometry.bestfit_plane`
|
|
304
|
+
|
|
305
|
+
Examples
|
|
306
|
+
--------
|
|
307
|
+
>>> points = [[0.0, 0.0, 0.0], [2.0, 1.0, 0.0], [0.0, 3.0, 0.0]]
|
|
308
|
+
>>> plane = Plane.from_points(points)
|
|
309
|
+
>>> plane.point
|
|
310
|
+
Point(0.000, 0.000, 0.000)
|
|
311
|
+
>>> plane.normal
|
|
312
|
+
Vector(0.000, 0.000, 1.000)
|
|
313
|
+
|
|
314
|
+
"""
|
|
315
|
+
if len(points) == 3:
|
|
316
|
+
return cls.from_three_points(*points)
|
|
317
|
+
point, normal = bestfit_plane(points)
|
|
318
|
+
return cls(point, normal)
|
|
319
|
+
|
|
320
|
+
# ==========================================================================
|
|
321
|
+
# Transformations
|
|
322
|
+
# ==========================================================================
|
|
323
|
+
|
|
324
|
+
def transform(self, T):
|
|
325
|
+
"""Transform this plane.
|
|
326
|
+
|
|
327
|
+
Parameters
|
|
328
|
+
----------
|
|
329
|
+
T : :class:`compas.geometry.Transformation` | list[list[float]]
|
|
330
|
+
The transformation.
|
|
331
|
+
|
|
332
|
+
Returns
|
|
333
|
+
-------
|
|
334
|
+
None
|
|
335
|
+
|
|
336
|
+
Examples
|
|
337
|
+
--------
|
|
338
|
+
>>> from compas.geometry import Frame
|
|
339
|
+
>>> from compas.geometry import Transformation
|
|
340
|
+
>>> from compas.geometry import Plane
|
|
341
|
+
>>> f = Frame([1, 1, 1], [0.68, 0.68, 0.27], [-0.67, 0.73, -0.15])
|
|
342
|
+
>>> T = Transformation.from_frame(f)
|
|
343
|
+
>>> plane = Plane.worldXY()
|
|
344
|
+
>>> plane.transform(T)
|
|
345
|
+
|
|
346
|
+
"""
|
|
347
|
+
self.point.transform(T)
|
|
348
|
+
self.normal.transform(T)
|
|
349
|
+
|
|
350
|
+
# ==========================================================================
|
|
351
|
+
# Methods
|
|
352
|
+
# ==========================================================================
|
|
353
|
+
|
|
354
|
+
def is_parallel(self, other, tol=None):
|
|
355
|
+
"""Verify if this plane is parallel to another plane.
|
|
356
|
+
|
|
357
|
+
Parameters
|
|
358
|
+
----------
|
|
359
|
+
other : :class:`compas.geometry.Plane`
|
|
360
|
+
The other plane.
|
|
361
|
+
tol : float, optional
|
|
362
|
+
Tolerance for the dot product of the normals.
|
|
363
|
+
Default is :attr:`TOL.absolute`.
|
|
364
|
+
|
|
365
|
+
Returns
|
|
366
|
+
-------
|
|
367
|
+
bool
|
|
368
|
+
``True`` if the planes are parallel.
|
|
369
|
+
``False`` otherwise.
|
|
370
|
+
|
|
371
|
+
Examples
|
|
372
|
+
--------
|
|
373
|
+
>>> plane1 = Plane.worldXY()
|
|
374
|
+
>>> plane2 = Plane([1.0, 1.0, 1.0], [0.0, 0.0, 1.0])
|
|
375
|
+
>>> plane1.is_parallel(plane2)
|
|
376
|
+
True
|
|
377
|
+
|
|
378
|
+
"""
|
|
379
|
+
return TOL.is_close(self.normal.dot(other.normal), 1, rtol=0, atol=tol)
|
|
380
|
+
|
|
381
|
+
def is_perpendicular(self, other, tol=None):
|
|
382
|
+
"""Verify if this plane is perpendicular to another plane.
|
|
383
|
+
|
|
384
|
+
Parameters
|
|
385
|
+
----------
|
|
386
|
+
other : :class:`compas.geometry.Plane`
|
|
387
|
+
The other plane.
|
|
388
|
+
tol : float, optional
|
|
389
|
+
Tolerance for the dot product of the normals.
|
|
390
|
+
Default is :attr:`TOL.absolute`.
|
|
391
|
+
|
|
392
|
+
Returns
|
|
393
|
+
-------
|
|
394
|
+
bool
|
|
395
|
+
``True`` if the planes are perpendicular.
|
|
396
|
+
``False`` otherwise.
|
|
397
|
+
|
|
398
|
+
Examples
|
|
399
|
+
--------
|
|
400
|
+
>>> plane1 = Plane.worldXY()
|
|
401
|
+
>>> plane2 = Plane([1.0, 1.0, 1.0], [0.0, 0.0, 1.0])
|
|
402
|
+
>>> plane1.is_perpendicular(plane2)
|
|
403
|
+
False
|
|
404
|
+
|
|
405
|
+
"""
|
|
406
|
+
return TOL.is_zero(self.normal.dot(other.normal), tol)
|
|
407
|
+
|
|
408
|
+
def contains_point(self, point, tol=None):
|
|
409
|
+
"""Verify if a given point lies in the plane.
|
|
410
|
+
|
|
411
|
+
Parameters
|
|
412
|
+
----------
|
|
413
|
+
point : [float, float, float] | :class:`compas.geometry.Point`
|
|
414
|
+
The point.
|
|
415
|
+
tol : float, optional
|
|
416
|
+
Tolerance for the distance from the point to the plane.
|
|
417
|
+
Default is :attr:`TOL.absolute`.
|
|
418
|
+
|
|
419
|
+
Returns
|
|
420
|
+
-------
|
|
421
|
+
bool
|
|
422
|
+
``True`` if the point lies in the plane.
|
|
423
|
+
``False`` otherwise.
|
|
424
|
+
|
|
425
|
+
Examples
|
|
426
|
+
--------
|
|
427
|
+
>>> plane = Plane.worldXY()
|
|
428
|
+
>>> plane.contains_point([1.0, 1.0, 0.0])
|
|
429
|
+
True
|
|
430
|
+
|
|
431
|
+
"""
|
|
432
|
+
vector = self.point - point
|
|
433
|
+
return TOL.is_zero(self.normal.dot(vector), tol)
|
|
434
|
+
|
|
435
|
+
# move to Point.distance_to_plane?
|
|
436
|
+
# point.distance_to_plane(plane)
|
|
437
|
+
def distance_to_point(self, point):
|
|
438
|
+
"""Compute the distance from a given point to the plane.
|
|
439
|
+
|
|
440
|
+
Parameters
|
|
441
|
+
----------
|
|
442
|
+
point : [float, float, float] | :class:`compas.geometry.Point`
|
|
443
|
+
The point.
|
|
444
|
+
|
|
445
|
+
Returns
|
|
446
|
+
-------
|
|
447
|
+
float
|
|
448
|
+
The distance from the point to the plane.
|
|
449
|
+
|
|
450
|
+
Examples
|
|
451
|
+
--------
|
|
452
|
+
>>> plane = Plane.worldXY()
|
|
453
|
+
>>> plane.distance_to_point([1.0, 1.0, 1.0])
|
|
454
|
+
1.0
|
|
455
|
+
|
|
456
|
+
"""
|
|
457
|
+
vector = self.point - point
|
|
458
|
+
return abs(self.normal.dot(vector))
|
|
459
|
+
|
|
460
|
+
# move to Point.closest_on_plane?
|
|
461
|
+
# point.closest_on_plane(plane)
|
|
462
|
+
# remove entirely?
|
|
463
|
+
def closest_point(self, point):
|
|
464
|
+
"""Compute the closest point on the plane to a given point.
|
|
465
|
+
|
|
466
|
+
Parameters
|
|
467
|
+
----------
|
|
468
|
+
point : [float, float, float] | :class:`compas.geometry.Point`
|
|
469
|
+
The point.
|
|
470
|
+
|
|
471
|
+
Returns
|
|
472
|
+
-------
|
|
473
|
+
:class:`compas.geometry.Point`
|
|
474
|
+
The closest point on the plane.
|
|
475
|
+
|
|
476
|
+
Examples
|
|
477
|
+
--------
|
|
478
|
+
>>> plane = Plane.worldXY()
|
|
479
|
+
>>> plane.closest_point([1.0, 1.0, 1.0])
|
|
480
|
+
Point(1.000, 1.000, 0.000)
|
|
481
|
+
|
|
482
|
+
"""
|
|
483
|
+
vector = self.point - point
|
|
484
|
+
distance = self.normal.dot(vector)
|
|
485
|
+
return point + self.normal.scaled(distance)
|
|
486
|
+
|
|
487
|
+
# move to Point.proejcted_on_plane?
|
|
488
|
+
# point.projected_on_plane(plane)
|
|
489
|
+
# point.project_on_plane(plane)
|
|
490
|
+
def projected_point(self, point, direction=None):
|
|
491
|
+
"""Returns the projection of a given point onto the plane.
|
|
492
|
+
|
|
493
|
+
Parameters
|
|
494
|
+
----------
|
|
495
|
+
point : [float, float, float] | :class:`compas.geometry.Point`
|
|
496
|
+
The point.
|
|
497
|
+
|
|
498
|
+
Returns
|
|
499
|
+
-------
|
|
500
|
+
:class:`compas.geometry.Point` | None
|
|
501
|
+
The projected point, or None if a direction is given and it is parallel to the plane.
|
|
502
|
+
|
|
503
|
+
Examples
|
|
504
|
+
--------
|
|
505
|
+
>>> plane = Plane.worldXY()
|
|
506
|
+
>>> plane.projected_point([1.0, 1.0, 1.0])
|
|
507
|
+
Point(1.000, 1.000, 0.000)
|
|
508
|
+
|
|
509
|
+
"""
|
|
510
|
+
if not direction:
|
|
511
|
+
return self.closest_point(point)
|
|
512
|
+
|
|
513
|
+
from compas.geometry import Line
|
|
514
|
+
|
|
515
|
+
line = Line.from_point_and_vector(point, direction)
|
|
516
|
+
intersection = self.intersection_with_line(line)
|
|
517
|
+
return intersection
|
|
518
|
+
|
|
519
|
+
# move to Point.mirrored_by_plane?
|
|
520
|
+
# point.mirrored_by_plane(plane)
|
|
521
|
+
# point.mirror_by_plane(plane)
|
|
522
|
+
def mirrored_point(self, point):
|
|
523
|
+
"""Returns the mirror image of a given point.
|
|
524
|
+
|
|
525
|
+
Parameters
|
|
526
|
+
----------
|
|
527
|
+
point : [float, float, float] | :class:`compas.geometry.Point`
|
|
528
|
+
The point.
|
|
529
|
+
|
|
530
|
+
Returns
|
|
531
|
+
-------
|
|
532
|
+
:class:`compas.geometry.Point`
|
|
533
|
+
The mirrored point.
|
|
534
|
+
|
|
535
|
+
Examples
|
|
536
|
+
--------
|
|
537
|
+
>>> plane = Plane.worldXY()
|
|
538
|
+
>>> plane.mirrored_point([1.0, 1.0, 1.0])
|
|
539
|
+
Point(1.000, 1.000, -1.000)
|
|
540
|
+
|
|
541
|
+
"""
|
|
542
|
+
vector = self.point - point
|
|
543
|
+
distance = self.normal.dot(vector)
|
|
544
|
+
return point + self.normal.scaled(2 * distance)
|
|
545
|
+
|
|
546
|
+
def intersection_with_line(self, line, tol=None):
|
|
547
|
+
"""Compute the intersection of a plane and a line.
|
|
548
|
+
|
|
549
|
+
Parameters
|
|
550
|
+
----------
|
|
551
|
+
line : :class:`compas.geometry.Line`
|
|
552
|
+
The line.
|
|
553
|
+
tol : float, optional
|
|
554
|
+
Tolerance for the dot product of the line vector and the plane normal.
|
|
555
|
+
Default is :attr:`TOL.absolute`.
|
|
556
|
+
|
|
557
|
+
Returns
|
|
558
|
+
-------
|
|
559
|
+
:class:`compas.geometry.Point` | None
|
|
560
|
+
The intersection point, or ``None`` if the line is parallel to the plane.
|
|
561
|
+
|
|
562
|
+
Examples
|
|
563
|
+
--------
|
|
564
|
+
>>> plane = Plane.worldXY()
|
|
565
|
+
>>> line = Line(Point(0, 0, 1), Vector(1, 1, 1))
|
|
566
|
+
>>> plane.intersection_with_line(line)
|
|
567
|
+
Point(0.000, 0.000, 0.000)
|
|
568
|
+
|
|
569
|
+
"""
|
|
570
|
+
# The line is parallel to the plane
|
|
571
|
+
if TOL.is_zero(self.normal.dot(line.vector), tol):
|
|
572
|
+
return None
|
|
573
|
+
|
|
574
|
+
t = (self.point - line.start).dot(self.normal) / line.vector.dot(self.normal)
|
|
575
|
+
return line.point_at(t)
|
|
576
|
+
|
|
577
|
+
def intersection_with_plane(self, plane):
|
|
578
|
+
"""Compute the intersection of two planes.
|
|
579
|
+
|
|
580
|
+
Parameters
|
|
581
|
+
----------
|
|
582
|
+
plane : :class:`compas.geometry.Plane`
|
|
583
|
+
The other plane.
|
|
584
|
+
|
|
585
|
+
Returns
|
|
586
|
+
-------
|
|
587
|
+
:class:`compas.geometry.Line` | None
|
|
588
|
+
The intersection line, or None if the planes are parallel or coincident.
|
|
589
|
+
|
|
590
|
+
Examples
|
|
591
|
+
--------
|
|
592
|
+
>>> plane1 = Plane.worldXY()
|
|
593
|
+
>>> plane2 = Plane([1.0, 1.0, 1.0], [0.0, 0.0, 1.0])
|
|
594
|
+
>>> plane1.intersection(plane2)
|
|
595
|
+
Line(Point(0.000, 0.000, 0.000), Vector(0.000, 0.000, 1.000))
|
|
596
|
+
|
|
597
|
+
"""
|
|
598
|
+
from compas.geometry import Line
|
|
599
|
+
|
|
600
|
+
if self.is_parallel(plane):
|
|
601
|
+
return None
|
|
602
|
+
|
|
603
|
+
# direction of the line
|
|
604
|
+
direction = self.normal.cross(plane.normal)
|
|
605
|
+
|
|
606
|
+
# point on the line
|
|
607
|
+
line = Line(self.point, self.point + self.normal.cross(direction))
|
|
608
|
+
point = plane.intersection_with_line(line)
|
|
609
|
+
|
|
610
|
+
return Line(point, point + direction)
|
|
611
|
+
|
|
612
|
+
def intersections_with_curve(self, curve, tol=None):
|
|
613
|
+
"""Compute the intersection of a plane and a curve.
|
|
614
|
+
|
|
615
|
+
Parameters
|
|
616
|
+
----------
|
|
617
|
+
curve : :class:`compas.geometry.Curve`
|
|
618
|
+
The curve.
|
|
619
|
+
tol : float, optional
|
|
620
|
+
Tolerance for the dot product of the line vector and the plane normal.
|
|
621
|
+
Default is :attr:`TOL.absolute`.
|
|
622
|
+
|
|
623
|
+
Returns
|
|
624
|
+
-------
|
|
625
|
+
list of :class:`compas.geometry.Point`
|
|
626
|
+
The intersection points.
|
|
627
|
+
|
|
628
|
+
Examples
|
|
629
|
+
--------
|
|
630
|
+
>>> plane = Plane.worldXY()
|
|
631
|
+
>>> line = Line(Point(0, 0, 1), Vector(1, 1, 1))
|
|
632
|
+
>>> plane.intersection_with_curve(line)
|
|
633
|
+
[Point(0.000, 0.000, 0.000)]
|
|
634
|
+
|
|
635
|
+
"""
|
|
636
|
+
pass
|
|
637
|
+
|
|
638
|
+
def intersections_with_surface(self, surface):
|
|
639
|
+
pass
|
|
640
|
+
|
|
641
|
+
def offset(self, distance):
|
|
642
|
+
"""Returns a new offset plane by a given distance.
|
|
643
|
+
|
|
644
|
+
The plane normal is used as positive direction.
|
|
645
|
+
|
|
646
|
+
Parameters
|
|
647
|
+
----------
|
|
648
|
+
distance: float
|
|
649
|
+
The offset distance.
|
|
650
|
+
|
|
651
|
+
Returns
|
|
652
|
+
-------
|
|
653
|
+
:class:`compas.geometry.Plane`
|
|
654
|
+
The offset plane.
|
|
655
|
+
|
|
656
|
+
"""
|
|
657
|
+
return Plane(self.point + self.normal.scaled(distance), self.normal)
|