Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion .github/workflows/py-sanity-check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: py-sanity-checks

on: [push, pull_request]
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
build:
Expand Down
4 changes: 4 additions & 0 deletions _build/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 114ee4aa3afb3461d1b1d4e67aa69180
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added _build/.doctrees/assembly_intro.doctree
Binary file not shown.
Binary file added _build/.doctrees/change_log.doctree
Binary file not shown.
Binary file added _build/.doctrees/compute_error_intro.doctree
Binary file not shown.
Binary file added _build/.doctrees/contribute.doctree
Binary file not shown.
Binary file added _build/.doctrees/dev_documentation.doctree
Binary file not shown.
Binary file added _build/.doctrees/development_env.doctree
Binary file not shown.
Binary file added _build/.doctrees/df_architecture.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added _build/.doctrees/diffCheck.df_util.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added _build/.doctrees/diffCheck_PythonAPI.doctree
Binary file not shown.
Binary file added _build/.doctrees/documentation.doctree
Binary file not shown.
Binary file added _build/.doctrees/environment.pickle
Binary file not shown.
Binary file added _build/.doctrees/gh_DFBuildAssembly.doctree
Binary file not shown.
Binary file added _build/.doctrees/gh_DFCADSegmentator.doctree
Binary file not shown.
Binary file added _build/.doctrees/gh_DFCloudCloudDistance.doctree
Binary file not shown.
Binary file added _build/.doctrees/gh_DFCloudMeshDistance.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added _build/.doctrees/gh_DFCloudSizeDownsample.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added _build/.doctrees/gh_DFCsvExporter.doctree
Binary file not shown.
Binary file added _build/.doctrees/gh_DFDeconstructAssembly.doctree
Binary file not shown.
Binary file added _build/.doctrees/gh_DFDeconstructBeam.doctree
Binary file not shown.
Binary file not shown.
Binary file added _build/.doctrees/gh_DFICPRegistration.doctree
Binary file not shown.
Binary file added _build/.doctrees/gh_DFJointSegmentator.doctree
Binary file not shown.
Binary file added _build/.doctrees/gh_DFLoadCloudFromFile.doctree
Binary file not shown.
Binary file added _build/.doctrees/gh_DFLoadMeshFromFile.doctree
Binary file not shown.
Binary file added _build/.doctrees/gh_DFMeshToCloud.doctree
Binary file not shown.
Binary file not shown.
Binary file added _build/.doctrees/gh_DFTester.doctree
Binary file not shown.
Binary file added _build/.doctrees/gh_DFVisualization.doctree
Binary file not shown.
Binary file not shown.
Binary file added _build/.doctrees/gh_DFXMLExporter.doctree
Binary file not shown.
Binary file added _build/.doctrees/gh_components.doctree
Binary file not shown.
Binary file added _build/.doctrees/glossary.doctree
Binary file not shown.
Binary file added _build/.doctrees/index.doctree
Binary file not shown.
Binary file added _build/.doctrees/installation.doctree
Binary file not shown.
Binary file added _build/.doctrees/key-concepts.doctree
Binary file not shown.
Binary file added _build/.doctrees/pre-processing.doctree
Binary file not shown.
Binary file added _build/.doctrees/quickstart.doctree
Binary file not shown.
Binary file added _build/.doctrees/segmentation_intro.doctree
Binary file not shown.
Binary file added _build/.doctrees/style.doctree
Binary file not shown.
Binary file added _build/.doctrees/testing.doctree
Binary file not shown.
Binary file added _build/.doctrees/tutorials.doctree
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
// diffCheck_py.cc
#include <pybind11/pybind11.h>
#include <pybind11/eigen.h>
#include <pybind11/stl.h>

#include "diffCheck.hh"

namespace py = pybind11;

bool test() { return true; }

PYBIND11_MODULE(diffcheck_bindings, m) {
m.doc() = "The diffcheck bindings for python.";

//#################################################################################################
// testing namespace
//#################################################################################################

py::module_ submodule_test = m.def_submodule("dfb_test", "A submodule for testing the python bindings.");
submodule_test.def("test", &test, "Simple function testing a vanilla python bindings.");

//#################################################################################################
// dfb_geometry namespace
//#################################################################################################

py::module_ submodule_geometry = m.def_submodule("dfb_geometry", "A submodule for wrap geometries in df.");

py::class_<diffCheck::geometry::DFPointCloud, std::shared_ptr<diffCheck::geometry::DFPointCloud>>(submodule_geometry, "DFPointCloud",
"A class for the point cloud representation.")
.def(py::init<>())
.def(py::init<std::vector<Eigen::Vector3d>, std::vector<Eigen::Vector3d>, std::vector<Eigen::Vector3d>>(),
py::arg("points"), py::arg("colors"), py::arg("normals"))

.def("compute_distance", &diffCheck::geometry::DFPointCloud::ComputeDistance,
py::arg("target_cloud"))

.def("voxel_downsample", &diffCheck::geometry::DFPointCloud::VoxelDownsample,
py::arg("voxel_size"))
.def("uniform_downsample", &diffCheck::geometry::DFPointCloud::UniformDownsample,
py::arg("every_k_points"))
.def("downsample_by_size", &diffCheck::geometry::DFPointCloud::DownsampleBySize,
py::arg("target_size"))

.def("apply_transformation", &diffCheck::geometry::DFPointCloud::ApplyTransformation,
py::arg("transformation"))

.def("estimate_normals", &diffCheck::geometry::DFPointCloud::EstimateNormals,
py::arg("use_cilantro_evaluator") = false,
py::arg("knn") = 100,
py::arg("search_radius") = std::nullopt)

.def("apply_color", (void (diffCheck::geometry::DFPointCloud::*)(int, int, int)) &diffCheck::geometry::DFPointCloud::ApplyColor,
py::arg("r"), py::arg("g"), py::arg("b"))

.def("load_from_PLY", &diffCheck::geometry::DFPointCloud::LoadFromPLY)
.def("add_points", &diffCheck::geometry::DFPointCloud::AddPoints)

.def("get_tight_bounding_box", &diffCheck::geometry::DFPointCloud::GetTightBoundingBox)
.def("get_axis_aligned_bounding_box", &diffCheck::geometry::DFPointCloud::GetAxixAlignedBoundingBox)

.def("get_num_points", &diffCheck::geometry::DFPointCloud::GetNumPoints,
"Get the number of points in the point cloud.")
.def("get_num_colors", &diffCheck::geometry::DFPointCloud::GetNumColors)
.def("get_num_normals", &diffCheck::geometry::DFPointCloud::GetNumNormals)
.def("get_center_point", &diffCheck::geometry::DFPointCloud::GetCenterPoint)

.def("has_points", &diffCheck::geometry::DFPointCloud::HasPoints)
.def("has_colors", &diffCheck::geometry::DFPointCloud::HasColors)
.def("has_normals", &diffCheck::geometry::DFPointCloud::HasNormals)

.def_property("points",
[](const diffCheck::geometry::DFPointCloud &self) { return self.Points; },
[](diffCheck::geometry::DFPointCloud &self, const std::vector<Eigen::Vector3d>& value) { self.Points = value; })
.def_property("colors",
[](const diffCheck::geometry::DFPointCloud &self) { return self.Colors; },
[](diffCheck::geometry::DFPointCloud &self, const std::vector<Eigen::Vector3d>& value) { self.Colors = value; })
.def_property("normals",
[](const diffCheck::geometry::DFPointCloud &self) { return self.Normals; },
[](diffCheck::geometry::DFPointCloud &self, const std::vector<Eigen::Vector3d>& value) { self.Normals = value; });

py::class_<diffCheck::geometry::DFMesh, std::shared_ptr<diffCheck::geometry::DFMesh>>(submodule_geometry, "DFMesh",
"A class for the triangle mesh representation.")
.def(py::init<>())
.def(py::init<std::vector<Eigen::Vector3d>, std::vector<Eigen::Vector3i>, std::vector<Eigen::Vector3d>, std::vector<Eigen::Vector3d>, std::vector<Eigen::Vector3d>>())

.def("compute_distance", &diffCheck::geometry::DFMesh::ComputeDistance,
py::arg("target_cloud"),
py::arg("is_abs") = true)

.def("load_from_PLY", &diffCheck::geometry::DFMesh::LoadFromPLY)

.def("sample_points_uniformly", &diffCheck::geometry::DFMesh::SampleCloudUniform)

.def("get_tight_bounding_box", &diffCheck::geometry::DFMesh::GetTightBoundingBox)

.def("get_num_vertices", &diffCheck::geometry::DFMesh::GetNumVertices)
.def("get_num_faces", &diffCheck::geometry::DFMesh::GetNumFaces)

.def_property("vertices",
[](const diffCheck::geometry::DFMesh &self) { return self.Vertices; },
[](diffCheck::geometry::DFMesh &self, const std::vector<Eigen::Vector3d>& value) { self.Vertices = value; })
.def_property("faces",
[](const diffCheck::geometry::DFMesh &self) { return self.Faces; },
[](diffCheck::geometry::DFMesh &self, const std::vector<Eigen::Vector3i>& value) { self.Faces = value; })
.def_property("normals_vertex",
[](const diffCheck::geometry::DFMesh &self) { return self.NormalsVertex; },
[](diffCheck::geometry::DFMesh &self, const std::vector<Eigen::Vector3d>& value) { self.NormalsVertex = value; })
.def_property("normals_face",
[](const diffCheck::geometry::DFMesh &self) { return self.NormalsFace; },
[](diffCheck::geometry::DFMesh &self, const std::vector<Eigen::Vector3d>& value) { self.NormalsFace = value; })
.def_property("colors_vertex",
[](const diffCheck::geometry::DFMesh &self) { return self.ColorsVertex; },
[](diffCheck::geometry::DFMesh &self, const std::vector<Eigen::Vector3d>& value) { self.ColorsVertex = value; })
.def_property("colors_face",
[](const diffCheck::geometry::DFMesh &self) { return self.ColorsFace; },
[](diffCheck::geometry::DFMesh &self, const std::vector<Eigen::Vector3d>& value) { self.ColorsFace = value; });

//#################################################################################################
// dfb_transformation namespace
//#################################################################################################

py::module_ submodule_transformation = m.def_submodule("dfb_transformation", "A submodule for the transformation classes.");

py::class_<diffCheck::transformation::DFTransformation>(submodule_transformation, "DFTransformation")
.def(py::init<>())
.def(py::init<const Eigen::Matrix4d&>())

.def_readwrite("transformation_matrix", &diffCheck::transformation::DFTransformation::TransformationMatrix);

//#################################################################################################
// dfb_registrations namespace
//#################################################################################################

py::module_ submodule_registrations = m.def_submodule("dfb_registrations", "A submodule for the registration methods.");

py::class_<diffCheck::registrations::DFGlobalRegistrations>(submodule_registrations, "DFGlobalRegistrations",
"A static class for the global registration methods.")
.def_static("O3DFastGlobalRegistrationFeatureMatching", &diffCheck::registrations::DFGlobalRegistrations::O3DFastGlobalRegistrationFeatureMatching,
py::arg("source"),
py::arg("target"),
py::arg("voxelize") = false,
py::arg("voxel_size") = 0.005,
py::arg("radius_kd_tree_search") = 0.8,
py::arg("max_neighbor_kd_tree_search") = 50,
py::arg("max_correspondence_distance") = 0.05,
py::arg("iteration_number") = 128,
py::arg("max_tuple_count") = 1000)
.def_static("O3DRansacOnFeatureMatching", &diffCheck::registrations::DFGlobalRegistrations::O3DRansacOnFeatureMatching,
py::arg("source"),
py::arg("target"),
py::arg("voxelize") = false,
py::arg("voxel_size") = 0.005,
py::arg("radius_kd_tree_search") = 1.0,
py::arg("max_neighbor_kd_tree_search") = 50,
py::arg("max_correspondence_distance") = 0.5,
py::arg("is_t_estimate_pt2pt") = false,
py::arg("ransac_n") = 3,
py::arg("correspondence_checker_distance") = 0.05,
py::arg("similarity_threshold") = 1.5,
py::arg("ransac_max_iteration") = 5000,
py::arg("ransac_confidence_threshold") = 0.999);

py::class_<diffCheck::registrations::DFRefinedRegistration>(submodule_registrations, "DFRefinedRegistration",
"A static class for the refined registration methods.")
.def_static("O3DICP", &diffCheck::registrations::DFRefinedRegistration::O3DICP,
py::arg("source"),
py::arg("target"),
py::arg("max_correspondence_distance") = 0.1,
py::arg("is_t_estimate_pt2pt") = false,
py::arg("relative_fitness") = 1e-6,
py::arg("relative_rmse") = 1e-6,
py::arg("max_iteration") = 30,
py::arg("use_point_to_plane") = false)
.def_static("O3DGeneralizedICP", &diffCheck::registrations::DFRefinedRegistration::O3DGeneralizedICP,
py::arg("source"),
py::arg("target"),
py::arg("max_correspondence_distance") = 0.1,
py::arg("max_iteration") = 30,
py::arg("relative_fitness") = 1e-6,
py::arg("relative_rmse") = 1e-6);

//#################################################################################################
// dfb_segmentation namespace
//#################################################################################################

py::module_ submodule_segmentation = m.def_submodule("dfb_segmentation", "A submodule for the `semantic` segmentation methods.");

py::class_<diffCheck::segmentation::DFSegmentation>(submodule_segmentation, "DFSegmentation",
"A static class for the segmentation methods.")
.def_static("segment_by_normal", &diffCheck::segmentation::DFSegmentation::NormalBasedSegmentation,
py::arg("point_cloud"),
py::arg("normal_threshold_degree") = 20.0,
py::arg("min_cluster_size") = 10,
py::arg("use_knn_neighborhood") = true,
py::arg("knn_neighborhood_size") = 10,
py::arg("radius_neighborhood_size") = 0.1,
py::arg("color_clusters") = false)

.def_static("associate_clusters", &diffCheck::segmentation::DFSegmentation::AssociateClustersToMeshes,
py::arg("reference_mesh"),
py::arg("unassociated_clusters"),
py::arg("angle_threshold") = 0.1,
py::arg("association_threshold") = 0.1)

.def_static("clean_unassociated_clusters", &diffCheck::segmentation::DFSegmentation::CleanUnassociatedClusters,
py::arg("unassociated_clusters"),
py::arg("associated_clusters"),
py::arg("reference_mesh"),
py::arg("angle_threshold") = 0.1,
py::arg("association_threshold") = 0.1);
}
Binary file added _build/_images/gh_DFVizSettings_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon21.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon22.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon23.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _build/_images/icon9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions _build/_sources/assembly_intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(assembly_intro)=
# DfAssembly

/// introductio nand example on how to build an assembly with diffCheck (showing also deconstructing and a general scheme of the assembly architecture)
4 changes: 4 additions & 0 deletions _build/_sources/change_log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(change_log)=
# Change log

/// find a way to automatize the change log
5 changes: 5 additions & 0 deletions _build/_sources/compute_error_intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(compute_error_intro)=
# Compute cloud-CAD error

/// tutorial on how to compute the error between a point cloud and a CAD model with diffCheck component. It can be slit in two parts: single element - full structure

52 changes: 52 additions & 0 deletions _build/_sources/contribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
(contrib_guide)=
# Contribute

We welcome pull requests from everyone. Please have a look at the [issue](https://github.com/diffCheckOrg/diffCheck/issues) list to see if there is something you can help with. If you have a new feature in mind, please open an issue to discuss it first.

## Code quality

We run [mypy](https://mypy.readthedocs.io/en/stable/index.html) and [Ruff](https://docs.astral.sh/ruff/) for e.g. python on pre-commit hooks to ensure code quality.
Please make sure to:
1. (when you `git clone` the repo) to install the *pre-commit hooks*:

```console
pre-commit install
```
2. to run the following commands before submitting a pull request:

```console
pre-commit run --all-files
```

## How to contribute

Follow these steps to contribute to the project:

1. Fork the diffCheck repository by clicking the **Fork** button on the [diffCheck repository](https://github.com/diffCheckOrg/diffCheck). Clone the repository to your local machine:

```console
git clone https://github.com/YOUR_USERNAME/diffCheck.git
cd diffCheck
```

2. Create a new branch for your feature:

```console
git checkout -b my-feature
```

3. Add the diffCheck repository as a remote for convinience:

```console
git remote add upstream https://github.com/diffCheckOrg/diffCheck
```

4. Next you will need to set up your development environment. You can find the instructions in the [development installation guide](dev_env).

5. Work on your feature (follow [c++](cpp_conv) or [py](py_conv) style guide) and commit your changes by following the [commit message guidelines](git_commit_system):

```console
git add .
git commit -m "WIP: Add my feature"
git push origin my-feature
```
16 changes: 16 additions & 0 deletions _build/_sources/dev_documentation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. _dev_df_doc:

Developer documentation
=======================

Here you will find all the necessary as a developer to contribute to the project.

.. toctree::
:maxdepth: 1
:caption: Developer documentation

contribute
development_env
style
testing
documentation
Loading