├── .gitmodules ├── CMakeLists.txt ├── CMakeSettings.json ├── COPYING ├── License.txt ├── README.md ├── TODO_list.md ├── building ├── Dockerfile_CloudComPy310_build ├── conda-list_Ubuntu20.04 ├── conda-list_Windows11_310 ├── conda-list_macOS ├── genCloudComPy_Conda310_Ubuntu2004.sh ├── genCloudComPy_Conda310_docker.sh └── genCloudComPy_Conda310_macos.zsh ├── checkenv.py ├── cmake └── FindPYQTSIP.cmake ├── doc ├── BuildLinuxConda.md ├── BuildLinuxCondaDocker.md ├── BuildUbuntuNative.md ├── BuildWindowsConda.md ├── CMakeLists.txt ├── ReleaseNotes.md ├── UseDockerLinuxConda.md ├── UseDockerLinuxCondaBinary.md ├── UseLinuxCondaBinary.md ├── UseMacOSCondaBinary.md ├── UseWindowsCondaBinary.md ├── prerequisitesVersions.md └── samples │ ├── CMakeLists.txt │ └── histogramOnDistanceComputation.ipynb ├── envCloudComPy.bat ├── pyAPI ├── CMakeLists.txt ├── PyScalarType.h ├── ccNumpyIncludes.h ├── initCC.cpp ├── initCC.h ├── optdefines.h.in ├── pyCC.cpp └── pyCC.h ├── pybind11 ├── CMakeLists.txt ├── CSF │ ├── CMakeLists.txt │ ├── CSFPy.cpp │ ├── CSF_DocStrings.hpp │ └── __init__.py ├── Canupo │ ├── CMakeLists.txt │ ├── CanupoPy.cpp │ ├── Canupo_DocStrings.hpp │ └── __init__.py ├── Cork │ ├── CMakeLists.txt │ ├── CorkPy.cpp │ ├── Cork_DocStrings.hpp │ └── __init__.py ├── HPR │ ├── CMakeLists.txt │ ├── HPRPy.cpp │ ├── HPR_DocStrings.hpp │ └── __init__.py ├── M3C2 │ ├── CMakeLists.txt │ ├── M3C2Py.cpp │ ├── M3C2_DocStrings.hpp │ └── __init__.py ├── MeshBoolean │ ├── CMakeLists.txt │ ├── MeshBooleanPy.cpp │ ├── MeshBoolean_DocStrings.hpp │ └── __init__.py ├── NeighbourhoodPy.cpp ├── NeighbourhoodPy.hpp ├── NeighbourhoodPy_DocStrings.hpp ├── PCL │ ├── CMakeLists.txt │ ├── PCLPy.cpp │ ├── PCL_DocStrings.hpp │ └── __init__.py ├── PCV │ ├── CMakeLists.txt │ ├── PCVPy.cpp │ ├── PCV_DocStrings.hpp │ └── __init__.py ├── PoissonRecon │ ├── CMakeLists.txt │ ├── PoissonReconPy.cpp │ ├── PoissonRecon_DocStrings.hpp │ └── __init__.py ├── RANSAC_SD │ ├── CMakeLists.txt │ ├── RANSAC_SDPy.cpp │ ├── RANSAC_SD_DocStrings.hpp │ └── __init__.py ├── SRA │ ├── CMakeLists.txt │ ├── SRAPy.cpp │ ├── SRA_DocStrings.hpp │ └── __init__.py ├── ScalarFieldPy.cpp ├── ScalarFieldPy.hpp ├── ScalarFieldPy_DocStrings.hpp ├── __init__.py ├── ccFacetPy.cpp ├── ccFacetPy.hpp ├── ccFacetPy_DocStrings.hpp ├── ccGenericCloudPy.cpp ├── ccGenericCloudPy.hpp ├── ccGenericCloudPy_DocStrings.hpp ├── ccMeshPy.cpp ├── ccMeshPy.hpp ├── ccMeshPy_DocStrings.hpp ├── ccOctreePy.cpp ├── ccOctreePy.hpp ├── ccOctreePy_DocStrings.hpp ├── ccPointCloudPy.cpp ├── ccPointCloudPy.hpp ├── ccPointCloudPy_DocStrings.hpp ├── ccPolylinePy.cpp ├── ccPolylinePy.hpp ├── ccPolylinePy_DocStrings.hpp ├── ccPrimitivesPy.cpp ├── ccPrimitivesPy.hpp ├── ccPrimitivesPy_DocStrings.hpp ├── ccSensorPy.cpp ├── ccSensorPy.hpp ├── ccSensorPy_DocStrings.hpp ├── cloudComPy.cpp ├── cloudComPy.hpp ├── cloudComPy_DocStrings.hpp ├── cloudSamplingToolsPy.cpp ├── cloudSamplingToolsPy.hpp ├── cloudSamplingToolsPy_DocStrings.hpp ├── colorsPy.cpp ├── colorsPy.hpp ├── colorsPy_DocStrings.hpp ├── condaCloud.sh ├── condaCloud.zsh ├── conversions.hpp ├── converters.hpp ├── distanceComputationToolsPy.cpp ├── distanceComputationToolsPy.hpp ├── distanceComputationToolsPy_DocStrings.hpp ├── geometricalAnalysisToolsPy.cpp ├── geometricalAnalysisToolsPy.hpp ├── geometricalAnalysisToolsPy_DocStrings.hpp ├── minimalBoundingBox.py ├── registrationToolsPy.cpp └── registrationToolsPy.hpp ├── sphinxDoc ├── CMakeLists.txt ├── CSF.rst ├── Canupo.rst ├── DistanceComputationTools.rst ├── GeometricalAnalysisTools.rst ├── HPR.rst ├── M3C2.rst ├── MeshBoolean.rst ├── MinimalBoundingBox.rst ├── Neighbourhood.rst ├── PCL.rst ├── PCV.rst ├── PoissonRecon.rst ├── RANSAC_SD.rst ├── SRA.rst ├── ScalarField.rst ├── ccFacet.rst ├── ccMesh.rst ├── ccOctree.rst ├── ccPointCloud.rst ├── ccPolyline.rst ├── ccPrimitives.rst ├── ccSensor.rst ├── cloudComPy.rst ├── cloudSamplingTools.rst ├── colors.rst ├── conf.py.in ├── genSphinxDoc.sh.in ├── genSphinxDocConda.sh.in ├── genSphinxDocMacOSConda.zsh.in ├── genSphinxDocWindows.bat.in ├── index.rst ├── introduction.rst ├── libBundleCloudComPy.py.in ├── license.rst ├── postInstall.cmake ├── signatureCloudComPy.sh.in ├── tables.rst ├── userEntities.rst ├── userIntro.rst ├── userLoad.rst ├── userNumpy.rst ├── userSave.rst └── userUseCases.rst ├── tests ├── CMakeLists.txt ├── DartConfiguration.tcl.in ├── DartTestfile.txt ├── DartTestfile.win.txt ├── envPyCC.bat ├── envPyCC.sh ├── execInstallTest.bat ├── execInstallTest.sh ├── execTest.bat.in ├── execTest.sh.in ├── gendata.py.in ├── test001.py ├── test002.py ├── test003.py ├── test004.py ├── test005.py ├── test006.py ├── test007.py ├── test008.py ├── test009.py ├── test010.py ├── test011.py ├── test012.py ├── test013.py ├── test014.py ├── test015.py ├── test016.py ├── test017.py ├── test018.py ├── test019.py ├── test020.py ├── test021.py ├── test022.py ├── test023.py ├── test024.py ├── test025.py ├── test026.py ├── test027.py ├── test028.py ├── test029.py ├── test030.py ├── test031.py ├── test032.py ├── test033.py ├── test034.py ├── test035.py ├── test036.py ├── test037.py ├── test038.py ├── test039.py ├── test040.py ├── test041.py ├── test042.py ├── test043.py ├── test044.py ├── test045.py ├── test046.py ├── test047.py ├── test048.py ├── test049.py ├── test050.py ├── test051.py ├── test052.py ├── test053.py ├── test054.py ├── test055.py ├── test056.py ├── test057.py └── test058.py └── viewer ├── CMakeLists.txt ├── viewerPy.cpp ├── viewerPy.h ├── viewerPyApplication.cpp └── viewerPyApplication.h /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "CloudCompare"] 2 | path = CloudCompare 3 | url = https://gitlab.com/openfields1/cloudcompare.git 4 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | 15 | Copyright 2020-2021 Paul RASCLE www.openfields.fr 16 | 17 | When the CloudCompare FBX Plugin is installed: 18 | This software contains Autodesk® FBX® code developed by Autodesk, Inc. 19 | Copyright 2019 Autodesk, Inc. All rights, reserved. 20 | Such code is provided “as is” and Autodesk, Inc. disclaims any and all warranties, 21 | whether express or implied, including without limitation the implied warranties 22 | of merchantability, fitness for a particular purpose or non-infringement of 23 | third party rights. In no event shall Autodesk, Inc. be liable for any direct, 24 | indirect, incidental, special, exemplary, or consequential damages (including, 25 | but not limited to, procurement of substitute goods or services; loss of use, 26 | data, or profits; or business interruption) however caused and on any theory of 27 | liability, whether in contract, strict liability, or tort (including negligence 28 | or otherwise) arising in any way out of such code. 29 | -------------------------------------------------------------------------------- /building/Dockerfile_CloudComPy310_build: -------------------------------------------------------------------------------- 1 | FROM continuumio/miniconda3:master 2 | 3 | RUN . /opt/conda/etc/profile.d/conda.sh && \ 4 | conda activate && \ 5 | conda update -y -n base -c defaults conda && \ 6 | conda create -y --name CloudComPy310 python=3.10 && \ 7 | conda activate CloudComPy310 && \ 8 | conda config --add channels conda-forge && \ 9 | conda config --set channel_priority strict && \ 10 | conda install -y "boost=1.74" "cgal=5.4" cmake draco ffmpeg "gdal=3.5" jupyterlab laszip "matplotlib=3.5" "mysql=8.0" "numpy=1.22" "opencv=4.5" "openmp=8.0" "pcl=1.12" "pdal=2.4" "psutil=5.9" pybind11 quaternion "qhull=2020.2" "qt=5.15.4" "scipy=1.8" sphinx_rtd_theme spyder tbb tbb-devel "xerces-c=3.2" 11 | 12 | RUN apt-get update && apt-get install -y gfortran g++ make libgl1 libgl-dev 13 | 14 | RUN . /opt/conda/etc/profile.d/conda.sh && \ 15 | conda activate CloudComPy310 && \ 16 | cd && rm -rf CloudComPy && git clone --recurse-submodules https://github.com/prascle/CloudComPy.git && \ 17 | cd CloudComPy && git checkout CloudComPy_master_2024_06_13 --recurse-submodules 18 | 19 | ARG FBXINC=noplugin 20 | ARG FBXLIB=noplugin 21 | ARG CORKINC=noplugin 22 | ARG CORKLIB=noplugin 23 | ARG LIBIGL=noplugin 24 | ARG OPENCASCADE=noplugin 25 | 26 | COPY $FBXINC /root/fbxsdk/include/ 27 | COPY $FBXLIB /root/fbxsdk/lib/ 28 | COPY $CORKINC /root/cork/src/ 29 | COPY $CORKLIB /root/cork/lib/ 30 | copy $LIBIGL /root/libigl/ 31 | copy $OPENCASCADE /root/occt/ 32 | COPY genCloudComPy_Conda310_docker.sh /root/ 33 | 34 | RUN cd /root && \ 35 | if [ -f fbxsdk/include/fbxsdk.h ]; then \ 36 | sed -i 's/QFBX:BOOL="0"/QFBX:BOOL="1"/g' genCloudComPy_Conda310_docker.sh; \ 37 | fi; \ 38 | if [ -f cork/src/cork.h ]; then \ 39 | sed -i 's/QCORK:BOOL="0"/QCORK:BOOL="1"/g' genCloudComPy_Conda310_docker.sh; \ 40 | fi; \ 41 | cd /root && chmod +x genCloudComPy_Conda310_docker.sh && ./genCloudComPy_Conda310_docker.sh 42 | 43 | RUN echo "#!/bin/bash\n\ 44 | . /opt/conda/etc/profile.d/conda.sh\n\ 45 | cd /opt/installConda/CloudComPy310\n\ 46 | . bin/condaCloud.sh activate CloudComPy310\n\ 47 | export QT_QPA_PLATFORM=offscreen\n\ 48 | cd /opt/installConda/CloudComPy310/doc/PythonAPI_test\n\ 49 | ctest" > /execTests.sh && chmod +x /execTests.sh 50 | -------------------------------------------------------------------------------- /checkenv.py: -------------------------------------------------------------------------------- 1 | print("Checking environment, Python test: import cloudComPy") 2 | try: 3 | import cloudComPy as cc 4 | except: 5 | print("The environment seems to be incorrect! You need to set the conda environment for cloudComPy before running this script!") 6 | exit(1) 7 | print("Environment OK!") 8 | -------------------------------------------------------------------------------- /doc/BuildLinuxConda.md: -------------------------------------------------------------------------------- 1 | 2 | ## Build on Linux64, with Anaconda3 or miniconda3 3 | 4 | The script [genCloudComPy_Conda310_Ubuntu2004.sh](../building/genCloudComPy_Conda310_Ubuntu2004.sh) executes the following: 5 | 6 | - create or update the conda environment 7 | - activate the environment 8 | - build and install CloudComPy (Sources must be cloned from the [GitHub repository](https://github.com/CloudCompare/CloudComPy) 9 | or the [GitLab repository](https://gitlab.com/openfields1/CloudComPy) and up to date) 10 | - create the tarfile 11 | - execute ctest 12 | 13 | -------------------------------------------------------------------------------- /doc/BuildLinuxCondaDocker.md: -------------------------------------------------------------------------------- 1 | 2 | ## Build on Linux64, with Docker and Conda 3 | 4 | The build procedure is very similar to the [procedure used on Ubuntu with conda](BuildLinuxConda.md), 5 | but uses a docker container which provides a better control of the environment. 6 | 7 | This procedure has been tested on Ubuntu 20.04. 8 | 9 | You must have [installed docker](https://docs.docker.com/engine/install/) on your computer. 10 | 11 | Create a directory (for instance `dockerbuild`) for building the docker image and copy into it the script `genCloudComPy_Conda310_docker.sh`, 12 | the Docker file `Dockerfile_CloudComPy310_build` from the the `building` directory of the CloudComPy repository. 13 | 14 | Create also an empty file `noplugin` on docker image build directory (`dockerbuild`): 15 | 16 | ``` 17 | cd dockerbuild 18 | touch noplugin 19 | ``` 20 | This empty file will be used by the Dockerfile script if you don't want to install plugins 21 | that do not depend on the libraries provided with the conda packaging (Cork, FBX, MeshBoolean, Step). 22 | 23 | If you want the FBX I/O plugin, download the 24 | [FBX SDK for Linux](https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-0-1/fbx202001_fbxsdk_linux.tar.gz) 25 | from [Autodesk](https://www.autodesk.com/developer-network/platform-technologies/fbx-sdk-2020-0), 26 | create a `fbxsdk` directory on the directory for the docker image build and detar completely the sdk into it 27 | (two steps, you have to accept the License). 28 | 29 | To build without optional plugins: 30 | 31 | ``` 32 | cd dockerbuild 33 | docker build -f Dockerfile_CloudComPy310_build -t cloudcompy310_build . 34 | ``` 35 | To build with FBX SDK plugin: 36 | 37 | ``` 38 | cd dockerbuild 39 | docker build --build-arg FBXINC=fbxsdk/include --build-arg FBXLIB=fbxsdk/lib -f Dockerfile_CloudComPy310_build -t cloudcompy310_build . 40 | ``` 41 | 42 | **Note**: Building with other optional plugins is not yet documented. 43 | 44 | You have to run the docker image to execute the tests and get the binary tar file. 45 | Create an empty directory (for instance `~/CloudComPy/result`) on your host to share the results with the docker container. 46 | 47 | ``` 48 | mkdir -p ~/CloudComPy/result 49 | cd ~/CloudComPy/result 50 | docker run -it -v `pwd`:/root/CloudComPy cloudcompy310_build /bin/bash 51 | ``` 52 | 53 | from the container prompt: 54 | 55 | ``` 56 | ./execTests.sh 57 | /bin/cp /opt/installConda/CloudComPy_Conda310_Linux64_*.tgz /root/CloudComPy/ 58 | ``` 59 | 60 | On your host, on `~/CloudCompy/result`, get the files from the tests and the CloudComPy binary tarfile. 61 | This binary can be used in the same way as the linux binary available on the site 62 | [simulation.openfields.fr](https://www.simulation.openfields.fr/index.php/cloudcompy-downloads). 63 | 64 | **Remark**: shared results are root, change to current user: 65 | 66 | ``` 67 | cd ~/CloudComPy/result 68 | sudo chown -R `id -nu`:`id -ng` . 69 | ``` 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /doc/BuildUbuntuNative.md: -------------------------------------------------------------------------------- 1 | ## Build on Ubuntu 20.04 with native packages 2 | 3 | On Ubuntu 20.04, you can install the development versions of the prerequisites with: 4 | 5 | **TODO: complete the list, many packages are required...** 6 | 7 | ``` 8 | sudo apt-get install qtbase5-dev python3 libpython3-dev python3-numpy cmake 9 | ``` 10 | To run tests on memory usage, you need the python3 package python3-psutil. 11 | 12 | Commandline options (adapt the paths): 13 | 14 | ``` 15 | -DPYTHON_PREFERED_VERSION:STRING="3.8" -DPLUGIN_STANDARD_QM3C2:BOOL="1" -DBUILD_PY_TESTING:BOOL="1" -DPYTHONAPI_TEST_DIRECTORY:STRING="projets/CloudComPy/Data" -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DCCCORELIB_USE_CGAL:BOOL="1" -DPLUGIN_STANDARD_QRANSAC_SD:BOOL="1" -DPLUGIN_EXAMPLE_IO:BOOL="1" -DCMAKE_INSTALL_PREFIX:PATH="/home/paul/projets/CloudComPy/installRelease" -DBUILD_TESTING:BOOL="1" -DOPTION_USE_GDAL:BOOL="1" -DPLUGIN_GL_QEDL:BOOL="1" -DPLUGIN_IO_QCSV_MATRIX:BOOL="1" -DPLUGIN_GL_QSSAO:BOOL="1" -DPLUGIN_STANDARD_QPCL:BOOL="0" -DPLUGIN_IO_QADDITIONAL:BOOL="1" -DPLUGIN_STANDARD_QCOMPASS:BOOL="1" -DPLUGIN_STANDARD_QMPLANE:BOOL="1" -DPLUGIN_IO_QPHOTOSCAN:BOOL="1" -DPYTHONAPI_TRACES:BOOL="1" -DPLUGIN_IO_QE57:BOOL="1" -DPLUGIN_STANDARD_QBROOM:BOOL="1" -DPLUGIN_EXAMPLE_STANDARD:BOOL="1" -DPLUGIN_STANDARD_QPOISSON_RECON:BOOL="1" -DPLUGIN_EXAMPLE_GL:BOOL="1"``` 16 | ``` 17 | 18 | I use clang series compilers, but it should work with g++,gcc as well. Options to set with cmake-gui or ccmake (adapt the paths): 19 | 20 | ``` 21 | BUILD_PY_TESTING:BOOL=1 22 | BUILD_TESTING:BOOL=1 23 | CCCORELIB_USE_CGAL:BOOL=1 24 | CMAKE_BUILD_TYPE:STRING=RelWithDebInfo 25 | CMAKE_INSTALL_PREFIX:PATH=/home/paul/projets/CloudComPy/installRelease 26 | FBX_SDK_INCLUDE_DIR:PATH=/home/paul/projets/CloudComPy/fbxSdk/include 27 | FBX_SDK_LIBRARY_FILE:FILEPATH=/home/paul/projets/CloudComPy/fbxSdk/lib/gcc/x64/release/libfbxsdk.a 28 | FBX_XML2_LIBRARY_FILE:FILEPATH= 29 | FBX_ZLIB_LIBRARY_FILE:FILEPATH= 30 | OPTION_USE_GDAL:BOOL=1 31 | PLUGIN_EXAMPLE_GL:BOOL=1 32 | PLUGIN_EXAMPLE_IO:BOOL=1 33 | PLUGIN_EXAMPLE_STANDARD:BOOL=1 34 | PLUGIN_GL_QEDL:BOOL=1 35 | PLUGIN_GL_QSSAO:BOOL=1 36 | PLUGIN_IO_QADDITIONAL:BOOL=1 37 | PLUGIN_IO_QCORE:BOOL=1 38 | PLUGIN_IO_QCSV_MATRIX:BOOL=1 39 | PLUGIN_IO_QE57:BOOL=1 40 | PLUGIN_IO_QFBX:BOOL=1 41 | PLUGIN_IO_QPHOTOSCAN:BOOL=1 42 | PLUGIN_STANDARD_QBROOM:BOOL=1 43 | PLUGIN_STANDARD_QCOMPASS:BOOL=1 44 | PLUGIN_STANDARD_QM3C2:BOOL=1 45 | PLUGIN_STANDARD_QPCL:BOOL=1 46 | PLUGIN_STANDARD_QPOISSON_RECON:BOOL=1 47 | PLUGIN_STANDARD_QRANSAC_SD:BOOL=1 48 | PYTHONAPI_TEST_DIRECTORY:STRING=projets/CloudComPy/Data 49 | PYTHONAPI_TRACES:BOOL=1 50 | PYTHON_PREFERED_VERSION:STRING=3.8 51 | ``` 52 | 53 | After the CMake configuration and generation, run make (adapt the parallel option -j to your processor): 54 | 55 | ``` 56 | make -j12 && make test && make install 57 | ``` 58 | 59 | `make test` creates Point Cloud datasets and executes Python tests scripts using the cloudCompare module. 60 | The tests are installed in `/doc/PythonAPI_test`, with shell scripts to set the `PYTHONPATH` and launch one test. 61 | When in `/doc/PythonAPI_test`, `ctest` launches all the tests. 62 | 63 | The CloudCompare GUI is installed in `/bin/CloudCompare`, and works as usual. 64 | 65 | -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ########################################################################## 2 | # # 3 | # CloudComPy # 4 | # # 5 | # This program is free software; you can redistribute it and/or modify # 6 | # it under the terms of the GNU General Public License as published by # 7 | # the Free Software Foundation; either version 3 of the License, or # 8 | # any later version. # 9 | # # 10 | # This program is distributed in the hope that it will be useful, # 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | # GNU General Public License for more details. # 14 | # # 15 | # You should have received a copy of the GNU General Public License # 16 | # along with this program. If not, see . # 17 | # # 18 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | # # 20 | ########################################################################## 21 | 22 | set( USE_DOCS 23 | BuildLinuxConda.md 24 | BuildLinuxCondaDocker.md 25 | BuildUbuntuNative.md 26 | BuildWindowsConda.md 27 | prerequisitesVersions.md 28 | ReleaseNotes.md 29 | UseDockerLinuxConda.md 30 | UseDockerLinuxCondaBinary.md 31 | UseLinuxCondaBinary.md 32 | UseWindowsCondaBinary.md 33 | ) 34 | install(FILES ${USE_DOCS} DESTINATION doc) 35 | 36 | add_subdirectory( samples ) 37 | 38 | -------------------------------------------------------------------------------- /doc/prerequisitesVersions.md: -------------------------------------------------------------------------------- 1 | ## prerequisites required versions 2 | 3 | The minimum required version of each prerequisite is not always precisely identified. Examples of constructions that work are given here. 4 | 5 | First example: Linux64, Ubuntu 20.04, all native packages. 6 | 7 | Second and third example: Windows 10, Visual Studio 2019, Anaconda3 or miniconda to get all the prerequisites plus a lot more. With Python 3.7, there are few combination of working packages, it's easier to use Python 3.9. Qt 5.15.2 should be installed apart (binary package), it solves a bug on xyz files reading. 8 | 9 | Fourth example: Linux64 with conda packages, Python 3.9. 10 | 11 | | Platform | Linux Native | Windows 10 | Windows 10 | Linux | minimum | 12 | | -------- | -------------|---------------- | --------------- | --------------- | ------- | 13 | | | Ubuntu 20.04 | conda Python3.7 | conda Python3.9 | Conda Python3.9 | | 14 | | | (clang 10) | VS 2019 | VS 2019 | (clang 10) | | 15 | | -------- | -------------|---------------- | --------------- | --------------- | ------- | 16 | | Qt | 5.12.8 | 5.15.2 | 5.15.2 | 5.12.9 | 5.9 ? | 17 | | Python | 3.8.5 | 3.7.10 | | 3.9.7 | 3.6 | 18 | | Boost | 1.71 | 1.68 | | 1.72.0 | 1.68 ? | 19 | | Numpy | 1.17.4 | 1.20.2 | | 1.21.4 | 1.13 ? | 20 | | -------- | -------------|---------------- | --------------- | --------------- | ------- | 21 | -------------------------------------------------------------------------------- /doc/samples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ########################################################################## 2 | # # 3 | # CloudComPy # 4 | # # 5 | # This program is free software; you can redistribute it and/or modify # 6 | # it under the terms of the GNU General Public License as published by # 7 | # the Free Software Foundation; either version 3 of the License, or # 8 | # any later version. # 9 | # # 10 | # This program is distributed in the hope that it will be useful, # 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | # GNU General Public License for more details. # 14 | # # 15 | # You should have received a copy of the GNU General Public License # 16 | # along with this program. If not, see . # 17 | # # 18 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | # # 20 | ########################################################################## 21 | 22 | set( NOTEBOOK_SAMPLES 23 | histogramOnDistanceComputation.ipynb 24 | ) 25 | 26 | set( NOTEBOOK_SAMPLES_DIR doc/samples ) 27 | 28 | install(PROGRAMS ${NOTEBOOK_SAMPLES} 29 | DESTINATION ${NOTEBOOK_SAMPLES_DIR} 30 | ) 31 | -------------------------------------------------------------------------------- /envCloudComPy.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @set SCRIPT_DIR=%~dp0 3 | @set CLOUDCOMPY_ROOT=%SCRIPT_DIR% 4 | @set PYTHONPATH=%CLOUDCOMPY_ROOT%\CloudCompare;%PYTHONPATH% 5 | @set PYTHONPATH=%CLOUDCOMPY_ROOT%\doc\PythonAPI_test;%PYTHONPATH% 6 | @set PATH=%CLOUDCOMPY_ROOT%\CloudCompare;%CLOUDCOMPY_ROOT%\ccViewer;%SCRIPT_DIR%;%PATH% 7 | @set PATH=%CLOUDCOMPY_ROOT%\CloudCompare\plugins;%PATH% 8 | 9 | 2>NUL python "%CLOUDCOMPY_ROOT%\checkenv.py" || echo "Incorrect Environment! Problem with Python test!" 10 | -------------------------------------------------------------------------------- /pyAPI/PyScalarType.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CLOUDCOMPY_PYAPI_PYSCALARTYPE_H_ 23 | #define CLOUDCOMPY_PYAPI_PYSCALARTYPE_H_ 24 | 25 | #if defined SCALAR_TYPE_FLOAT 26 | #define PyScalarType float 27 | #define CC_NPY_FLOAT NPY_FLOAT32 28 | #define CC_NPY_FLOAT_STRING "float32" 29 | #else 30 | #define PyScalarType double 31 | #define CC_NPY_FLOAT NPY_FLOAT64 32 | #define CC_NPY_FLOAT_STRING "float64" 33 | #endif 34 | 35 | #endif /* CLOUDCOMPY_PYAPI_PYSCALARTYPE_H_ */ 36 | -------------------------------------------------------------------------------- /pyAPI/ccNumpyIncludes.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CLOUDCOMPY_PYAPI_CCNUMPYINCLUDES_H_ 23 | #define CLOUDCOMPY_PYAPI_CCNUMPYINCLUDES_H_ 24 | 25 | // See Numpy documentation for PY_ARRAY_UNIQUE_SYMBOL and NO_IMPORT_ARRAY 26 | // Numpy initialisation can be done once in a Python module constituted of several c source files 27 | // Here, these source files are generated by sip. 28 | // One source per module, plus one per class or type described in sip 29 | // The Numpy C-API is held by the symbol defined by PY_ARRAY_UNIQUE_SYMBOL and shared between all the sources of the module 30 | // One source should define the PY_ARRAY_UNIQUE_SYMBOL, all the other sources should reference it (extern) with NO_IMPORT_ARRAY 31 | // So, this include is for all TypeHeaderCode in sip files, except the only TypeHeaderCode dedicated to the PY_ARRAY_UNIQUE_SYMBOL definition. 32 | 33 | #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION 34 | #define NO_IMPORT_ARRAY 35 | #define PY_ARRAY_UNIQUE_SYMBOL PYCC_ARRAY_API 36 | #include 37 | 38 | #endif /* CLOUDCOMPY_PYAPI_CCNUMPYINCLUDES_H_ */ 39 | -------------------------------------------------------------------------------- /pyAPI/initCC.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #include 23 | #include "initCC.h" 24 | #include 25 | #include 26 | #include 27 | 28 | QString initCC::moduleDir = ""; 29 | 30 | //! find CloudCompare appDir (see pyAPI::pyCC_setupPaths) 31 | void initCC::init(const char* modulePath) 32 | { 33 | QDir myModule = QString(modulePath); // module path is something like /lib/cloudcompare/cloudComPy/__init__.py 34 | bool ok = myModule.cdUp(); 35 | ok = myModule.cdUp(); 36 | moduleDir = myModule.absolutePath(); //moduleDir should be where the CloudCompare libs and plugins directory are: /lib/cloudcompare 37 | CCTRACE("moduleDir: " << moduleDir.toStdString()); 38 | } 39 | 40 | initCC::initCC() 41 | { 42 | } 43 | 44 | initCC::initCC(const initCC&) 45 | { 46 | } 47 | 48 | -------------------------------------------------------------------------------- /pyAPI/initCC.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CLOUDCOMPY_PYAPI_INITCC_H_ 23 | #define CLOUDCOMPY_PYAPI_INITCC_H_ 24 | 25 | #include 26 | 27 | //! class with only a static method for initialisation in a specific generated sip source (see cloudCompare.sip) 28 | 29 | class initCC 30 | { 31 | public: 32 | //! get the runtime path of the python module cloudCompare, required to find the plugins 33 | static void init(const char* modulePath); 34 | 35 | //! runtime path of the python module cloudCompare, required to find the plugins 36 | static QString moduleDir; 37 | 38 | private: 39 | initCC(); 40 | initCC(const initCC&); 41 | }; 42 | 43 | #endif /* CLOUDCOMPY_PYAPI_INITCC_H_ */ 44 | -------------------------------------------------------------------------------- /pyAPI/optdefines.h.in: -------------------------------------------------------------------------------- 1 | #ifndef __OPTDEFINES_H__ 2 | #define __OPTDEFINES_H__ 3 | 4 | #cmakedefine PLUGIN_IO_QDRACO 5 | #cmakedefine PLUGIN_IO_QFBX 6 | #cmakedefine PLUGIN_IO_QLAS_FWF 7 | #cmakedefine PLUGIN_STANDARD_QM3C2 8 | #cmakedefine PLUGIN_STANDARD_QPCL 9 | #cmakedefine PLUGIN_STANDARD_QPCV 10 | #cmakedefine PLUGIN_STANDARD_QCSF 11 | #cmakedefine PLUGIN_STANDARD_QHPR 12 | #cmakedefine PLUGIN_STANDARD_QSRA 13 | #cmakedefine PLUGIN_STANDARD_QMESH_BOOLEAN 14 | #cmakedefine PLUGIN_STANDARD_QRANSAC_SD 15 | #cmakedefine PLUGIN_STANDARD_QCANUPO 16 | #cmakedefine PLUGIN_STANDARD_QPOISSON_RECON 17 | #cmakedefine PLUGIN_STANDARD_QCORK 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /pybind11/CSF/CSFPy.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #include "cloudComPy.hpp" 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | #include "pyccTrace.h" 35 | #include "CSF_DocStrings.hpp" 36 | 37 | void initTrace_CSF() 38 | { 39 | #ifdef _PYTHONAPI_DEBUG_ 40 | ccLogTrace::settrace(); 41 | #endif 42 | } 43 | 44 | PYBIND11_MODULE(_CSF, m7) 45 | { 46 | m7.doc() = CSF_doc; 47 | 48 | m7.def("computeCSF", qCSF::computeCSF, 49 | py::arg("pc"), py::arg("csfRigidness")=2, py::arg("maxIteration")=500, py::arg("clothResolution")=2.0, 50 | py::arg("classThreshold")=0.5, py::arg("csfPostprocessing")=false, py::arg("computeMesh")=false, 51 | CSF_computeCSF_doc); 52 | m7.def("initTrace_CSF", initTrace_CSF, CSF_initTrace_CSF_doc); 53 | } 54 | 55 | -------------------------------------------------------------------------------- /pybind11/CSF/CSF_DocStrings.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CSF_DOCSTRINGS_HPP_ 23 | #define CSF_DOCSTRINGS_HPP_ 24 | 25 | 26 | const char* CSF_doc= R"( 27 | CSF is a standard plugin of cloudComPy. 28 | 29 | The availability of the plugin can be tested with the isPluginCSF function: 30 | 31 | isCSF_available = cc.isPluginCSF() 32 | 33 | CSF is a submodule of cloudCompy: 34 | :: 35 | 36 | import cloudComPy as cc 37 | # ... 38 | if cc.isPluginCSF(): 39 | import cloudComPy.CSF 40 | cc.CSF.computeCSF(...) 41 | )"; 42 | 43 | const char* CSF_computeCSF_doc=R"( 44 | Compute Cloth Simulation Filter (CSF). 45 | 46 | See `CSF plugin `_. 47 | 48 | :param ccPointCloud pc: the point cloud on which the filter is applied. 49 | :param int,optional csfRigidness: from (1:steep slope, 2:relief 3:flat), default 2 50 | :param int,optional maxIteration: maximum iterations, default 500 51 | :param double,optional clothResolution: default 2.0 52 | :param double,optional classThreshold: default 0.5 53 | :param bool,optional csfPostprocessing: default false 54 | :param bool,optional computeMesh: default false, compute the cloth mesh 55 | 56 | :return: a list of clouds and mesh (ground, offground, optional cloth mesh) 57 | :rtype: list 58 | )"; 59 | 60 | const char* CSF_initTrace_CSF_doc=R"( 61 | Debug trace must be initialized for each Python module. 62 | 63 | Done in module init, following the value of environment variable _CCTRACE_ ("ON" if debug traces wanted) 64 | )"; 65 | 66 | 67 | #endif /* CSF_DOCSTRINGS_HPP_ */ 68 | -------------------------------------------------------------------------------- /pybind11/CSF/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | """ 25 | CSF is a standard plugin of cloudComPy. 26 | 27 | The availability of the plugin can be tested with the :py:meth:`cloudComPy.isPluginCSF` function: 28 | :: 29 | 30 | isCSF_available = cc.isPluginCSF() 31 | 32 | CSF is a submodule of cloudCompy: 33 | :: 34 | 35 | import cloudComPy as cc 36 | # ... 37 | if cc.isPluginCSF(): 38 | import cloudComPy.CSF 39 | cc.CSF.computeCSF(...) 40 | """ 41 | from _CSF import * 42 | initTrace_CSF() 43 | -------------------------------------------------------------------------------- /pybind11/Canupo/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | """ 25 | Canupo is a standard plugin of cloudComPy. 26 | 27 | The availability of the plugin can be tested with the :py:meth:`cloudComPy.isPluginCanupo` function: 28 | :: 29 | 30 | isCanupo_available = cc.isPluginCanupo() 31 | 32 | Canupo is a submodule of cloudCompy: 33 | :: 34 | 35 | import cloudComPy as cc 36 | # ... 37 | if cc.isPluginCanupo(): 38 | import cloudComPy.Canupo 39 | cc.Canupo.computeCanupo(...) 40 | """ 41 | from _Canupo import * 42 | initTrace_Canupo() 43 | -------------------------------------------------------------------------------- /pybind11/Cork/CorkPy.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #include "cloudComPy.hpp" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | #include "pyccTrace.h" 37 | #include "Cork_DocStrings.hpp" 38 | 39 | void initTrace_Cork() 40 | { 41 | #ifdef _PYTHONAPI_DEBUG_ 42 | ccLogTrace::settrace(); 43 | #endif 44 | } 45 | 46 | PYBIND11_MODULE(_Cork, m11) 47 | { 48 | m11.doc() = Cork_doc; 49 | 50 | py::enum_(m11, "CSG_OPERATION") 51 | .value("UNION", qCork::CSG_OPERATION::UNION) 52 | .value("INTERSECT", qCork::CSG_OPERATION::INTERSECT) 53 | .value("DIFF", qCork::CSG_OPERATION::DIFF) 54 | .value("SYM_DIFF", qCork::CSG_OPERATION::SYM_DIFF) 55 | .export_values(); 56 | 57 | 58 | py::class_(m11, "Cork", Cork_Cork_doc) 59 | .def_static("compute", &qCork::compute, 60 | ::py::arg("meshA"), 61 | ::py::arg("meshB"), 62 | ::py::arg("operation"), 63 | Cork_compute_doc); 64 | ; 65 | 66 | m11.def("initTrace_Cork", &initTrace_Cork, Cork_initTrace_Cork_doc); 67 | } 68 | 69 | -------------------------------------------------------------------------------- /pybind11/Cork/Cork_DocStrings.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef Cork_DOCSTRINGS_HPP_ 23 | #define Cork_DOCSTRINGS_HPP_ 24 | 25 | 26 | const char* Cork_doc= R"( 27 | Cork is a standard plugin of cloudComPy. 28 | 29 | The availability of the plugin can be tested with the isPluginCork function: 30 | 31 | isCork_available = cc.isPluginCork() 32 | 33 | Cork is a submodule of cloudCompy: 34 | :: 35 | 36 | import cloudComPy as cc 37 | # ... 38 | if cc.isPluginCork(): 39 | import cloudComPy.Cork 40 | mesh = cc.Cork.Cork.compute(...) 41 | )"; 42 | 43 | const char* Cork_Cork_doc = R"( 44 | We only use the static method compute of this class. 45 | )"; 46 | 47 | const char* Cork_compute_doc = R"( 48 | Compute Boolean operation between mesh A and mesh B. 49 | 50 | :param ccMesh meshA: first mesh 51 | :param ccMesh meshB: second mesh 52 | :param CSG_OPERATION operation: from UNION, INTERSECT, DIFF, SYM_DIFF 53 | 54 | :return: result of the Boolean operation 55 | :rtype: ccMesh 56 | )"; 57 | 58 | const char* Cork_initTrace_Cork_doc=R"( 59 | Debug trace must be initialized for each Python module. 60 | 61 | Done in module init, following the value of environment variable _CCTRACE_ ("ON" if debug traces wanted) 62 | )"; 63 | 64 | 65 | #endif /* Cork_DOCSTRINGS_HPP_ */ 66 | -------------------------------------------------------------------------------- /pybind11/Cork/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | """ 25 | Cork is a standard plugin of cloudComPy. 26 | 27 | The availability of the plugin can be tested with the :py:meth:`cloudComPy.isPluginCork` function: 28 | :: 29 | 30 | isCork_available = cc.isPluginCork() 31 | 32 | Cork is a submodule of cloudCompy: 33 | :: 34 | 35 | import cloudComPy as cc 36 | # ... 37 | if cc.isPluginCork(): 38 | import cloudComPy.Cork 39 | mesh = cc.Cork.Cork.Compute(...) 40 | """ 41 | from _Cork import * 42 | initTrace_Cork() 43 | -------------------------------------------------------------------------------- /pybind11/HPR/HPR_DocStrings.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef HPR_DOCSTRINGS_HPP_ 23 | #define HPR_DOCSTRINGS_HPP_ 24 | 25 | 26 | const char* HPR_doc= R"( 27 | HPR is a standard plugin of cloudComPy. 28 | 29 | The availability of the plugin can be tested with the isPluginHPR function: 30 | 31 | isHPR_available = cc.isPluginHPR() 32 | 33 | HPR is a submodule of cloudCompy: 34 | :: 35 | 36 | import cloudComPy as cc 37 | # ... 38 | if cc.isPluginHPR(): 39 | import cloudComPy.HPR 40 | cc.HPR.computeHPR(...) 41 | )"; 42 | 43 | const char* HPR_computeHPR_doc=R"( 44 | Compute Hidden Point Removal for point cloud. (plugin HPR) 45 | 46 | The HPR algorithm creates a new cloud in which the hidden points are removed. 47 | The viewPoint coordinates are required. 48 | (With the CloudCompare GUI, the viewPoint is deduced from the 3D view). 49 | 50 | :param ccPointCloud cloud: input cloud, with hidden points. 51 | :param ccVector3D viewPoint: view point coordinates 52 | :param int,optional octreeLevel: octree level, default 7. 53 | 54 | :return: point cloud without hidden points or None (if problem or no change) 55 | :rtype: ccPointCloud 56 | )"; 57 | 58 | const char* HPR_initTrace_HPR_doc=R"( 59 | Debug trace must be initialized for each Python module. 60 | 61 | Done in module init, following the value of environment variable _CCTRACE_ ("ON" if debug traces wanted) 62 | )"; 63 | 64 | 65 | #endif /* HPR_DOCSTRINGS_HPP_ */ 66 | -------------------------------------------------------------------------------- /pybind11/HPR/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | """ 25 | HPR is a standard plugin of cloudComPy. 26 | 27 | The availability of the plugin can be tested with the :py:meth:`cloudComPy.isPluginHPR` function: 28 | :: 29 | 30 | isHPR_available = cc.isPluginHPR() 31 | 32 | HPR is a submodule of cloudCompy: 33 | :: 34 | 35 | import cloudComPy as cc 36 | # ... 37 | if cc.isPluginHPR(): 38 | import cloudComPy.HPR 39 | cc.HPR.computeHPR(...) 40 | """ 41 | from _HPR import * 42 | initTrace_HPR() 43 | 44 | -------------------------------------------------------------------------------- /pybind11/M3C2/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | """ 25 | M3C2 is a standard plugin of cloudComPy. 26 | 27 | The availability of the plugin can be tested with the :py:meth:`cloudComPy.isPluginM3C2` function: 28 | :: 29 | 30 | isM3C2_available = cc.isPluginM3C2() 31 | 32 | M3C2 is a submodule of cloudCompy: 33 | :: 34 | 35 | import cloudComPy as cc 36 | # ... 37 | if cc.isPluginM3C2(): 38 | import cloudComPy.M3C2 39 | cc.M3C2.computeM3C2(...) 40 | """ 41 | from _M3C2 import * 42 | initTrace_M3C2() 43 | 44 | -------------------------------------------------------------------------------- /pybind11/MeshBoolean/MeshBooleanPy.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #include "cloudComPy.hpp" 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | #include 30 | 31 | #include "pyccTrace.h" 32 | #include "MeshBoolean_DocStrings.hpp" 33 | 34 | void initTrace_MeshBoolean() 35 | { 36 | #ifdef _PYTHONAPI_DEBUG_ 37 | ccLogTrace::settrace(); 38 | #endif 39 | } 40 | 41 | 42 | PYBIND11_MODULE(_MeshBoolean, m4) 43 | { 44 | m4.doc() = MeshBoolean_doc; 45 | 46 | py::enum_(m4, "CSG_OPERATION") 47 | .value("UNION", CSG_OPERATION::UNION) 48 | .value("INTERSECT", CSG_OPERATION::INTERSECT) 49 | .value("DIFF", CSG_OPERATION::DIFF) 50 | .value("SYM_DIFF", CSG_OPERATION::SYM_DIFF) 51 | .export_values(); 52 | ; 53 | 54 | m4.def("computeMeshBoolean", &computeMeshBoolean, 55 | py::return_value_policy::reference, MeshBoolean_computeMeshBoolean_doc); 56 | m4.def("initTrace_MeshBoolean", initTrace_MeshBoolean, MeshBoolean_initTrace_MeshBoolean_doc); 57 | } 58 | -------------------------------------------------------------------------------- /pybind11/MeshBoolean/MeshBoolean_DocStrings.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef MeshBoolean_DOCSTRINGS_HPP_ 23 | #define MeshBoolean_DOCSTRINGS_HPP_ 24 | 25 | 26 | const char* MeshBoolean_doc= R"( 27 | MeshBoolean is a standard plugin of cloudComPy. 28 | 29 | The availability of the plugin can be tested with the isPluginMeshBoolean function: 30 | 31 | isMeshBoolean_available = cc.isPluginMeshBoolean() 32 | 33 | MeshBoolean is a submodule of cloudCompy: 34 | :: 35 | 36 | import cloudComPy as cc 37 | # ... 38 | if cc.isPluginMeshBoolean(): 39 | import cloudComPy.MeshBoolean 40 | cc.MeshBoolean.computeMeshBoolean(...) 41 | )"; 42 | 43 | const char* MeshBoolean_computeMeshBoolean_doc=R"( 44 | Compute boolean operation on two meshes. (plugin MeshBoolean) 45 | 46 | The boolean operation are UNION, INTERSECT, DIFF, SYM_DIFF. 47 | Original meshes are not modified, a new mesh is built. 48 | 49 | :param ccMesh MeshA: first mesh. 50 | :param ccMesh MeshB: second mesh. 51 | :param CSG_OPERATION operation: from cc.MeshBoolean.CSG_OPERATION (UNION, INTERSECT, DIFF, SYM_DIFF) 52 | 53 | :return: new mesh or None 54 | :rtype: ccMesh 55 | )"; 56 | 57 | const char* MeshBoolean_initTrace_MeshBoolean_doc=R"( 58 | Debug trace must be initialized for each Python module. 59 | 60 | Done in module init, following the value of environment variable _CCTRACE_ ("ON" if debug traces wanted) 61 | )"; 62 | 63 | 64 | #endif /* MeshBoolean_DOCSTRINGS_HPP_ */ 65 | -------------------------------------------------------------------------------- /pybind11/MeshBoolean/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | """ 25 | MeshBoolean is a standard plugin of cloudComPy. 26 | 27 | The availability of the plugin can be tested with the :py:meth:`cloudComPy.isPluginMeshBoolean` function: 28 | :: 29 | 30 | isMeshBoolean_available = cc.isPluginMeshBoolean() 31 | 32 | MeshBoolean is a submodule of cloudCompy: 33 | :: 34 | 35 | import cloudComPy as cc 36 | # ... 37 | if cc.isPluginMeshBoolean(): 38 | import cloudComPy.MeshBoolean 39 | cc.MeshBoolean.computeMeshBoolean(...) 40 | """ 41 | from _MeshBoolean import * 42 | initTrace_MeshBoolean() 43 | 44 | -------------------------------------------------------------------------------- /pybind11/NeighbourhoodPy.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #include "cloudComPy.hpp" 23 | 24 | #include 25 | #include "NeighbourhoodPy_DocStrings.hpp" 26 | 27 | void export_Neighbourhood(py::module &m0) 28 | { 29 | py::enum_(m0, "GeomFeature") 30 | .value("EigenValuesSum", CCCoreLib::Neighbourhood::EigenValuesSum) 31 | .value("Omnivariance", CCCoreLib::Neighbourhood::Omnivariance) 32 | .value("EigenEntropy", CCCoreLib::Neighbourhood::EigenEntropy) 33 | .value("Anisotropy", CCCoreLib::Neighbourhood::Anisotropy) 34 | .value("Planarity", CCCoreLib::Neighbourhood::Planarity) 35 | .value("Linearity", CCCoreLib::Neighbourhood::Linearity) 36 | .value("PCA1", CCCoreLib::Neighbourhood::PCA1) 37 | .value("PCA2", CCCoreLib::Neighbourhood::PCA2) 38 | .value("SurfaceVariation", CCCoreLib::Neighbourhood::SurfaceVariation) 39 | .value("Sphericity", CCCoreLib::Neighbourhood::Sphericity) 40 | .value("Verticality", CCCoreLib::Neighbourhood::Verticality) 41 | .value("EigenValue1", CCCoreLib::Neighbourhood::EigenValue1) 42 | .value("EigenValue2", CCCoreLib::Neighbourhood::EigenValue2) 43 | .value("EigenValue3", CCCoreLib::Neighbourhood::EigenValue3) 44 | .export_values(); 45 | ; 46 | } 47 | -------------------------------------------------------------------------------- /pybind11/NeighbourhoodPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef NEIGHBOURHOODPY_HPP_ 23 | #define NEIGHBOURHOODPY_HPP_ 24 | 25 | void export_Neighbourhood(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /pybind11/NeighbourhoodPy_DocStrings.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef NEIGHBOURHOODPY_DOCSTRINGS_HPP_ 23 | #define NEIGHBOURHOODPY_DOCSTRINGS_HPP_ 24 | 25 | const char* NeighbourhoodPy__doc= R"()"; 26 | 27 | #endif /* NEIGHBOURHOODPY_DOCSTRINGS_HPP_ */ 28 | -------------------------------------------------------------------------------- /pybind11/PCL/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | """ 25 | PCL is a standard plugin of cloudComPy. 26 | The plugin implements some methods of the Point Cloud Library (PCL): https://pointclouds.org. 27 | 28 | The availability of the plugin can be tested with the :py:meth:`cloudComPy.isPluginPCL` function: 29 | :: 30 | 31 | isPCL_available = cc.isPluginPCL() 32 | 33 | PCL is a submodule of cloudCompy: 34 | :: 35 | 36 | import cloudComPy as cc 37 | # ... 38 | if cc.isPluginPCL(): 39 | import cloudComPy.PCL 40 | fgr = cc.PCL.FastGlobalRegistrationFilter() 41 | fgr.setParameters(...) 42 | fgr.compute() 43 | """ 44 | from _PCL import * 45 | initTrace_PCL() 46 | 47 | -------------------------------------------------------------------------------- /pybind11/PCV/PCV_DocStrings.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef PCV_DOCSTRINGS_HPP_ 23 | #define PCV_DOCSTRINGS_HPP_ 24 | 25 | 26 | const char* PCV_doc= R"( 27 | PCV is a standard plugin of cloudComPy. 28 | 29 | The availability of the plugin can be tested with the isPluginPCV function: 30 | 31 | isPCV_available = cc.isPluginPCV() 32 | 33 | PCV is a submodule of cloudCompy: 34 | :: 35 | 36 | import cloudComPy as cc 37 | # ... 38 | if cc.isPluginPCV(): 39 | import cloudComPy.PCV 40 | cc.PCV.computeShadeVIS(...) 41 | )"; 42 | 43 | const char* PCV_computeShadeVIS_doc=R"( 44 | Compute Ambient Occlusion for mesh or point cloud. (plugin PCV / ShadeVIS) 45 | 46 | The ambient occlusion is either computed with normals samples on a sphere or upper Z hemisphere, 47 | or with normals provided with a cloud. 48 | Result on a ScalarField. 49 | 50 | :param list clouds: list of clouds or meshes on witch to compute the ShadeVIS. 51 | :param ccpointCloud,optional cloudWithNormals: cloud with normals, default None 52 | :param int,optional rayCount: number of normals to use if sampled on a sphere or hemisphere, default 256. 53 | :param int,optional resolution: render context resolution, default 1024 54 | :param bool,optional is360: use the whole sphere or not (default false) 55 | :param bool,optional isClosedMesh: if the mesh is closed, accelerate the computation (default false) 56 | 57 | :return: success 58 | :rtype: bool 59 | )"; 60 | 61 | const char* PCV_initTrace_PCV_doc=R"( 62 | Debug trace must be initialized for each Python module. 63 | 64 | Done in module init, following the value of environment variable _CCTRACE_ ("ON" if debug traces wanted) 65 | )"; 66 | 67 | 68 | #endif /* PCV_DOCSTRINGS_HPP_ */ 69 | -------------------------------------------------------------------------------- /pybind11/PCV/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | """ 25 | PCV is a standard plugin of cloudComPy. 26 | 27 | The availability of the plugin can be tested with the :py:meth:`cloudComPy.isPluginPCV` function: 28 | :: 29 | 30 | isPCV_available = cc.isPluginPCV() 31 | 32 | PCV is a submodule of cloudCompy: 33 | :: 34 | 35 | import cloudComPy as cc 36 | # ... 37 | if cc.isPluginPCV(): 38 | import cloudComPy.PCV 39 | cc.PCV.computeShadeVIS(...) 40 | """ 41 | from _PCV import * 42 | initTrace_PCV() 43 | -------------------------------------------------------------------------------- /pybind11/PoissonRecon/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | """ 25 | PoissonRecon is a standard plugin of cloudComPy. 26 | 27 | The availability of the plugin can be tested with the :py:meth:`cloudComPy.isPluginPoissonRecon` function: 28 | :: 29 | 30 | isPoissonRecon_available = cc.isPluginPoissonRecon() 31 | 32 | PoissonRecon is a submodule of cloudCompy: 33 | :: 34 | 35 | import cloudComPy as cc 36 | # ... 37 | if cc.isPluginPoissonRecon(): 38 | import cloudComPy.PoissonRecon 39 | mesh = cc.PoissonRecon.PR.PoissonReconstruction(...) 40 | """ 41 | from _PoissonRecon import * 42 | initTrace_PoissonRecon() 43 | -------------------------------------------------------------------------------- /pybind11/RANSAC_SD/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | """ 25 | RANSAC_SD is a standard plugin of cloudComPy. 26 | 27 | The availability of the plugin can be tested with the :py:meth:`cloudComPy.isPluginRANSAC_SD` function: 28 | :: 29 | 30 | isRANSAC_SD_available = cc.isPluginRANSAC_SD() 31 | 32 | RANSAC_SD is a submodule of cloudCompy: 33 | :: 34 | 35 | import cloudComPy as cc 36 | # ... 37 | if cc.isPluginRANSAC_SD(): 38 | import cloudComPy.RANSAC_SD 39 | params = cc.RANSAC_SD.RansacParams() 40 | results = cc.RANSAC_SD.computeRANSAC_SD(cloud, params) 41 | """ 42 | from _RANSAC_SD import * 43 | initTrace_RANSAC_SD() 44 | 45 | -------------------------------------------------------------------------------- /pybind11/SRA/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | """ 25 | SRA is a standard plugin of cloudComPy. 26 | 27 | The availability of the plugin can be tested with the :py:meth:`cloudComPy.isPluginSRA` function: 28 | :: 29 | 30 | isSRA_available = cc.isPluginSRA() 31 | 32 | SRA is a submodule of cloudCompy: 33 | :: 34 | 35 | import cloudComPy as cc 36 | # ... 37 | if cc.isPluginSRA(): 38 | import cloudComPy.SRA 39 | cc.SRA.loadProfile(...) 40 | """ 41 | from cloudComPy import DEFAULT_SCALES 42 | from _SRA import * 43 | initTrace_SRA() 44 | -------------------------------------------------------------------------------- /pybind11/ScalarFieldPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef SCALARFIELDPY_HPP_ 23 | #define SCALARFIELDPY_HPP_ 24 | 25 | void export_ScalarField(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /pybind11/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | """ 25 | cloudComPy is the Python module interfacing cloudCompare library. 26 | Python3 access to cloudCompare objects is done like this: 27 | :: 28 | 29 | import cloudComPy as cc 30 | cc.initCC() # to do once before using plugins 31 | cloud = cc.loadPointCloud("/home/paul/CloudComPy/Data/boule.bin") 32 | 33 | """ 34 | from _cloudComPy import * 35 | initCC() 36 | initCloudCompare() 37 | -------------------------------------------------------------------------------- /pybind11/ccFacetPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CCFACETPY_HPP_ 23 | #define CCFACETPY_HPP_ 24 | 25 | void export_ccFacet(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /pybind11/ccGenericCloudPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CCGENERICCLOUDPY_HPP_ 23 | #define CCGENERICCLOUDPY_HPP_ 24 | 25 | void export_ccGenericCloud(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /pybind11/ccMeshPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CCMESHPY_HPP_ 23 | #define CCMESHPY_HPP_ 24 | 25 | void export_ccMesh(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /pybind11/ccOctreePy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CCOCTREEPY_HPP_ 23 | #define CCOCTREEPY_HPP_ 24 | 25 | #include 26 | #include 27 | 28 | struct PointDescriptor_persistent_py 29 | { 30 | const CCVector3 point; 31 | unsigned pointIndex; 32 | double squareDistd; 33 | PointDescriptor_persistent_py(); 34 | PointDescriptor_persistent_py(const CCCoreLib::DgmOctree::PointDescriptor& pt); 35 | }; 36 | 37 | void export_ccOctree(); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /pybind11/ccPointCloudPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CCPOINTCLOUDPY_HPP_ 23 | #define CCPOINTCLOUDPY_HPP_ 24 | 25 | void export_ccPointCloud(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /pybind11/ccPolylinePy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CCPOLYLINEPY_HPP_ 23 | #define CCPOLYLINEPY_HPP_ 24 | 25 | void export_ccPolyline(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /pybind11/ccPrimitivesPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CCPRIMITIVESPY_HPP_ 23 | #define CCPRIMITIVESPY_HPP_ 24 | 25 | void export_ccPrimitives(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /pybind11/ccSensorPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CCSENSORPY_HPP_ 23 | #define CCSENSORPY_HPP_ 24 | 25 | void export_ccSensor(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /pybind11/cloudComPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CLOUDCOMPY_HPP_ 23 | #define CLOUDCOMPY_HPP_ 24 | 25 | #define PYBIND11_DETAILED_ERROR_MESSAGES 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include "conversions.hpp" 32 | #include 33 | 34 | namespace py = pybind11; 35 | 36 | PYBIND11_DECLARE_HOLDER_TYPE(T, QSharedPointer); 37 | namespace PYBIND11_NAMESPACE { namespace detail { 38 | template 39 | struct holder_helper> { // <-- specialization 40 | static const T *get(const QSharedPointer &p) { CCTRACE("pointer " << p.data()); return p.data(); } 41 | }; 42 | }} 43 | 44 | void export_colors(py::module &); 45 | void export_ScalarField(py::module &); 46 | void export_ccGenericCloud(py::module &); 47 | void export_ccPolyline(py::module &); 48 | void export_ccOctree(py::module &); 49 | void export_ccPointCloud(py::module &); 50 | void export_ccMesh(py::module &); 51 | void export_ccPrimitives(py::module &); 52 | void export_distanceComputationTools(py::module &); 53 | void export_geometricalAnalysisTools(py::module &); 54 | void export_registrationTools(py::module &); 55 | void export_cloudSamplingTools(py::module &); 56 | void export_ccFacet(py::module &); 57 | void export_ccSensor(py::module &); 58 | void export_Neighbourhood(py::module &); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /pybind11/cloudSamplingToolsPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef CLOUDSAMPLINGTOOLSPY_HPP_ 23 | #define CLOUDSAMPLINGTOOLSPY_HPP_ 24 | 25 | void export_cloudSamplingTools(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /pybind11/colorsPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef COLORSPY_HPP_ 23 | #define COLORSPY_HPP_ 24 | 25 | #include 26 | namespace py = pybind11; 27 | 28 | void export_colors(py::module_ &); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /pybind11/distanceComputationToolsPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef DISTANCECOMPUTATIONTOOLSPY_HPP_ 23 | #define DISTANCECOMPUTATIONTOOLSPY_HPP_ 24 | 25 | void export_distanceComputationTools(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /pybind11/geometricalAnalysisToolsPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef GEOMETRICALANALYSISTOOLSPY_HPP_ 23 | #define GEOMETRICALANALYSISTOOLSPY_HPP_ 24 | 25 | void export_geometricalAnalysisTools(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /pybind11/geometricalAnalysisToolsPy_DocStrings.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef GEOMETRICALANALYSISTOOLSPY_DOCSTRINGS_HPP_ 23 | #define GEOMETRICALANALYSISTOOLSPY_DOCSTRINGS_HPP_ 24 | 25 | const char* geometricalAnalysisToolsPy_GeometricalAnalysisTools_doc= R"( 26 | Several algorithms to compute point-clouds geometric characteristics (curvature, density, etc.) 27 | )"; 28 | 29 | const char* geometricalAnalysisToolsPy_FlagDuplicatePoints_doc= R"( 30 | Flag duplicate points. 31 | 32 | 33 | This method only requires an output scalar field. Duplicate points will be 34 | associated to scalar value 1 (and 0 for the others). 35 | 36 | :param GenericIndexedCloudPersist theCloud: processed cloud 37 | :param float,optional minDistanceBetweenPoints: min distance between (output) points, 38 | default C++ std::numeric_limits::epsilon() i.e. ~ 2.2 e-16 39 | :param GenericProgressCallback,optional progressCb: client application can get some notification of the process progress 40 | through this callback mechanism (see GenericProgressCallback) 41 | :param DgmOctree,optional inputOctree: if not set as input, octree will be automatically computed. 42 | 43 | :return: success (0) or error code (<0) 44 | :rtype: ErrorCode 45 | )"; 46 | 47 | 48 | #endif /* GEOMETRICALANALYSISTOOLSPY_DOCSTRINGS_HPP_ */ 49 | -------------------------------------------------------------------------------- /pybind11/registrationToolsPy.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #include "cloudComPy.hpp" 23 | 24 | #include 25 | 26 | #include "PyScalarType.h" 27 | #include "pyccTrace.h" 28 | 29 | 30 | void export_registrationTools(py::module &m0) 31 | { 32 | 33 | py::class_(m0, "RegistrationTools") 34 | ; 35 | 36 | py::enum_(m0, "TRANSFORMATION_FILTERS") 37 | .value("SKIP_NONE", CCCoreLib::RegistrationTools::SKIP_NONE) 38 | .value("SKIP_RXY", CCCoreLib::RegistrationTools::SKIP_RXY) 39 | .value("SKIP_RYZ", CCCoreLib::RegistrationTools::SKIP_RYZ) 40 | .value("SKIP_RXZ", CCCoreLib::RegistrationTools::SKIP_RXZ) 41 | .value("SKIP_ROTATION", CCCoreLib::RegistrationTools::SKIP_ROTATION) 42 | .value("SKIP_TX", CCCoreLib::RegistrationTools::SKIP_TX) 43 | .value("SKIP_TY", CCCoreLib::RegistrationTools::SKIP_TY) 44 | .value("SKIP_TZ", CCCoreLib::RegistrationTools::SKIP_TZ) 45 | .value("SKIP_TRANSLATION", CCCoreLib::RegistrationTools::SKIP_TRANSLATION) 46 | .export_values(); 47 | 48 | py::class_(m0, "ICPRegistrationTools") 49 | ; 50 | 51 | py::enum_(m0, "CONVERGENCE_TYPE") 52 | .value("MAX_ERROR_CONVERGENCE", CCCoreLib::ICPRegistrationTools::MAX_ERROR_CONVERGENCE) 53 | .value("MAX_ITER_CONVERGENCE", CCCoreLib::ICPRegistrationTools::MAX_ITER_CONVERGENCE) 54 | .export_values(); 55 | 56 | } 57 | -------------------------------------------------------------------------------- /pybind11/registrationToolsPy.hpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CloudComPy # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; either version 3 of the License, or # 8 | //# any later version. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# You should have received a copy of the GNU General Public License # 16 | //# along with this program. If not, see . # 17 | //# # 18 | //# Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | //# # 20 | //########################################################################## 21 | 22 | #ifndef REGISTRATIONTOOLSPY_HPP_ 23 | #define REGISTRATIONTOOLSPY_HPP_ 24 | 25 | void export_registrationTools(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /sphinxDoc/CSF.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | CSF plugin 4 | ============================= 5 | 6 | .. automodule:: cloudComPy.CSF 7 | 8 | .. autofunction:: computeCSF 9 | 10 | .. autofunction:: initTrace_CSF 11 | -------------------------------------------------------------------------------- /sphinxDoc/Canupo.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | Canupo plugin 4 | ============================= 5 | 6 | .. automodule:: cloudComPy.Canupo 7 | 8 | .. autofunction:: Classify 9 | 10 | .. autoclass:: CORE_CLOUD_SOURCES 11 | -------------------------------------------------------------------------------- /sphinxDoc/DistanceComputationTools.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | Distance Computation Tools 4 | ============================= 5 | 6 | .. py:module:: cloudComPy 7 | :no-index: 8 | 9 | ----------------------------- 10 | Distance computation 11 | ----------------------------- 12 | 13 | .. autoclass:: DistanceComputationTools 14 | :members: 15 | :inherited-members: 16 | :show-inheritance: 17 | 18 | ------------------------------- 19 | Distance computation parameters 20 | ------------------------------- 21 | 22 | .. autoclass:: Cloud2CloudDistancesComputationParams 23 | :members: 24 | :inherited-members: 25 | :show-inheritance: 26 | 27 | .. autoclass:: Cloud2MeshDistancesComputationParams 28 | :members: 29 | :inherited-members: 30 | :show-inheritance: 31 | -------------------------------------------------------------------------------- /sphinxDoc/GeometricalAnalysisTools.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | Geometrical Analysis Tools 4 | ============================= 5 | 6 | .. py:module:: cloudComPy 7 | :no-index: 8 | 9 | ----------------------------- 10 | Geometrical Analysis 11 | ----------------------------- 12 | 13 | .. autoclass:: GeometricalAnalysisTools 14 | :members: 15 | :inherited-members: 16 | :show-inheritance: 17 | 18 | .. autoclass:: Density 19 | :members: 20 | :undoc-members: 21 | 22 | .. autoclass:: ErrorCode 23 | :members: 24 | :undoc-members: 25 | -------------------------------------------------------------------------------- /sphinxDoc/HPR.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | HPR plugin 4 | ============================= 5 | 6 | .. automodule:: cloudComPy.HPR 7 | 8 | .. autofunction:: computeHPR 9 | 10 | .. autofunction:: initTrace_HPR 11 | -------------------------------------------------------------------------------- /sphinxDoc/M3C2.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | M3C2 plugin 4 | ============================= 5 | 6 | .. automodule:: cloudComPy.M3C2 7 | 8 | .. autofunction:: computeM3C2 9 | 10 | .. autofunction:: initTrace_M3C2 11 | 12 | .. autofunction:: M3C2guessParamsToFile 13 | -------------------------------------------------------------------------------- /sphinxDoc/MeshBoolean.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | MeshBoolean plugin 4 | ============================= 5 | 6 | .. automodule:: cloudComPy.MeshBoolean 7 | 8 | .. autoclass:: CSG_OPERATION 9 | :members: 10 | :undoc-members: 11 | 12 | .. autofunction:: computeMeshBoolean 13 | 14 | .. autofunction:: initTrace_MeshBoolean 15 | -------------------------------------------------------------------------------- /sphinxDoc/MinimalBoundingBox.rst: -------------------------------------------------------------------------------- 1 | 2 | ================================ 3 | minimalBoundingBox Python plugin 4 | ================================ 5 | 6 | ``minmimalBoundingBox`` is a pure Python plugin built with CloudComPy. 7 | 8 | This tool is provided as an example of CloudComPy pure Python extension. 9 | 10 | The ``findRotation`` function finds a minimal bounding box, not oriented along the main axes, 11 | and the corresponding rotation. 12 | It is not proven that the solution meets to the minimum, and the performance and robustness 13 | can certainly be improved. 14 | 15 | .. autofunction:: cloudComPy.minimalBoundingBox.dist2 16 | 17 | .. autofunction:: cloudComPy.minimalBoundingBox.findRotation 18 | 19 | .. autofunction:: cloudComPy.minimalBoundingBox.isocahedron 20 | 21 | .. autofunction:: cloudComPy.minimalBoundingBox.section 22 | 23 | .. autofunction:: cloudComPy.minimalBoundingBox.zinv 24 | -------------------------------------------------------------------------------- /sphinxDoc/Neighbourhood.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | Neighbourhood 4 | ============================= 5 | 6 | .. py:module:: cloudComPy 7 | :no-index: 8 | 9 | ----------------------------- 10 | Neighbourhood 11 | ----------------------------- 12 | 13 | .. autoclass:: GeomFeature 14 | :members: 15 | :undoc-members: 16 | -------------------------------------------------------------------------------- /sphinxDoc/PCL.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | PCL plugin 4 | ============================= 5 | 6 | .. automodule:: cloudComPy.PCL 7 | 8 | .. autoclass:: FastGlobalRegistrationFilter 9 | :members: 10 | :undoc-members: 11 | 12 | .. autoclass:: NormalEstimation 13 | :members: 14 | :undoc-members: 15 | 16 | .. autoclass:: MLSSmoothingUpsampling 17 | :members: 18 | :undoc-members: 19 | 20 | .. autofunction:: initTrace_PCL 21 | -------------------------------------------------------------------------------- /sphinxDoc/PCV.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | PCV plugin 4 | ============================= 5 | 6 | .. automodule:: cloudComPy.PCV 7 | 8 | .. autofunction:: computeShadeVIS 9 | 10 | .. autofunction:: initTrace_PCV 11 | -------------------------------------------------------------------------------- /sphinxDoc/PoissonRecon.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | PoissonRecon plugin 4 | ============================= 5 | 6 | .. automodule:: cloudComPy.PoissonRecon 7 | 8 | .. autoclass:: PR 9 | :members: 10 | :undoc-members: 11 | 12 | .. autoclass:: BoundaryType 13 | 14 | .. autofunction:: initTrace_PoissonRecon 15 | -------------------------------------------------------------------------------- /sphinxDoc/RANSAC_SD.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | RANSAC_SD plugin 4 | ============================= 5 | 6 | .. automodule:: cloudComPy.RANSAC_SD 7 | 8 | .. autoclass:: RansacParams 9 | :members: 10 | :undoc-members: 11 | 12 | .. autofunction:: computeRANSAC_SD 13 | 14 | .. autofunction:: initTrace_RANSAC_SD 15 | -------------------------------------------------------------------------------- /sphinxDoc/SRA.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | SRA plugin 4 | ============================= 5 | 6 | .. automodule:: cloudComPy.SRA 7 | 8 | .. autoclass:: qSRA 9 | :members: 10 | :undoc-members: 11 | 12 | .. autofunction:: loadProfile 13 | 14 | .. autofunction:: exportMapAsCloud 15 | 16 | .. autofunction:: exportMapAsMesh 17 | 18 | .. autofunction:: initTrace_SRA 19 | 20 | .. autoclass:: FillStrategyType 21 | :members: 22 | :undoc-members: 23 | 24 | .. autoclass:: EmptyCellFillOption 25 | :members: 26 | :undoc-members: 27 | -------------------------------------------------------------------------------- /sphinxDoc/ScalarField.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | Scalar Fields 4 | ============================= 5 | 6 | .. py:module:: cloudComPy 7 | :no-index: 8 | 9 | ---------------------------- 10 | ccScalarField 11 | ---------------------------- 12 | 13 | All the inherited members are given here for convenience. 14 | Most of the time, this class is used rather than the bases classes. 15 | 16 | .. autoclass:: ccScalarField 17 | :members: 18 | :inherited-members: 19 | :show-inheritance: 20 | 21 | ------------------------------- 22 | bases classes for ccScalarField 23 | ------------------------------- 24 | 25 | .. autoclass:: ScalarField 26 | :members: 27 | :inherited-members: 28 | :show-inheritance: 29 | 30 | ------------------------------- 31 | color scales for scalar fields 32 | ------------------------------- 33 | 34 | .. autoclass:: ccColorScale 35 | :members: 36 | :inherited-members: 37 | :show-inheritance: 38 | 39 | .. autoclass:: ccColorScalesManager 40 | :members: 41 | :inherited-members: 42 | :show-inheritance: 43 | 44 | .. autoclass:: DEFAULT_SCALES 45 | :members: 46 | :undoc-members: 47 | 48 | -------------------------------------------------------------------------------- /sphinxDoc/ccFacet.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | 2D Polygons 4 | ============================= 5 | 6 | .. py:module:: cloudComPy 7 | :no-index: 8 | 9 | ---------------------------- 10 | ccFacets 11 | ---------------------------- 12 | 13 | .. autoclass:: ccFacet 14 | :members: 15 | :inherited-members: 16 | :show-inheritance: 17 | 18 | -------------------------------------------------------------------------------- /sphinxDoc/ccMesh.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | Meshes 4 | ============================= 5 | 6 | .. py:module:: cloudComPy 7 | :no-index: 8 | 9 | ---------------------------- 10 | ccMesh 11 | ---------------------------- 12 | 13 | All the inherited members are given here for convenience. 14 | Most of the time, this class is used rather than the bases classes. 15 | 16 | .. autoclass:: ccMesh 17 | :members: 18 | :inherited-members: 19 | :show-inheritance: 20 | 21 | ---------------------------- 22 | bases classes for Meshes 23 | ---------------------------- 24 | 25 | .. autoclass:: ccGenericMesh 26 | :members: 27 | :inherited-members: 28 | :show-inheritance: 29 | 30 | .. autoclass:: GenericIndexedMesh 31 | :members: 32 | :inherited-members: 33 | :show-inheritance: 34 | 35 | .. autoclass:: TRIANGULATION_TYPES 36 | :members: 37 | :undoc-members: 38 | 39 | .. autoclass:: EdgeConnectivityStats 40 | :members: 41 | 42 | -------------------------------------------------------------------------------- /sphinxDoc/ccOctree.rst: -------------------------------------------------------------------------------- 1 | 2 | ====================================== 3 | Octrees, descriptors and neighbourhood 4 | ====================================== 5 | 6 | .. py:module:: cloudComPy 7 | :no-index: 8 | 9 | ----------------------- 10 | Octrees 11 | ----------------------- 12 | 13 | .. autoclass:: DgmOctree 14 | :members: 15 | :inherited-members: 16 | :show-inheritance: 17 | 18 | ----------------------- 19 | Descriptors structures 20 | ----------------------- 21 | 22 | .. autoclass:: PointDescriptor 23 | :members: 24 | 25 | .. autoclass:: CellDescriptor 26 | :members: 27 | 28 | .. autoclass:: IndexAndCode 29 | :members: 30 | 31 | ------------------------ 32 | Neighbourhood structures 33 | ------------------------ 34 | 35 | .. autoclass:: CylindricalNeighbourhood 36 | :members: 37 | 38 | .. autoclass:: ProgressiveCylindricalNeighbourhood 39 | :show-inheritance: 40 | :members: 41 | 42 | .. autoclass:: BoxNeighbourhood 43 | :members: 44 | 45 | .. autoclass:: NearestNeighboursSearchStruct 46 | :members: 47 | 48 | -------------------------------------------------------------------------------- /sphinxDoc/ccPointCloud.rst: -------------------------------------------------------------------------------- 1 | 2 | 3 | ============================= 4 | Points Clouds 5 | ============================= 6 | 7 | .. py:module:: cloudComPy 8 | :no-index: 9 | 10 | ---------------------------- 11 | ccPointCloud 12 | ---------------------------- 13 | 14 | All the inherited members are given here for convenience. 15 | Most of the time, this class is used rather than the bases classes. 16 | 17 | .. autoclass:: ccPointCloud 18 | :members: 19 | :inherited-members: 20 | :show-inheritance: 21 | 22 | ------------------------------- 23 | bases classes for Points Clouds 24 | ------------------------------- 25 | 26 | The generic class :py:class:`ccHObject` is used when manipulating a list of points clouds and meshes, 27 | for instance to save the list of objects on a file. 28 | 29 | .. autoclass:: PointCloudTpl_ccGenericPointCloud_QString 30 | :members: 31 | :show-inheritance: 32 | 33 | .. autoclass:: ccGenericPointCloud 34 | :members: 35 | :show-inheritance: 36 | 37 | .. autoclass:: ReferenceCloud 38 | :members: 39 | :show-inheritance: 40 | 41 | .. autoclass:: GenericIndexedCloudPersist 42 | :members: 43 | :show-inheritance: 44 | 45 | .. autoclass:: ccShiftedObject 46 | :members: 47 | :show-inheritance: 48 | 49 | .. autoclass:: ccHObject 50 | :members: 51 | :show-inheritance: 52 | 53 | .. autoclass:: DEPENDENCY_FLAGS 54 | :members: 55 | :undoc-members: 56 | 57 | .. autoclass:: CLONE_WARNINGS 58 | :members: 59 | :undoc-members: 60 | 61 | -------------------------------------------------------------------------------- /sphinxDoc/ccPolyline.rst: -------------------------------------------------------------------------------- 1 | 2 | 3 | ============================= 4 | Polylines 5 | ============================= 6 | 7 | 8 | .. py:module:: cloudComPy 9 | :no-index: 10 | 11 | ------------------------------- 12 | ccPolyline 13 | ------------------------------- 14 | 15 | All the inherited members are given here for convenience. 16 | Most of the time, this class is used rather than the bases classes. 17 | 18 | .. autoclass:: ccPolyline 19 | :members: 20 | :inherited-members: 21 | :show-inheritance: 22 | 23 | ------------------------------- 24 | bases classes for ccPolyline 25 | ------------------------------- 26 | 27 | .. autoclass:: Polyline 28 | :members: 29 | :show-inheritance: 30 | -------------------------------------------------------------------------------- /sphinxDoc/ccPrimitives.rst: -------------------------------------------------------------------------------- 1 | 2 | 3 | ============================= 4 | ccPrimitives 5 | ============================= 6 | 7 | .. py:module:: cloudComPy 8 | :no-index: 9 | 10 | Primitives regroups all the geometric generators provided by CloudCompare: 11 | :py:class:`ccBox`, :py:class:`ccCone`, :py:class:`ccCylinder`, :py:class:`ccPlane`, 12 | :py:class:`ccQuadric`, :py:class:`ccSphere`, :py:class:`ccTorus`, :py:class:`ccDish`. 13 | 14 | The primitives are derived from a generic primitive :py:class:`ccGenericPrimitive`. 15 | 16 | Rotation Translation matrix can be applied at construction time or after. 17 | 18 | ---------------------------- 19 | Box 20 | ---------------------------- 21 | 22 | .. autoclass:: ccBox 23 | :members: 24 | :show-inheritance: 25 | 26 | ---------------------------- 27 | Cone 28 | ---------------------------- 29 | 30 | .. autoclass:: ccCone 31 | :members: 32 | :show-inheritance: 33 | 34 | ---------------------------- 35 | Cylinder 36 | ---------------------------- 37 | 38 | .. autoclass:: ccCylinder 39 | :members: 40 | :show-inheritance: 41 | 42 | ---------------------------- 43 | Plane 44 | ---------------------------- 45 | 46 | .. autoclass:: ccPlane 47 | :members: 48 | :show-inheritance: 49 | 50 | ---------------------------- 51 | Quadric 52 | ---------------------------- 53 | 54 | .. autoclass:: ccQuadric 55 | :members: 56 | :show-inheritance: 57 | 58 | ---------------------------- 59 | Sphere 60 | ---------------------------- 61 | 62 | .. autoclass:: ccSphere 63 | :members: 64 | :show-inheritance: 65 | 66 | ---------------------------- 67 | Torus 68 | ---------------------------- 69 | 70 | .. autoclass:: ccTorus 71 | :members: 72 | :show-inheritance: 73 | 74 | ---------------------------- 75 | Dish 76 | ---------------------------- 77 | 78 | .. autoclass:: ccDish 79 | :members: 80 | :show-inheritance: 81 | 82 | ---------------------------- 83 | Generic primitive 84 | ---------------------------- 85 | 86 | .. autoclass:: ccGenericPrimitive 87 | :members: 88 | :inherited-members: 89 | :show-inheritance: 90 | 91 | ============================= 92 | transformations 93 | ============================= 94 | 95 | ---------------------------- 96 | Rotation Translation Matrix 97 | ---------------------------- 98 | 99 | .. autoclass:: ccGLMatrix 100 | :special-members: __init__ 101 | :inherited-members: 102 | :members: 103 | :show-inheritance: 104 | 105 | .. autoclass:: ccGLMatrixd 106 | :special-members: __init__ 107 | :inherited-members: 108 | :members: 109 | :show-inheritance: 110 | 111 | .. autoclass:: ccGLMatrixParams1_float 112 | :members: 113 | :inherited-members: 114 | :show-inheritance: 115 | 116 | .. autoclass:: ccGLMatrixParams2_float 117 | :members: 118 | :inherited-members: 119 | :show-inheritance: 120 | 121 | .. autoclass:: ccGLMatrixParams1_double 122 | :members: 123 | :inherited-members: 124 | :show-inheritance: 125 | 126 | .. autoclass:: ccGLMatrixParams2_double 127 | :members: 128 | :inherited-members: 129 | :show-inheritance: 130 | 131 | -------------------------------------------------------------------------------- /sphinxDoc/ccSensor.rst: -------------------------------------------------------------------------------- 1 | 2 | 3 | ============================= 4 | Sensor 5 | ============================= 6 | 7 | 8 | .. py:module:: cloudComPy 9 | :no-index: 10 | 11 | ------------------------------- 12 | ccGBLSensor 13 | ------------------------------- 14 | 15 | .. autoclass:: ccGBLSensor 16 | :members: 17 | :show-inheritance: 18 | 19 | .. autoclass:: ROTATION_ORDER 20 | :members: 21 | :undoc-members: 22 | 23 | ------------------------------- 24 | ccSensor 25 | ------------------------------- 26 | 27 | .. autoclass:: ccSensor 28 | :members: 29 | :show-inheritance: 30 | 31 | .. autoclass:: CC_SENSOR_TYPE 32 | :members: 33 | :undoc-members: 34 | -------------------------------------------------------------------------------- /sphinxDoc/cloudSamplingTools.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | Cloud Sampling Tools 4 | ============================= 5 | 6 | .. py:module:: cloudComPy 7 | :no-index: 8 | 9 | ----------------------------- 10 | cloud sampling 11 | ----------------------------- 12 | 13 | .. autoclass:: CloudSamplingTools 14 | :members: 15 | :inherited-members: 16 | :show-inheritance: 17 | 18 | ----------------------------- 19 | cloud sampling parameters 20 | ----------------------------- 21 | 22 | .. autoclass:: SFModulationParams 23 | :members: 24 | :inherited-members: 25 | :show-inheritance: 26 | 27 | .. autoclass:: RESAMPLING_CELL_METHOD 28 | :members: 29 | :undoc-members: 30 | 31 | .. autoclass:: SUBSAMPLING_CELL_METHOD 32 | :members: 33 | :undoc-members: 34 | -------------------------------------------------------------------------------- /sphinxDoc/colors.rst: -------------------------------------------------------------------------------- 1 | 2 | 3 | ============================= 4 | Colors 5 | ============================= 6 | 7 | .. py:module:: cloudComPy 8 | :no-index: 9 | 10 | Color classes are useful for the functions related to color in :py:class:`ccPointCloud` class. 11 | 12 | ---------------------------- 13 | QColor (from Qt) 14 | ---------------------------- 15 | 16 | The QColor class is the binding of the Qcolor class from Qt. 17 | 18 | .. autoclass:: QColor 19 | :members: 20 | :undoc-members: 21 | :inherited-members: 22 | :show-inheritance: 23 | 24 | ------------------------------------ 25 | Other Useful Color classes (from Qt) 26 | ------------------------------------ 27 | 28 | The QRgba64 class from Qt provide a 64bit data structure to manipulate 16-bit color channels: Red, green, blue and alpha. 29 | 30 | .. autoclass:: QRgba64 31 | :members: 32 | :undoc-members: 33 | :show-inheritance: 34 | 35 | 36 | .. autoclass:: QColorSpec 37 | :members: 38 | :undoc-members: 39 | -------------------------------------------------------------------------------- /sphinxDoc/genSphinxDoc.sh.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export LD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib/cloudcompare/plugins:@CMAKE_INSTALL_PREFIX@/lib/cloudcompare:${LD_LIBRARY_PATH} 4 | rm @SPHINXDOCTREES@/*.doctree 5 | @SPHINXBUILD@ -c @CMAKE_BINARY_DIR@/sphinxDoc -b html -d @SPHINXDOCTREES@ @ALLSPHINXOPTS@ @CMAKE_INSTALL_PREFIX@/doc/html 6 | -------------------------------------------------------------------------------- /sphinxDoc/genSphinxDocConda.sh.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . @CMAKE_INSTALL_PREFIX@/bin/condaCloud.sh activate CloudComPy310 4 | rm @SPHINXDOCTREES@/*.doctree 5 | @SPHINXBUILD@ -c @CMAKE_BINARY_DIR@/sphinxDoc -b html -d @SPHINXDOCTREES@ @ALLSPHINXOPTS@ @CMAKE_INSTALL_PREFIX@/doc/html 6 | -------------------------------------------------------------------------------- /sphinxDoc/genSphinxDocMacOSConda.zsh.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | source @CMAKE_INSTALL_PREFIX@/bin/condaCloud.zsh activate CloudComPy310 4 | rm @SPHINXDOCTREES@/*.doctree 5 | @SPHINXBUILD@ -c @CMAKE_BINARY_DIR@/sphinxDoc -v -a -b html -d @SPHINXDOCTREES@ @ALLSPHINXOPTS@ @CMAKE_INSTALL_PREFIX@/doc/html 6 | -------------------------------------------------------------------------------- /sphinxDoc/genSphinxDocWindows.bat.in: -------------------------------------------------------------------------------- 1 | 2 | call @CONDA_BASE_DIRECTORY@\Scripts\activate.bat @CONDA_BASE_DIRECTORY@ 3 | call conda activate CloudComPy310 4 | call @CMAKE_INSTALL_PREFIX@\envCloudComPy.bat 5 | del @SPHINXDOCTREES@\*.doctree 6 | @SPHINXBUILD@ -c @CMAKE_BINARY_DIR@/sphinxDoc -b html -d @SPHINXDOCTREES@ @ALLSPHINXOPTS@ @CMAKE_INSTALL_PREFIX@\doc\html 7 | -------------------------------------------------------------------------------- /sphinxDoc/index.rst: -------------------------------------------------------------------------------- 1 | 2 | 3 | cloudComPy: a Python interface for CloudCompare 4 | ############################################### 5 | 6 | .. toctree:: 7 | :numbered: 8 | :maxdepth: 3 9 | :caption: Introduction 10 | 11 | introduction.rst 12 | license.rst 13 | 14 | .. toctree:: 15 | :numbered: 16 | :maxdepth: 3 17 | :caption: cloudComPy User Manual: basics 18 | 19 | userIntro.rst 20 | userLoad.rst 21 | userSave.rst 22 | userEntities.rst 23 | userNumpy.rst 24 | 25 | .. toctree:: 26 | :numbered: 27 | :maxdepth: 3 28 | :caption: Some use cases 29 | 30 | userUseCases.rst 31 | 32 | .. toctree:: 33 | :numbered: 34 | :maxdepth: 3 35 | :caption: cloudComPy Reference documentation 36 | 37 | cloudComPy.rst 38 | ccPointCloud.rst 39 | ccPolyline.rst 40 | ccOctree.rst 41 | ccMesh.rst 42 | ccPrimitives.rst 43 | ccSensor.rst 44 | ScalarField.rst 45 | DistanceComputationTools.rst 46 | GeometricalAnalysisTools.rst 47 | cloudSamplingTools.rst 48 | ccFacet.rst 49 | Neighbourhood.rst 50 | colors.rst 51 | 52 | .. toctree:: 53 | :numbered: 54 | :maxdepth: 3 55 | :caption: plugins Reference documentation 56 | 57 | Canupo.rst 58 | CSF.rst 59 | HPR.rst 60 | M3C2.rst 61 | MeshBoolean.rst 62 | PCL.rst 63 | PCV.rst 64 | PoissonRecon.rst 65 | RANSAC_SD.rst 66 | SRA.rst 67 | MinimalBoundingBox.rst 68 | 69 | .. toctree:: 70 | :numbered: 71 | :maxdepth: 3 72 | :caption: Indices and tables 73 | 74 | tables.rst -------------------------------------------------------------------------------- /sphinxDoc/introduction.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | cloudComPy: a first example 4 | ============================= 5 | 6 | This project proposes a Python module to interface to `CloudCompare `_, 7 | of equivalent level to the command mode of CloudCompare. 8 | 9 | `CloudComPy `_ does not yet cover all the features of CloudCompare. 10 | Features are added according to the needs reported by users, 11 | feel free to post issues in `GitHub `_ 12 | or `GitLab `_. 13 | 14 | Here is an example of a Python script: 15 | :: 16 | 17 | os.environ["_CCTRACE_"]="ON" # only if you want debug traces from C++ 18 | 19 | import cloudComPy as cc # import the CloudComPy module 20 | 21 | cloud = cc.loadPointCloud("myCloud.xyz") # read a point cloud from a file 22 | print("cloud name: %s"%cloud.getName()) 23 | 24 | res=cc.computeCurvature(cc.CurvatureType.GAUSSIAN_CURV, 0.05, [cloud]) # compute curvature as a scalar field 25 | nsf = cloud.getNumberOfScalarFields() 26 | sfCurv=cloud.getScalarField(nsf-1) 27 | cloud.setCurrentOutScalarField(nsf-1) 28 | filteredCloud=cc.filterBySFValue(0.01, sfCurv.getMax(), cloud) # keep only the points above a given curvature 29 | 30 | ok = filteredCloud.exportCoordToSF(False, False, True) # Z coordinate as a scalar Field 31 | nsf = cloud.getNumberOfScalarFields() 32 | sf1=filteredCloud.getScalarField(nsf-1) 33 | mean, var = sf1.computeMeanAndVariance() 34 | 35 | # using Numpy... 36 | 37 | coordinates = filteredCloud.toNpArrayCopy() # coordinates as a numpy array 38 | x=coordinates[:,0] # x column 39 | y=coordinates[:,1] 40 | z=coordinates[:,2] 41 | 42 | f=(2*x-y)*(x+3*y) # elementwise operation on arrays 43 | 44 | asf1=sf1.toNpArray() # scalar field as a numpy array 45 | sf1.fromNpArrayCopy(f) # replace scalar field values by a numpy array 46 | 47 | res=cc.SavePointCloud(filteredCloud,"myModifiedCloud.bin") #save the point cloud to a file 48 | 49 | 50 | As you can see, it is possible to read and write point clouds, 51 | access scalar fields from Numpy (with or without copy of data), call some CloudCompare functions to transform point clouds. 52 | 53 | From the Python interpreter, Docstrings provide some documentation on the available methods, the arguments. 54 | -------------------------------------------------------------------------------- /sphinxDoc/license.rst: -------------------------------------------------------------------------------- 1 | ============================= 2 | license 3 | ============================= 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | Copyright 2020-2021 Paul RASCLE www.openfields.fr 19 | 20 | When the CloudCompare FBX Plugin is installed: 21 | This software contains Autodesk® FBX® code developed by Autodesk, Inc. 22 | Copyright 2019 Autodesk, Inc. All rights, reserved. 23 | Such code is provided “as is” and Autodesk, Inc. disclaims any and all warranties, 24 | whether express or implied, including without limitation the implied warranties 25 | of merchantability, fitness for a particular purpose or non-infringement of 26 | third party rights. In no event shall Autodesk, Inc. be liable for any direct, 27 | indirect, incidental, special, exemplary, or consequential damages (including, 28 | but not limited to, procurement of substitute goods or services; loss of use, 29 | data, or profits; or business interruption) however caused and on any theory of 30 | liability, whether in contract, strict liability, or tort (including negligence 31 | or otherwise) arising in any way out of such code. 32 | -------------------------------------------------------------------------------- /sphinxDoc/postInstall.cmake: -------------------------------------------------------------------------------- 1 | ########################################################################## 2 | # # 3 | # CloudComPy # 4 | # # 5 | # This program is free software; you can redistribute it and/or modify # 6 | # it under the terms of the GNU General Public License as published by # 7 | # the Free Software Foundation; either version 3 of the License, or # 8 | # any later version. # 9 | # # 10 | # This program is distributed in the hope that it will be useful, # 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | # GNU General Public License for more details. # 14 | # # 15 | # You should have received a copy of the GNU General Public License # 16 | # along with this program. If not, see . # 17 | # # 18 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | # # 20 | ########################################################################## 21 | 22 | message( STATUS "post install process ...") 23 | if (WIN32) 24 | message( STATUS "generate documentation ...") 25 | execute_process( COMMAND sphinxDoc\genSphinxDoc.bat ) 26 | elseif( APPLE ) 27 | execute_process( COMMAND pwd ) 28 | message( STATUS "add libraries to bundle ...") 29 | execute_process( COMMAND python sphinxDoc/libBundleCloudComPy.py ) 30 | message( STATUS "signature ...") 31 | execute_process( COMMAND bash sphinxDoc/signatureCloudComPy.sh ) 32 | message( STATUS "generate documentation ...") 33 | execute_process( COMMAND chmod +x sphinxDoc/genSphinxDoc.zsh ) 34 | execute_process( COMMAND zsh sphinxDoc/genSphinxDoc.zsh ERROR_QUIET ) 35 | else() 36 | execute_process( COMMAND pwd ) 37 | message( STATUS "generate documentation ...") 38 | execute_process( COMMAND bash sphinxDoc/genSphinxDoc.sh ) 39 | endif() 40 | message( STATUS "... Done") 41 | 42 | -------------------------------------------------------------------------------- /sphinxDoc/signatureCloudComPy.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Fail if any command fails. 3 | set -e 4 | # 5 | ARCHIVE="@CMAKE_INSTALL_PREFIX@" 6 | # Establish a work directory, create a disk image root directory within 7 | # that, and then copy the app there. 8 | # 9 | # Note we use `-R`, not `-r`, to preserve symlinks. 10 | #WORKDIR="CloudComPy-`date '+%Y-%m-%d_%H.%M.%S'`" 11 | WORKDIR="${ARCHIVE}" 12 | APP="${WORKDIR}/CloudCompare/CloudCompare.app" 13 | DMG="${WORKDIR}/../CloudComPy.dmg" 14 | SIGNATURE="5XUC29Y5KK" 15 | #cp -R "${ARCHIVE}" "${WORKDIR}" 16 | #mv "${ARCHIVE}" "${ARCHIVE}_moved" 17 | # Create various entitlement files from 'here' documents. 18 | cat > "${WORKDIR}/app.entitlements" < 20 | 21 | 22 | 23 | com.apple.security.app-sandbox 24 | 25 | com.apple.security.files.user-selected.read-write 26 | 27 | com.apple.security.network.server 28 | 29 | 30 | 31 | EOF 32 | cat > "${WORKDIR}/tool.entitlements" < 34 | 35 | 36 | 37 | com.apple.security.app-sandbox 38 | 39 | com.apple.security.inherit 40 | 41 | 42 | 43 | EOF 44 | # Sign the app from the inside out. 45 | # 46 | echo "--- signature dylib ---" 47 | find "${APP}" -name "*.dylib" -print -exec codesign -s ${SIGNATURE} -f --timestamp {} \; 48 | find "${APP}" -name "*.so" -print -exec codesign -s ${SIGNATURE} -f --timestamp -i fr.openfields.CloudComPy -o runtime --entitlements "${WORKDIR}/app.entitlements" {} \; 49 | 50 | echo "--- signature app---" 51 | codesign -s ${SIGNATURE} -f --timestamp -i fr.openfields.CloudComPy -o runtime --entitlements "${WORKDIR}/app.entitlements" "${APP}" 52 | # Create a disk image from our disk image root directory. 53 | hdiutil create -ov -srcFolder "${WORKDIR}" -quiet -o "${DMG}" 54 | # Sign that. 55 | codesign -s ${SIGNATURE} --timestamp -i fr.openfields.CloudComPy.DiskImage "${DMG}" 56 | echo "${DMG}" -------------------------------------------------------------------------------- /sphinxDoc/tables.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================= 3 | general index 4 | ============================= 5 | 6 | * :ref:`genindex` 7 | 8 | ============================= 9 | module index 10 | ============================= 11 | * :ref:`modindex` 12 | -------------------------------------------------------------------------------- /sphinxDoc/userIntro.rst: -------------------------------------------------------------------------------- 1 | 2 | ============================ 3 | Introduction 4 | ============================ 5 | 6 | ------------------------------ 7 | Set the CloudComPy environment 8 | ------------------------------ 9 | 10 | Before importing CloudComPy, you need to configure and load the required environment, 11 | mainly the PATH and PYTHONPATH used by the different executables, library and Python modules. 12 | 13 | You should read the installation instructions in your CloudComPy installation, in the doc directory, 14 | or on `GitHub `_. 15 | or on `GitLab `_. 16 | 17 | Here, we suppose you are using a CloudComPy installation built on top of the Conda Packages. 18 | 19 | Windows 20 | ~~~~~~~ 21 | 22 | The Windows Conda packaging provides a batch file to call after loading the conda environment, from the conda prompt: 23 | :: 24 | 25 | cd \CloudComPy310 26 | conda activate CloudComPy310 27 | envCloudComPy.bat 28 | 29 | 30 | Linux 31 | ~~~~~ 32 | 33 | The LinuxConda packaging provides a shell script: 34 | :: 35 | 36 | cd /CloudComPy310 37 | . bin/condaCloud.sh activate CloudComPy310 38 | 39 | macOS 40 | ~~~~~ 41 | 42 | If you use a conda environment, the shell script is similar to the Linux script: 43 | :: 44 | 45 | cd /CloudComPy310 46 | . bin/condaCloud.zsh activate CloudComPy310 47 | 48 | 49 | -------------------------- 50 | Python3: CloudComPy import 51 | -------------------------- 52 | 53 | The starting sequence is: 54 | :: 55 | 56 | import os 57 | os.environ["_CCTRACE_"]="ON" # only if you want debug traces from C++ 58 | import cloudComPy as cc # import the CloudComPy module 59 | 60 | It is no longer necessary to call ``initCC`` to discover all the CloudCompare plugins, this is done automatically at import. 61 | :: 62 | 63 | cc.initCC() # done automatically at import, before using plugins 64 | -------------------------------------------------------------------------------- /sphinxDoc/userSave.rst: -------------------------------------------------------------------------------- 1 | 2 | ========================================= 3 | Saving Clouds and other entities to files 4 | ========================================= 5 | 6 | .. _save_formats: 7 | 8 | Known formats 9 | ------------- 10 | 11 | CloudComPy can write a lot of formats of point clouds and meshes. 12 | The ``.bin`` binary format is the native format of CloudCompare and can store several entities of all types. 13 | Take a look at the details of the formats supported by CloudCompare on `wiki `_. 14 | 15 | For clouds, the extensions known by CloudComPy are: 16 | ``.asc`` ``.bin`` ``.drc`` ``.dxf`` ``.E57`` ``.las`` ``.laz`` ``.pcd`` ``.ply`` ``.pv`` ``.sbf`` ``.shp`` ``.vtk`` ``.xyz`` 17 | 18 | For meshes: 19 | ``.dxf`` ``.bin`` ``.fbx`` ``.obj`` ``.off`` ``.ply`` ``.stl`` ``.vtk`` 20 | 21 | For polylines: 22 | ``.dxf`` ``.poly`` ``.sx`` ``.shp`` 23 | 24 | See :download:`test020.py <../tests/test020.py>` for an example. 25 | 26 | Saving a Point Cloud 27 | -------------------- 28 | 29 | For most formats, the only parameters of :py:func:`cloudComPy.SavePointCloud` are the cloud and the filename 30 | (CloudComPy does not offer yet all the flexibility of CloudCompare). 31 | The format is defined by the filename extension. 32 | Return code is 0 in case of success: 33 | :: 34 | 35 | ret = cc.SavePointCloud(cloud, "CloudComPy/Data/dataSample.bin") 36 | 37 | 38 | The formats ``.las`` and ``.laz`` (las compressed) offers an optional parameter: `version="1.4"` 39 | to change from the default version. 40 | :: 41 | 42 | ret = cc.SavePointCloud(cloud, "CloudComPy/Data/dataSample.laz") 43 | ret = cc.SavePointCloud(cloud, "CloudComPy/Data/dataSample_v14.laz", version="1.4") 44 | 45 | Saving a mesh 46 | ------------- 47 | 48 | For all formats, the only parameters of :py:func:`cloudComPy.SaveMesh` are the mesh and the filename. 49 | (CloudComPy does not offer yet all the flexibility of CloudCompare). 50 | The format is defined by the filename extension. 51 | Return code is 0 in case of success. 52 | :: 53 | 54 | ret = cc.SaveMesh(mesh, "CloudComPy/Data/mesh.stl") 55 | 56 | 57 | Saving several entities in one file 58 | ----------------------------------- 59 | 60 | All the entities to save (clouds, meshes, polylines...) must be put in a list. 61 | the :py:func:`cloudComPy.SaveEntities` function return code is 0 in case of success. 62 | :: 63 | 64 | ret = cc.SaveEntities([cloud, cloud1, cloud2, mesh, poly], "CloudComPy/Data/mixedEntities.bin") 65 | -------------------------------------------------------------------------------- /tests/envPyCC.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @set SCRIPT_DIR=%~dp0 3 | @set CLOUDCOMPY_ROOT=%SCRIPT_DIR%..\.. 4 | @set PYTHONPATH=%CLOUDCOMPY_ROOT%\CloudCompare;%PYTHONPATH% 5 | @set PYTHONPATH=%SCRIPT_DIR%;%PYTHONPATH% 6 | @set PATH=%CLOUDCOMPY_ROOT%\CloudCompare;%CLOUDCOMPY_ROOT%\ccViewer;%SCRIPT_DIR%;%PATH% 7 | @set PATH=%CLOUDCOMPY_ROOT%\CloudCompare\plugins;%PATH% 8 | -------------------------------------------------------------------------------- /tests/envPyCC.sh: -------------------------------------------------------------------------------- 1 | ########################################################################## 2 | # # 3 | # CloudComPy # 4 | # # 5 | # This program is free software; you can redistribute it and/or modify # 6 | # it under the terms of the GNU General Public License as published by # 7 | # the Free Software Foundation; either version 3 of the License, or # 8 | # any later version. # 9 | # # 10 | # This program is distributed in the hope that it will be useful, # 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | # GNU General Public License for more details. # 14 | # # 15 | # You should have received a copy of the GNU General Public License # 16 | # along with this program. If not, see . # 17 | # # 18 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 19 | # # 20 | ########################################################################## 21 | # 22 | # to be sourced before using cloudCompare module and tests in Python3 23 | 24 | SCRIPT_PATH=$(readlink -f "${BASH_SOURCE[0]}") 25 | SCRIPT_DIR=$(dirname "${SCRIPT_PATH}") 26 | CLOUDCOMPY_ROOT=$(realpath "${SCRIPT_DIR}/../..") 27 | export PYTHONPATH=${CLOUDCOMPY_ROOT}/lib/cloudcompare:${PYTHONPATH} 28 | export PYTHONPATH=${CLOUDCOMPY_ROOT}/doc/PythonAPI_test:${PYTHONPATH} 29 | export LD_LIBRARY_PATH=${CLOUDCOMPY_ROOT}/lib/cloudcompare/plugins:${LD_LIBRARY_PATH} 30 | export LC_NUMERIC=C 31 | -------------------------------------------------------------------------------- /tests/execInstallTest.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @set PREVPATH=%PATH% 3 | @set PREVPYTHONPATH=%PYTHONPATH% 4 | @set SCRIPT_DIR=%~dp0 5 | @set CLOUDCOMPY_ROOT=%SCRIPT_DIR%..\.. 6 | @set PYTHONPATH=%CLOUDCOMPY_ROOT%\CloudCompare;%PYTHONPATH% 7 | @set PYTHONPATH=%SCRIPT_DIR%;%PYTHONPATH% 8 | @set PATH=.;%CLOUDCOMPY_ROOT%\CloudCompare;%CLOUDCOMPY_ROOT%\ccViewer;%SCRIPT_DIR%;%PATH% 9 | python %1 10 | set PythonError=%errorlevel% 11 | echo "Python exit code = %PythonError%" 12 | @set PYTHONPATH=%PREVPYTHONPATH% 13 | @set PATH=%PREVPATH% 14 | exit %PythonError% 15 | -------------------------------------------------------------------------------- /tests/execInstallTest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | usage() 25 | { 26 | echo "usage: $0 test.py" 27 | } 28 | 29 | if [ "$1" == "" ]; then 30 | usage 31 | exit 1 32 | fi 33 | 34 | SCRIPT_PATH=$(readlink -f "${BASH_SOURCE[0]}") 35 | SCRIPT_DIR=$(dirname "${SCRIPT_PATH}") 36 | CLOUDCOMPY_ROOT=$(realpath "${SCRIPT_DIR}/../..") 37 | export PYTHONPATH=${CLOUDCOMPY_ROOT}/lib/cloudcompare:${PYTHONPATH} 38 | export PYTHONPATH=${CLOUDCOMPY_ROOT}/doc/PythonAPI_test:${PYTHONPATH} 39 | export LD_LIBRARY_PATH=${CLOUDCOMPY_ROOT}/lib/cloudcompare/plugins:${LD_LIBRARY_PATH} 40 | export LC_NUMERIC=C 41 | python3 $1 42 | -------------------------------------------------------------------------------- /tests/execTest.bat.in: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set PYTHONPATH=@CMAKE_CURRENT_BINARY_DIR@\..\pyAPI;%PYTHONPATH% 4 | set PYTHONPATH=@CMAKE_CURRENT_BINARY_DIR@;%PYTHONPATH% 5 | cd @CMAKE_CURRENT_SOURCE_DIR@ 6 | python %1 7 | -------------------------------------------------------------------------------- /tests/execTest.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | usage() 25 | { 26 | echo "usage: $0 test.py" 27 | } 28 | 29 | if [ "$1" == "" ]; then 30 | usage 31 | exit 1 32 | fi 33 | 34 | export PYTHONPATH=@CMAKE_CURRENT_BINARY_DIR@/../pyAPI:$PYTHONPATH 35 | export PYTHONPATH=@CMAKE_CURRENT_BINARY_DIR@/../pybind11:$PYTHONPATH 36 | export PYTHONPATH=@CMAKE_CURRENT_BINARY_DIR@:$PYTHONPATH 37 | export LC_NUMERIC=C 38 | cd @CMAKE_CURRENT_SOURCE_DIR@ 39 | python3 $1 40 | -------------------------------------------------------------------------------- /tests/test004.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import getSampleCloud, dataDir 31 | import cloudComPy as cc 32 | 33 | #---coordsToNumpy01-begin 34 | cloud = cc.loadPointCloud(getSampleCloud(5.0)) 35 | 36 | coords = cloud.toNpArrayCopy() 37 | if coords.shape != (cloud.size(), 3): 38 | raise RuntimeError 39 | #---coordsToNumpy01-end 40 | -------------------------------------------------------------------------------- /tests/test006.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import getSampleCloud, dataDir, isCoordEqual 31 | import cloudComPy as cc 32 | 33 | cloud = cc.loadPointCloud(getSampleCloud(5.0)) 34 | cloud.translate((1000, 2000, 3000)) 35 | res = cc.SavePointCloud(cloud, os.path.join(dataDir, "res1.xyz")) 36 | if res != cc.CC_FERR_NO_ERROR: 37 | raise RuntimeError 38 | 39 | cloud = cc.loadPointCloud(os.path.join(dataDir, "res1.xyz")) 40 | coords = cloud.toNpArray() 41 | if not isCoordEqual(coords[0], (995., 1995., 2999.8987)): 42 | raise RuntimeError 43 | 44 | cloud1 = cc.loadPointCloud(os.path.join(dataDir, "res1.xyz"), cc.CC_SHIFT_MODE.XYZ, 0, -1000, -2000, -3000) 45 | coords1 = cloud1.toNpArray() 46 | if not isCoordEqual(coords1[0], (-5., -5., -0.10131836)): 47 | raise RuntimeError 48 | 49 | cloud = cc.loadPointCloud(getSampleCloud(5.0)) 50 | cloud.translate((100000, 200000, 300000)) 51 | res = cc.SavePointCloud(cloud, os.path.join(dataDir, "shifted.xyz")) 52 | if res != cc.CC_FERR_NO_ERROR: 53 | raise RuntimeError 54 | 55 | cloud = cc.loadPointCloud(os.path.join(dataDir, "shifted.xyz")) 56 | if not cloud.isShifted(): 57 | raise RuntimeError 58 | shift = cloud.getGlobalShift() 59 | if not isCoordEqual(shift, (-100000, -200000, -300000), tol=1.e-2): 60 | raise RuntimeError 61 | 62 | -------------------------------------------------------------------------------- /tests/test012.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import getSampleCloud, getSampleCloud2, dataDir, isCoordEqual, createSymbolicLinks 31 | import cloudComPy as cc 32 | 33 | createSymbolicLinks() # required for tests on build, before cc.initCC 34 | 35 | #---planeFit01-begin 36 | cloud1 = cc.loadPointCloud(getSampleCloud2(3.0,0, 0.1)) 37 | cloud1.setName("cloud1") 38 | tr1 = cc.ccGLMatrix() 39 | tr1.initFromParameters(0.2*math.pi, (1., 1., 1.), (0.0, 0.0, 10.0)) 40 | cloud1.applyRigidTransformation(tr1) 41 | 42 | plane = cc.ccPlane.Fit(cloud1) 43 | equation = plane.getEquation() 44 | tr2 = plane.getTransformation() 45 | #---planeFit01-end 46 | eqRef = [0.4032580554485321, -0.2757962644100189, 0.8725361824035645, 8.782577514648438] 47 | for i in range(4): 48 | if not math.isclose(equation[i], eqRef[i], rel_tol=1.e-3): 49 | raise RuntimeError 50 | 51 | cc.SaveEntities([cloud1, plane], os.path.join(dataDir, "cloudsFit.bin")) 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /tests/test013.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import getSampleCloud, getSampleCloud2, dataDir, isCoordEqual, createSymbolicLinks 31 | import cloudComPy as cc 32 | 33 | createSymbolicLinks() # required for tests on build, before cc.initCC 34 | 35 | cloud = cc.loadPointCloud(getSampleCloud(5.0)) 36 | octree = cloud.getOctree() 37 | if octree is not None: 38 | raise RuntimeError 39 | octree = cloud.computeOctree() 40 | 41 | bb = octree.getBoundingBox() 42 | if not isCoordEqual(bb[0], (-5.004994869232178, -5.004994869232178, -3.043078899383545)): 43 | raise RuntimeError 44 | if not isCoordEqual(bb[1], (4.994994640350342, 4.994994640350342, 6.956910610198975)): 45 | raise RuntimeError 46 | nb = octree.getNumberOfProjectedPoints() 47 | if nb != 1000000: 48 | raise RuntimeError 49 | -------------------------------------------------------------------------------- /tests/test015.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import getSampleCloud, getSampleCloud2, dataDir, isCoordEqual, createSymbolicLinks 31 | import cloudComPy as cc 32 | 33 | createSymbolicLinks() # required for tests on build, before cc.initCC 34 | 35 | cloud1 = cc.loadPointCloud(getSampleCloud2(3.0,0, 0.1)) 36 | cloud1.setName("cloud1") 37 | 38 | mesh1 = cc.ccMesh.triangulate(cloud=cloud1, type=cc.TRIANGULATION_TYPES.DELAUNAY_2D_AXIS_ALIGNED, dim=2) 39 | mesh1.setName("mesh1") 40 | 41 | #---samplePoints01-begin 42 | cloud2=mesh1.samplePoints(densityBased=True, samplingParameter=50, withNormals=True) 43 | cloud2.setName("cloud2") 44 | #---samplePoints01-end 45 | if not math.isclose(cloud2.size(), 6489, rel_tol=0.20): 46 | raise RuntimeError 47 | 48 | cloud3=mesh1.samplePoints(True, 500, withRGB=True) 49 | cloud3.setName("cloud3") 50 | if not math.isclose(cloud3.size(), 64641, rel_tol=0.20): 51 | raise RuntimeError 52 | 53 | cloud4=mesh1.samplePoints(False, 1000, withTexture=True) 54 | cloud4.setName("cloud4") 55 | if not math.isclose(cloud4.size(), 1000, rel_tol=0.20): 56 | raise RuntimeError 57 | 58 | cloud5=mesh1.samplePoints(False, 100000) 59 | cloud5.setName("cloud5") 60 | if not math.isclose(cloud5.size(), 100000, rel_tol=0.20): 61 | raise RuntimeError 62 | 63 | cc.SaveEntities([cloud1, mesh1, cloud2, cloud3, cloud4, cloud5], os.path.join(dataDir, "samplemesh.bin")) 64 | 65 | -------------------------------------------------------------------------------- /tests/test017.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | import numpy as np 28 | 29 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 30 | 31 | from gendata import getSampleCloud, getSampleCloud2, dataDir, isCoordEqual, createSymbolicLinks 32 | import cloudComPy as cc 33 | 34 | createSymbolicLinks() # required for tests on build, before cc.initCC 35 | 36 | #---createCloudNumpy01-begin 37 | # --- generate a set of coords and a scalar field 38 | 39 | npts = 10000000 40 | phi = 2*np.pi*np.random.random((npts)) 41 | theta = 2*np.pi*np.random.random((npts)) 42 | r = 5 + 0.3*np.sin(2*2*np.pi*phi + 3*2*np.pi*theta) 43 | x = np.float32(r*np.sin(phi)*np.cos(theta)) 44 | y = np.float32(r*np.sin(phi)*np.sin(theta)) 45 | z = np.float32(r*np.cos(phi)) 46 | coords = np.column_stack((x,y,z)) 47 | dr = np.float32(np.sqrt(x*x + y*y + z*z) -5) 48 | 49 | # --- create the pointCloud, add the scalar field 50 | 51 | cl = cc.ccPointCloud("boule") 52 | cl.coordsFromNPArray_copy(coords) 53 | cl.addScalarField("delta") 54 | sf = cl.getScalarField(0) 55 | sf.fromNpArrayCopy(dr) 56 | 57 | # --- save the point cloud 58 | 59 | res = cc.SavePointCloud(cl, os.path.join(dataDir, "boule.bin")) 60 | #---createCloudNumpy01-end 61 | 62 | -------------------------------------------------------------------------------- /tests/test018.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import getSampleCloud, dataDir 31 | import numpy as np 32 | import cloudComPy as cc 33 | 34 | cloud = cc.loadPointCloud(getSampleCloud(2.0)) 35 | ok = cloud.exportCoordToSF(True, True, True) 36 | 37 | # --- access to ScalarField by name 38 | 39 | dic= cloud.getScalarFieldDic() 40 | dic # {'Coord. X': 0, 'Coord. Y': 1, 'Coord. Z': 2} 41 | sf0 = cloud.getScalarField(dic['Coord. X']) 42 | if sf0.getName() != 'Coord. X': 43 | raise RuntimeError 44 | sf1 = cloud.getScalarField('Coord. Y') 45 | if sf1.getName() != 'Coord. Y': 46 | raise RuntimeError 47 | 48 | # --- check write and read ply format 49 | 50 | cc.SavePointCloud(cloud, os.path.join(dataDir, "cloud.ply")) 51 | 52 | cloud2 = cc.loadPointCloud(os.path.join(dataDir, "cloud.ply")) 53 | if cloud2.size() != cloud.size(): 54 | raise RuntimeError 55 | 56 | dic2= cloud.getScalarFieldDic() 57 | if dic2 != dic: 58 | raise RuntimeError 59 | -------------------------------------------------------------------------------- /tests/test031.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import dataDir, isCoordEqual 31 | import cloudComPy as cc 32 | import numpy as np 33 | 34 | # --- generate a set of coords and a scalar field 35 | 36 | npts = 20000 37 | h = 2. 38 | x = np.float32(-5. + 10.*np.random.random((npts))) 39 | y = np.float32(-5. + 10.*np.random.random((npts))) 40 | z = np.float32(np.sin(h * np.sqrt(x**2 + y**2)) / np.sqrt(x**2 + y**2)) 41 | coords = np.column_stack((x,y,z)) 42 | 43 | # --- create the pointCloud, add the scalar field, save the cloud on .las format 44 | 45 | cl = cc.ccPointCloud("wave_%d"%h) 46 | cl.coordsFromNPArray_copy(coords) 47 | res = cl.exportCoordToSF(False, False, True) 48 | 49 | res = cc.SavePointCloud(cl, os.path.join(dataDir, "cloud_2.las")) 50 | 51 | # --- load the .las file, compute density, save 52 | 53 | cloud = cc.loadPointCloud(os.path.join(dataDir, "cloud_2.las")) 54 | isOk = cc.computeLocalDensity(cc.Density.DENSITY_3D, 0.16, [cloud]) 55 | if not isOk: 56 | raise RuntimeError 57 | 58 | res = cc.SavePointCloud(cloud, os.path.join(dataDir, "cloud_2s.las")) 59 | if res != cc.CC_FERR_NO_ERROR: 60 | raise RuntimeError 61 | -------------------------------------------------------------------------------- /tests/test032.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import getSampleCloud, dataDir 31 | import cloudComPy as cc 32 | 33 | #---PCV01-begin 34 | if cc.isPluginPCV(): 35 | import cloudComPy.PCV 36 | #---PCV01-end 37 | 38 | cloud = cc.loadPointCloud(getSampleCloud(5.0)) 39 | 40 | #---PCV02-begin 41 | tr1 = cc.ccGLMatrix() 42 | tr1.initFromParameters(0.3*math.pi, (0., 1., 0.), (0.0, 0.0, 0.0)) 43 | dish = cc.ccDish(2.0, 0.5, 0.0, tr1) 44 | cln =dish.getAssociatedCloud() 45 | cc.computeNormals([cln]) 46 | #---PCV02-end 47 | 48 | #---PCV03-begin 49 | cc.PCV.computeShadeVIS([cloud],cln) 50 | dic = cloud.getScalarFieldDic() 51 | cloud.renameScalarField(dic["Illuminance (PCV)"], "IlluminanceDish") 52 | #---PCV03-end 53 | if cloud.getNumberOfScalarFields() != 1: 54 | raise RuntimeError 55 | 56 | #---PCV04-begin 57 | cc.PCV.computeShadeVIS([cloud]) 58 | #---PCV04-end 59 | if cloud.getNumberOfScalarFields() != 2: 60 | raise RuntimeError 61 | 62 | cc.SaveEntities([cloud, dish, cln], os.path.join(dataDir, "PCV.bin")) 63 | -------------------------------------------------------------------------------- /tests/test033.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import getSampleCloud, dataDir 31 | import cloudComPy as cc 32 | 33 | #---HPR01-begin 34 | if cc.isPluginHPR(): 35 | import cloudComPy.HPR 36 | 37 | cloud = cc.loadPointCloud(getSampleCloud(5.0)) 38 | 39 | cloudCut = cc.HPR.computeHPR(cloud, (0.,-15., 25.)) 40 | #---HPR01-end 41 | 42 | nbPts = cloudCut.size() 43 | if not math.isclose(901000, nbPts, rel_tol = 1.e-2): 44 | raise RuntimeError 45 | 46 | cc.SaveEntities([cloudCut, cloudCut], os.path.join(dataDir, "HPR.bin")) 47 | -------------------------------------------------------------------------------- /tests/test034.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import dataDir 31 | 32 | import cloudComPy as cc 33 | 34 | #---MeshBoolean01-begin 35 | tr1 = cc.ccGLMatrix() 36 | tr1.initFromParameters(0.0, (0., 0., 0.), (1.0, 0.0, 0.0)) 37 | sphere = cc.ccSphere(2, tr1, "aSphere") 38 | 39 | cylinder = cc.ccCylinder(2.0, 5.0) 40 | 41 | if not cc.isPluginMeshBoolean(): 42 | print("Test skipped") 43 | sys.exit() 44 | 45 | import cloudComPy.MeshBoolean 46 | mesh = cc.MeshBoolean.computeMeshBoolean(sphere, cylinder, 47 | cc.MeshBoolean.CSG_OPERATION.INTERSECT) 48 | #---MeshBoolean01-end 49 | if mesh.size() != 1020: 50 | raise RuntimeError 51 | 52 | cc.SaveEntities([sphere, cylinder, mesh], os.path.join(dataDir, "MeshBoolean.bin")) 53 | -------------------------------------------------------------------------------- /tests/test037.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import dataDir, getSampleCloud 31 | import cloudComPy as cc 32 | 33 | #---extractCC01-begin 34 | cloud = cc.loadPointCloud(getSampleCloud(5.0)) 35 | bbox = cc.ccBBox((-5.0, -5.0, 0.), (5., 5., 1.), True) 36 | res=cc.ExtractSlicesAndContours(entities=[cloud], bbox=bbox) 37 | clouds = res[0] # result = [one cloud] 38 | #---extractCC01-end 39 | 40 | #---extractCC02-begin 41 | res2 = cc.ExtractConnectedComponents(clouds=clouds, octreeLevel=6, randomColors=True) 42 | components = res2[1] 43 | for comp in components: 44 | comp.showColors(True) 45 | #---extractCC02-end 46 | if res2[0] != 1: # the number of clouds in input 47 | raise RuntimeError 48 | if len(components) != 12: 49 | raise RuntimeError 50 | 51 | cc.SaveEntities(components, os.path.join(dataDir, "components.bin")) 52 | 53 | -------------------------------------------------------------------------------- /tests/test039.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import getSampleCloud2, getSamplePoly, dataDir 31 | import cloudComPy as cc 32 | 33 | #---crop2Dmesh01-begin 34 | cloud1 = cc.loadPointCloud(getSampleCloud2(3.0,0, 0.1)) 35 | cloud1.setName("cloud1") 36 | cloud1.exportCoordToSF(True, True, True) 37 | 38 | mesh1 = cc.ccMesh.triangulate(cloud1, cc.TRIANGULATION_TYPES.DELAUNAY_2D_AXIS_ALIGNED) 39 | mesh1.setName("mesh1") 40 | cc.computeNormals([mesh1], computePerVertexNormals=False) 41 | 42 | poly = cc.loadPolyline(getSamplePoly("poly1")) 43 | meshCropZ = mesh1.crop2D(poly, 2, True) 44 | #---crop2Dmesh01-end 45 | 46 | res = cc.SaveEntities([cloud1, mesh1, meshCropZ], os.path.join(dataDir, "cropMesh.bin")) 47 | -------------------------------------------------------------------------------- /tests/test042.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | import psutil 28 | 29 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 30 | 31 | from gendata import dataDir, getSampleCloud 32 | import cloudComPy as cc 33 | 34 | #---extractCC01-begin 35 | process = psutil.Process(os.getpid()) 36 | mem_start = process.memory_full_info().rss 37 | cloud = cc.loadPointCloud(getSampleCloud(5.0)) 38 | bbox = cc.ccBBox((-5.0, -5.0, 0.), (5., 5., 1.), True) 39 | res=cc.ExtractSlicesAndContours(entities=[cloud], bbox=bbox) 40 | clouds = res[0] 41 | print('input data memory usage:', process.memory_full_info().rss - mem_start) 42 | #---extractCC01-end 43 | 44 | #---extractCC02-begin 45 | for i in range(10): 46 | mem_start = process.memory_full_info().rss 47 | res2 = cc.ExtractConnectedComponents(clouds=clouds, octreeLevel=6, randomColors=True) 48 | components = res2[1] 49 | for comp in components: 50 | comp.showColors(True) 51 | #---extractCC02-end 52 | if res2[0] != 1: # the number of clouds in input 53 | raise RuntimeError 54 | if len(components) != 12: 55 | raise RuntimeError 56 | #---extractCC03-begin 57 | for comp in components: 58 | cc.deleteEntity(comp) 59 | # be sure to have no more Python variable referencing the deleted items 60 | components = None 61 | res2 = None 62 | addedMemory = process.memory_full_info().rss - mem_start 63 | print(f'iteration {i}, ExtractConnectedComponents added memory: ', addedMemory) 64 | #---extractCC03-end 65 | if i > 1 and addedMemory >20000: 66 | raise RuntimeError 67 | -------------------------------------------------------------------------------- /tests/test043.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import dataDir, getSampleCloud 31 | import cloudComPy as cc 32 | 33 | #---CSF01-begin 34 | if cc.isPluginCSF(): 35 | import cloudComPy.CSF 36 | cloud = cc.loadPointCloud(getSampleCloud(5.0)) 37 | clouds = cc.CSF.computeCSF(cloud) 38 | #---CSF01-end 39 | if len(clouds) != 2: 40 | raise RuntimeError 41 | if not math.isclose(clouds[0].size(), 935000, rel_tol=1.e-2): 42 | raise RuntimeError 43 | if clouds[1].size() != 1000000 - clouds[0].size(): 44 | raise RuntimeError 45 | #---CSF02-begin 46 | clouds2 = cc.CSF.computeCSF(cloud, csfRigidness=1, clothResolution=1.0, classThreshold=0.3, computeMesh=True) 47 | #---CSF02-end 48 | 49 | for cloud in clouds2: 50 | clouds.append(cloud) 51 | res = cc.SaveEntities(clouds, os.path.join(dataDir, "CSF.bin")) 52 | -------------------------------------------------------------------------------- /tests/test044.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import getSampleCloud, dataDir, isCoordEqual 31 | import cloudComPy as cc 32 | 33 | #---interpolSF_01-begin 34 | cloud1 = cc.loadPointCloud(getSampleCloud(5.0)) 35 | cloud2 = cc.loadPointCloud(getSampleCloud(1.0)) 36 | cloud1.exportCoordToSF(True, True, True) 37 | dic = cloud1.getScalarFieldDic() 38 | 39 | params = cc.interpolatorParameters() 40 | params.method = cc.INTERPOL_METHOD.RADIUS 41 | params.algos = cc.INTERPOL_ALGO.NORMAL_DIST 42 | params.radius = 0.15 43 | params.sigma = 0.06 44 | 45 | sfIndexes = [dic['Coord. X'], dic['Coord. Y'], dic['Coord. Z']] 46 | 47 | ret = cc.interpolateScalarFieldsFrom(cloud2, cloud1, sfIndexes, params) 48 | #---interpolSF_01-end 49 | if not ret: 50 | raise RuntimeError 51 | 52 | cc.SaveEntities([cloud1, cloud2], os.path.join(dataDir, "interpolSF.bin")) 53 | -------------------------------------------------------------------------------- /tests/test049.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | 26 | os.environ["_CCTRACE_"] = "ON" # only if you want C++ debug traces 27 | 28 | from gendata import getSampleCloud 29 | import cloudComPy as cc 30 | 31 | cloud = cc.loadPointCloud(getSampleCloud(5.0)) 32 | 33 | n_ccs = cc.LabelConnectedComponents(clouds=[cloud], octreeLevel=10) 34 | if n_ccs != 15684: 35 | raise RuntimeError 36 | 37 | cc_sf = cloud.getScalarField("CC labels") 38 | cc_sf.computeMinAndMax() 39 | if cc_sf.getMin() != 1: 40 | raise RuntimeError 41 | 42 | if cc_sf.getMax() != 15684: 43 | raise RuntimeError 44 | -------------------------------------------------------------------------------- /tests/test050.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os, sys 25 | 26 | os.environ["_CCTRACE_"] = "ON" # only if you want C++ debug traces 27 | 28 | from gendata import dataDir, dataExtDir 29 | import cloudComPy as cc 30 | 31 | if not os.path.isfile(os.path.join(dataExtDir, "testIssue100.e57")): 32 | print("Test skipped") 33 | sys.exit() 34 | 35 | cloud = cc.loadPointCloud(os.path.join(dataExtDir, "testIssue100.e57")) 36 | cc.SavePointCloud(cloud, os.path.join(dataExtDir, "testIssue100.pcd")) 37 | -------------------------------------------------------------------------------- /tests/test053.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import getSampleCloud, dataDir, isCoordEqual 31 | import cloudComPy as cc 32 | import numpy as np 33 | import multiprocessing 34 | 35 | if not cc.isPluginPoissonRecon(): 36 | print("Test skipped") 37 | sys.exit() 38 | 39 | import cloudComPy.PoissonRecon 40 | 41 | npts = 300000 42 | x = np.float32(-5 +10*np.random.random((npts))) 43 | y = np.float32(-5 +10*np.random.random((npts))) 44 | f = np.sqrt(x*x + y*y) 45 | z = np.sin(3*f) 46 | coords = np.column_stack((x,y,z)) 47 | cloud = cc.ccPointCloud("cloud") 48 | cloud.coordsFromNPArray_copy(coords) 49 | cloud.exportCoordToSF(False, False, True) 50 | cc.computeNormals([cloud]) 51 | 52 | #---PoissonRecon02-begin 53 | mesh = cc.PoissonRecon.PR.PoissonReconstruction(pc=cloud, threads=multiprocessing.cpu_count(), density=True) 54 | #---PoissonRecon02-end 55 | 56 | cc.SaveEntities([cloud, mesh], os.path.join(dataDir, "PoissonRecon.bin")) 57 | -------------------------------------------------------------------------------- /tests/test054.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | import numpy as np 28 | 29 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 30 | 31 | from gendata import getSampleCloud, getSampleCloud2, dataDir, isCoordEqual 32 | import cloudComPy as cc 33 | 34 | #---normals01-begin 35 | cloud = cc.loadPointCloud(getSampleCloud(5.0)) 36 | cc.computeNormals([cloud]) 37 | 38 | cloud.exportNormalToSF(True, True, True) 39 | dic = cloud.getScalarFieldDic() 40 | sfx = cloud.getScalarField(dic['Nx']) 41 | sfy = cloud.getScalarField(dic['Ny']) 42 | sfz = cloud.getScalarField(dic['Nz']) 43 | asfx = sfx.toNpArray() 44 | asfy = sfy.toNpArray() 45 | asfz = sfz.toNpArray() 46 | 47 | normals=cloud.normalsToNpArrayCopy() 48 | 49 | dx = normals[:,0] -asfx 50 | dy = normals[:,1] -asfy 51 | dz = normals[:,2] -asfz 52 | 53 | if dx.max() != 0 or dx.min() !=0: 54 | raise RuntimeError 55 | 56 | if dy.max() != 0 or dy.min() !=0: 57 | raise RuntimeError 58 | 59 | if dz.max() != 0 or dz.min() !=0: 60 | raise RuntimeError 61 | #---normals01-end 62 | 63 | #---normals02-begin 64 | normals *=-0.5 # an example of modification of the normals: invert and denormalize 65 | cloud.normalsFromNpArrayCopy(normals) 66 | #---normals02-end 67 | 68 | res = cc.SaveEntities([cloud], os.path.join(dataDir, "cloudnormals.bin")) 69 | if res != cc.CC_FILE_ERROR.CC_FERR_NO_ERROR: 70 | raise RuntimeError 71 | 72 | -------------------------------------------------------------------------------- /tests/test056.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ########################################################################## 4 | # # 5 | # CloudComPy # 6 | # # 7 | # This program is free software; you can redistribute it and/or modify # 8 | # it under the terms of the GNU General Public License as published by # 9 | # the Free Software Foundation; either version 3 of the License, or # 10 | # any later version. # 11 | # # 12 | # This program is distributed in the hope that it will be useful, # 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | # GNU General Public License for more details. # 16 | # # 17 | # You should have received a copy of the GNU General Public License # 18 | # along with this program. If not, see . # 19 | # # 20 | # Copyright 2020-2021 Paul RASCLE www.openfields.fr # 21 | # # 22 | ########################################################################## 23 | 24 | import os 25 | import sys 26 | import math 27 | 28 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 29 | 30 | from gendata import dataDir 31 | 32 | import cloudComPy as cc 33 | 34 | #---Cork01-begin 35 | tr1 = cc.ccGLMatrix() 36 | tr1.initFromParameters(0.0, (0., 0., 0.), (1.0, 0.0, 0.0)) 37 | sphere = cc.ccSphere(2, tr1, "aSphere") 38 | 39 | cylinder = cc.ccCylinder(2.0, 5.0) 40 | 41 | if not cc.isPluginCork(): 42 | print("Test skipped") 43 | sys.exit() 44 | 45 | import cloudComPy.Cork 46 | mesh = cc.Cork.Cork.compute(cylinder, sphere, cc.Cork.DIFF) 47 | #---Cork01-end 48 | if (mesh.size() < 1100) or (mesh.size() > 1200): 49 | raise RuntimeError 50 | 51 | cc.SaveEntities([sphere, cylinder, mesh], os.path.join(dataDir, "Cork.bin")) 52 | -------------------------------------------------------------------------------- /tests/test058.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import math 4 | 5 | import numpy as np 6 | try: 7 | import quaternion 8 | except: 9 | print("Test skipped") 10 | sys.exit() 11 | 12 | 13 | os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces 14 | import cloudComPy as cc 15 | 16 | # --- from ccGLMatrix to quaternion 17 | 18 | #---quaternion01-begin 19 | tr1 = cc.ccGLMatrixd() 20 | tr1.initFromParameters(math.pi/3., (1., 1., 1.), (0,0,0)) # 60° 21 | q1 = quaternion.as_quat_array(tr1.toQuaternion()) 22 | rot1 = quaternion.as_rotation_matrix(q1) 23 | #---quaternion01-end 24 | 25 | # --- direct build of a quaternion 26 | 27 | #---quaternion02-begin 28 | def normalized_quaternion(theta, ux, uy, uz): 29 | norm = math.sqrt(ux*ux + uy*uy +uz*uz) 30 | q1 = math.cos(theta/2.) 31 | q2 = ux*math.sin(theta/2.)/norm 32 | q3 = uy*math.sin(theta/2.)/norm 33 | q4 = uz*math.sin(theta/2.)/norm 34 | return np.quaternion(q1, q2, q3 ,q4) 35 | #---quaternion02-end 36 | 37 | qa = normalized_quaternion(math.pi/3., 1., 1., 1.) # 60° 38 | rota = quaternion.as_rotation_matrix(qa) 39 | 40 | # --- same result 41 | 42 | qeps = qa-q1 43 | if qeps.abs() > 1.e-7: 44 | raise RuntimeError 45 | 46 | # --- product of quaternions: composition of rotations 47 | 48 | qb = qa*qa # 120° 49 | rotb = quaternion.as_rotation_matrix(qb) 50 | 51 | # --- from quaternion to ccGLMatrix 52 | 53 | #---quaternion03-begin 54 | trb = cc.ccGLMatrixd.FromQuaternionAndTranslation(qb.components) 55 | datb = trb.getParameters1() 56 | angle = datb.alpha_rad*180/math.pi 57 | axis = datb.axis3D 58 | #---quaternion03-end 59 | 60 | if not math.isclose(angle, 120): 61 | raise RuntimeError 62 | 63 | # --- 64 | 65 | qc = qb*qb # 240° 66 | rotc = quaternion.as_rotation_matrix(qc) 67 | 68 | qd = qb*qc # 360° 69 | rotd = quaternion.as_rotation_matrix(qd) 70 | 71 | # --- check simple precision 72 | 73 | tr2 = cc.ccGLMatrix() 74 | tr2.initFromParameters(math.pi/3., (1., 1., 1.), (0,0,0)) 75 | q2 = quaternion.as_quat_array(tr2.toQuaternion()) 76 | rot2 = quaternion.as_rotation_matrix(q2) 77 | 78 | qeps2 = qa-q2 79 | if qeps2.abs() > 1.e-7: 80 | raise RuntimeError 81 | 82 | 83 | qb2 = q2*q2 84 | trb2 = cc.ccGLMatrix.FromQuaternionAndTranslation(qb2.components) 85 | datb2 = trb2.getParameters1() 86 | 87 | angle2 = datb2.alpha_rad*180/math.pi 88 | if not math.isclose(angle2, 120, rel_tol=1.e-7): 89 | raise RuntimeError 90 | 91 | 92 | -------------------------------------------------------------------------------- /viewer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project( viewerPy VERSION 1.38.0 ) 2 | 3 | add_library( ${PROJECT_NAME} STATIC ) 4 | 5 | set_property(TARGET ${PROJECT_NAME} PROPERTY AUTOMOC ON) 6 | 7 | target_sources( ${PROJECT_NAME} 8 | PRIVATE 9 | viewerPy.h 10 | viewerPy.cpp 11 | viewerPyApplication.h 12 | viewerPyApplication.cpp 13 | ) 14 | 15 | target_include_directories( ${PROJECT_NAME} PRIVATE 16 | ${CC_FBO_LIB_SOURCE_DIR}/include 17 | ${CCCoreLib_SOURCE_DIR}/include 18 | ${QCC_DB_LIB_SOURCE_DIR} 19 | ${CMAKE_CURRENT_BINARY_DIR} 20 | ) 21 | 22 | file( GLOB ui_list ${CMAKE_CURRENT_SOURCE_DIR}/../CloudCompare/ccViewer/ui_templates/*.ui ) 23 | file( GLOB qrc_list ${CMAKE_CURRENT_SOURCE_DIR}/../CloudCompare/qCC/*.qrc ) 24 | file( GLOB rc_list ${CMAKE_CURRENT_SOURCE_DIR}/../CloudCompare/qCC/*.rc ) 25 | 26 | qt5_wrap_ui( generated_ui_list ${ui_list} ) 27 | qt5_add_resources( generated_qrc_list ${qrc_list} ) 28 | 29 | target_sources( ${PROJECT_NAME} PRIVATE ${generated_ui_list} ${generated_qrc_list} ${rc_list} ) 30 | 31 | target_link_libraries( ${PROJECT_NAME} 32 | CCAppCommon 33 | ) 34 | 35 | # Qt libraries 36 | 37 | target_link_libraries( ${PROJECT_NAME} 38 | Qt5::Core 39 | Qt5::Gui 40 | Qt5::Widgets 41 | Qt5::OpenGL 42 | Qt5::PrintSupport 43 | ) 44 | 45 | if (WIN32) 46 | target_link_libraries( ${PROJECT_NAME} Qt5::WinMain) 47 | endif() 48 | -------------------------------------------------------------------------------- /viewer/viewerPyApplication.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: CloudCompare project # 15 | //# # 16 | //########################################################################## 17 | 18 | #include 19 | 20 | #ifdef Q_OS_MAC 21 | #include 22 | #endif 23 | 24 | #include "viewerPy.h" 25 | #include "viewerPyApplication.h" 26 | #include 27 | 28 | 29 | viewerPyApplication::viewerPyApplication( int &argc, char **argv, bool isCommandLine, QString appPath ) 30 | : ccApplicationBase( argc, argv, isCommandLine, QStringLiteral( "1.40.0" ), appPath) 31 | { 32 | mViewer=nullptr; 33 | setApplicationName( "CloudCompareViewer" ); 34 | CCTRACE("viewerPyApplication"); 35 | } 36 | 37 | void viewerPyApplication::setViewer(viewerPy *inViewer) 38 | { 39 | CCTRACE("setViewer"); 40 | mViewer = inViewer; 41 | } 42 | 43 | bool viewerPyApplication::event(QEvent *inEvent) 44 | { 45 | #ifdef Q_OS_MAC 46 | switch ( inEvent->type() ) 47 | { 48 | case QEvent::FileOpen: 49 | { 50 | if ( mViewer == nullptr ) 51 | { 52 | return false; 53 | } 54 | 55 | mViewer->addToDB( { static_cast(inEvent)->file() } ); 56 | return true; 57 | } 58 | 59 | default: 60 | break; 61 | } 62 | #endif 63 | 64 | return ccApplicationBase::event( inEvent ); 65 | } 66 | -------------------------------------------------------------------------------- /viewer/viewerPyApplication.h: -------------------------------------------------------------------------------- 1 | #ifndef VIEWERPYAPPLICATION_H 2 | #define VIEWERPYAPPLICATION_H 3 | 4 | //########################################################################## 5 | //# # 6 | //# CLOUDCOMPARE # 7 | //# # 8 | //# This program is free software; you can redistribute it and/or modify # 9 | //# it under the terms of the GNU General Public License as published by # 10 | //# the Free Software Foundation; version 2 or later of the License. # 11 | //# # 12 | //# This program is distributed in the hope that it will be useful, # 13 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | //# GNU General Public License for more details. # 16 | //# # 17 | //# COPYRIGHT: CloudCompare project # 18 | //# # 19 | //########################################################################## 20 | 21 | //Common 22 | #include 23 | #include 24 | 25 | class viewerPy; 26 | 27 | class viewerPyApplication : public ccApplicationBase 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | viewerPyApplication( int &argc, char **argv, bool isCommandLine, QString appPath ); 33 | 34 | void setViewer( viewerPy *inViewer ); 35 | viewerPy* getViewer() { return mViewer; }; 36 | 37 | protected: 38 | bool event( QEvent *inEvent ) override; 39 | 40 | private: 41 | viewerPy *mViewer; 42 | }; 43 | 44 | #endif 45 | --------------------------------------------------------------------------------