Skip to content

Commit 5489ce1

Browse files
committed
FIX: in source code and general reorganization + cleaning
1 parent 051995b commit 5489ce1

File tree

18 files changed

+432
-487
lines changed

18 files changed

+432
-487
lines changed

.vscode/settings.json

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"files.associations": {
3+
"memory": "cpp",
4+
"algorithm": "cpp",
5+
"any": "cpp",
6+
"array": "cpp",
7+
"atomic": "cpp",
8+
"bit": "cpp",
9+
"bitset": "cpp",
10+
"cctype": "cpp",
11+
"cfenv": "cpp",
12+
"charconv": "cpp",
13+
"chrono": "cpp",
14+
"cinttypes": "cpp",
15+
"clocale": "cpp",
16+
"cmath": "cpp",
17+
"codecvt": "cpp",
18+
"compare": "cpp",
19+
"complex": "cpp",
20+
"concepts": "cpp",
21+
"condition_variable": "cpp",
22+
"coroutine": "cpp",
23+
"csetjmp": "cpp",
24+
"csignal": "cpp",
25+
"cstdarg": "cpp",
26+
"cstddef": "cpp",
27+
"cstdint": "cpp",
28+
"cstdio": "cpp",
29+
"cstdlib": "cpp",
30+
"cstring": "cpp",
31+
"ctime": "cpp",
32+
"cwchar": "cpp",
33+
"cwctype": "cpp",
34+
"deque": "cpp",
35+
"exception": "cpp",
36+
"execution": "cpp",
37+
"filesystem": "cpp",
38+
"format": "cpp",
39+
"forward_list": "cpp",
40+
"fstream": "cpp",
41+
"functional": "cpp",
42+
"future": "cpp",
43+
"initializer_list": "cpp",
44+
"iomanip": "cpp",
45+
"ios": "cpp",
46+
"iosfwd": "cpp",
47+
"iostream": "cpp",
48+
"istream": "cpp",
49+
"iterator": "cpp",
50+
"limits": "cpp",
51+
"list": "cpp",
52+
"locale": "cpp",
53+
"map": "cpp",
54+
"memory_resource": "cpp",
55+
"mutex": "cpp",
56+
"new": "cpp",
57+
"numeric": "cpp",
58+
"optional": "cpp",
59+
"ostream": "cpp",
60+
"queue": "cpp",
61+
"random": "cpp",
62+
"ranges": "cpp",
63+
"ratio": "cpp",
64+
"regex": "cpp",
65+
"scoped_allocator": "cpp",
66+
"set": "cpp",
67+
"shared_mutex": "cpp",
68+
"source_location": "cpp",
69+
"span": "cpp",
70+
"sstream": "cpp",
71+
"stack": "cpp",
72+
"stdexcept": "cpp",
73+
"stop_token": "cpp",
74+
"streambuf": "cpp",
75+
"string": "cpp",
76+
"strstream": "cpp",
77+
"system_error": "cpp",
78+
"thread": "cpp",
79+
"tuple": "cpp",
80+
"type_traits": "cpp",
81+
"typeindex": "cpp",
82+
"typeinfo": "cpp",
83+
"unordered_map": "cpp",
84+
"unordered_set": "cpp",
85+
"utility": "cpp",
86+
"valarray": "cpp",
87+
"variant": "cpp",
88+
"vector": "cpp",
89+
"xfacet": "cpp",
90+
"xhash": "cpp",
91+
"xiosbase": "cpp",
92+
"xlocale": "cpp",
93+
"xlocbuf": "cpp",
94+
"xlocinfo": "cpp",
95+
"xlocmes": "cpp",
96+
"xlocmon": "cpp",
97+
"xlocnum": "cpp",
98+
"xloctime": "cpp",
99+
"xmemory": "cpp",
100+
"xstddef": "cpp",
101+
"xstring": "cpp",
102+
"xtr1common": "cpp",
103+
"xtree": "cpp",
104+
"xutility": "cpp",
105+
"*.ipp": "cpp"
106+
}
107+
}

deps/boost

Submodule boost updated 1 file

deps/eigen

Submodule eigen updated from 77833f9 to 2265242

deps/loguru

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 4adaa185883e3c04da25913579c451d3c32cfac1

deps/open3d

Submodule open3d updated 1 file

src/diffCheck.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
#include "diffCheck/IOManager.hh"
1010
#include "diffCheck/visualizer.hh"
1111
#include "diffCheck/transformation/DFTransformation.hh"
12-
#include "diffCheck/registration/globalRegistration.hh"
12+
#include "diffCheck/registrations/DFGlobalRegistrations.hh"

src/diffCheck/geometry/DFMesh.cc

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "diffCheck/geometry/DFMesh.hh"
2-
32
#include "diffCheck/IOManager.hh"
43

54

@@ -18,33 +17,6 @@ namespace diffCheck::geometry
1817
{
1918
this->Faces[i] = O3DTriangleMesh->triangles_[i];
2019
}
21-
22-
// if (O3DTriangleMesh->HasVertexNormals())
23-
// {
24-
// this->NormalsVertex.resize(O3DTriangleMesh->vertex_normals_.size());
25-
// for (size_t i = 0; i < O3DTriangleMesh->vertex_normals_.size(); i++)
26-
// {
27-
// this->NormalsVertex[i] = O3DTriangleMesh->vertex_normals_[i];
28-
// }
29-
// }
30-
31-
// if (O3DTriangleMesh->HasTriangleNormals())
32-
// {
33-
// this->NormalsFace.resize(O3DTriangleMesh->triangle_normals_.size());
34-
// for (size_t i = 0; i < O3DTriangleMesh->triangle_normals_.size(); i++)
35-
// {
36-
// this->NormalsFace[i] = O3DTriangleMesh->triangle_normals_[i];
37-
// }
38-
// }
39-
40-
// if (O3DTriangleMesh->HasVertexColors())
41-
// {
42-
// this->ColorsVertex.resize(O3DTriangleMesh->vertex_colors_.size());
43-
// for (size_t i = 0; i < O3DTriangleMesh->vertex_colors_.size(); i++)
44-
// {
45-
// this->ColorsVertex[i] = O3DTriangleMesh->vertex_colors_[i];
46-
// }
47-
// }
4820
}
4921

5022
std::shared_ptr<open3d::geometry::TriangleMesh> DFMesh::Cvt2O3DTriangleMesh()
@@ -83,6 +55,13 @@ namespace diffCheck::geometry
8355
return O3DTriangleMesh;
8456
}
8557

58+
void DFMesh::ApplyTransformation(const diffCheck::transformation::DFTransformation &transformation)
59+
{
60+
auto O3DTriangleMesh = this->Cvt2O3DTriangleMesh();
61+
O3DTriangleMesh->Transform(transformation.TransformationMatrix);
62+
this->Cvt2DFMesh(O3DTriangleMesh);
63+
}
64+
8665
void DFMesh::LoadFromPLY(const std::string &path)
8766
{
8867
std::shared_ptr<diffCheck::geometry::DFMesh> tempMesh_ptr = diffCheck::io::ReadPLYMeshFromFile(path);

src/diffCheck/geometry/DFMesh.hh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <Eigen/Core>
44
#include <open3d/Open3D.h>
55

6+
#include <diffCheck/transformation/DFTransformation.hh>
7+
68
namespace diffCheck::geometry
79
{
810
class DFMesh
@@ -11,8 +13,7 @@ namespace diffCheck::geometry
1113
DFMesh() = default;
1214
~DFMesh() = default;
1315

14-
///< Convertes
15-
public:
16+
public: ///< Convertes
1617
/**
1718
* @brief Convert a open3d triangle mesh to our datatype
1819
*
@@ -27,24 +28,29 @@ namespace diffCheck::geometry
2728
*/
2829
std::shared_ptr<open3d::geometry::TriangleMesh> Cvt2O3DTriangleMesh();
2930

30-
///< I/O loader
31-
public:
31+
public: ///< Transformers
32+
/**
33+
* @brief Apply a transformation to the mesh
34+
*
35+
* @param transformation the transformation to apply
36+
*/
37+
void ApplyTransformation(const diffCheck::transformation::DFTransformation &transformation);
38+
39+
public: ///< I/O loader
3240
/**
3341
* @brief Read a mesh from a file
3442
*
3543
* @param filename the path to the file with the extension
3644
*/
3745
void LoadFromPLY(const std::string &path);
3846

39-
///< Getters
40-
public:
47+
public: ///< Getters
4148
/// @brief Number of vertices in the mesh
4249
int GetNumVertices() const { return this->Vertices.size(); }
4350
/// @brief Number of faces in the mesh
4451
int GetNumFaces() const { return this->Faces.size(); }
4552

46-
///< Basic mesh data
47-
public:
53+
public: ///< Basic mesh data
4854
/// @brief Eigen vector of 3D vertices
4955
std::vector<Eigen::Vector3d> Vertices;
5056
/// @brief Eigen vector of faces

src/diffCheck/geometry/DFPointCloud.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,25 @@ namespace diffCheck::geometry
3333
return O3DPointCloud;
3434
}
3535

36+
std::vector<double> DFPointCloud::ComputeP2PDistance(std::shared_ptr<geometry::DFPointCloud> target)
37+
{
38+
std::vector<double> errors;
39+
auto O3DSourcePointCloud = this->Cvt2O3DPointCloud();
40+
auto O3DTargetPointCloud = target->Cvt2O3DPointCloud();
41+
42+
std::vector<double> distances;
43+
44+
distances = O3DSourcePointCloud->ComputePointCloudDistance(*O3DTargetPointCloud);
45+
return distances;
46+
}
47+
48+
void DFPointCloud::ApplyTransformation(const diffCheck::transformation::DFTransformation &transformation)
49+
{
50+
auto O3DPointCloud = this->Cvt2O3DPointCloud();
51+
O3DPointCloud->Transform(transformation.TransformationMatrix);
52+
this->Cvt2DFPointCloud(O3DPointCloud);
53+
}
54+
3655
void DFPointCloud::LoadFromPLY(const std::string &path)
3756
{
3857
auto cloud = diffCheck::io::ReadPLYPointCloud(path);

src/diffCheck/geometry/DFPointCloud.hh

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <Eigen/Core>
44
#include <open3d/Open3D.h>
55

6+
#include <diffCheck/transformation/DFTransformation.hh>
7+
68

79
namespace diffCheck::geometry
810
{
@@ -12,8 +14,8 @@ namespace diffCheck::geometry
1214
DFPointCloud() = default;
1315
~DFPointCloud() = default;
1416

15-
///< Converters from other point cloud datatypes libraries to our format
16-
public:
17+
18+
public: ///< Converters from other point cloud datatypes libraries to our format
1719
/**
1820
* @brief Converter from open3d point cloud to our datatype
1921
*
@@ -28,26 +30,45 @@ namespace diffCheck::geometry
2830
*/
2931
std::shared_ptr<open3d::geometry::PointCloud> Cvt2O3DPointCloud();
3032

31-
///< I/O loader
32-
public:
33+
public: ///< Utilities
34+
/**
35+
* @brief Compute the "point to point" distance between this and another point clouds.
36+
*
37+
* For every point in the source point cloud, it looks in the KDTree of the target point cloud and finds the closest point.
38+
* It returns a vector of distances, one for each point in the source point cloud.
39+
*
40+
* @param target The target diffCheck point cloud
41+
* @return std::vector<double> A vector of distances, one for each point in the source point cloud.
42+
*
43+
* @see https://github.com/isl-org/Open3D/blob/main/cpp/open3d/geometry/PointCloud.cpp
44+
*/
45+
std::vector<double> ComputeP2PDistance(std::shared_ptr<geometry::DFPointCloud> target);
46+
47+
public: ///< Transformers
48+
/**
49+
* @brief Apply a transformation to the point cloud
50+
*
51+
* @param transformation the transformation to apply
52+
*/
53+
void ApplyTransformation(const diffCheck::transformation::DFTransformation &transformation);
54+
55+
public: ///< I/O loader
3356
/**
3457
* @brief Read a point cloud from a file
3558
*
3659
* @param filename the path to the file with the extension
3760
*/
3861
void LoadFromPLY(const std::string &path);
3962

40-
///< Getters
41-
public:
63+
public: ///< Getters
4264
/// @brief Number of points in the point cloud
4365
int GetNumPoints() const { return this->Points.size(); }
4466
/// @brief Number of colors in the point cloud
4567
int GetNumColors() const { return this->Colors.size(); }
4668
/// @brief Number of normals in the point cloud
4769
int GetNumNormals() const { return this->Normals.size(); }
4870

49-
///< Basic point cloud data
50-
public:
71+
public: ///< Basic point cloud data
5172
/// @brief Eigen vector of 3D points
5273
std::vector<Eigen::Vector3d> Points;
5374
/// @brief Eigen vector of 3D colors

0 commit comments

Comments
 (0)