Skip to content

Commit efab6bd

Browse files
committed
CAP: basic working diffCheck to start prototyping
1 parent cbecacc commit efab6bd

File tree

20 files changed

+280
-208
lines changed

20 files changed

+280
-208
lines changed

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ endif()
2222
set(SHARED_LIB_NAME diffCheck)
2323

2424
file(GLOB_RECURSE SOURCES_LIB
25-
src/diffCheck.cc src/diffCheck.hh # diffCheck interface
25+
src/diffCheck.hh # diffCheck interface
2626
src/diffCheck/*.cc src/diffCheck/*.hh # diffCheck src
27-
src/diffcheckpch.cc src/diffcheckpch.hh # precompiled headers
2827
)
2928

3029
add_library(${SHARED_LIB_NAME} SHARED ${SOURCES_LIB})

CONTRIBUTING.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ gdb "path-to-executable"
146146
> use `break` to set a breakpoint and `continue` to continue the execution of the program.
147147
> use `bt` to see the backtrace of the program when a segfault occurs.
148148
149-
### Doxygen
149+
<!-- ### Doxygen
150150
For documentation we use the [*JavaDoc" convention](https://doxygen.nl/manual/docblocks.html).
151151
Follow [this guide for documenting the code](https://developer.lsst.io/cpp/api-docs.html).
152152
```c++
@@ -155,9 +155,9 @@ Follow [this guide for documenting the code](https://developer.lsst.io/cpp/api-d
155155
* @param filename path to the map.yaml file
156156
* @param planes vector of TSPlane objects
157157
*/
158-
```
158+
``` -->
159159

160-
### Logging (TO BE UPDATED)
160+
<!-- ### Logging (TO BE UPDATED)
161161
To log use the following MACROS. All the code is contained in `Log.hpp` and `Log.cpp`.
162162
```c++
163163
AIAC_INFO("test_core_info");
@@ -173,8 +173,42 @@ The output is like so:
173173
The logging can be silenced by setting OFF the option in the main `CMakeLists.txt` and do clean reconfiguration.
174174
```cmake
175175
option(SILENT_LOGGING "Do not log messages in the terminal of on." ON)
176+
``` -->
177+
178+
### I/O and basic datatypes
179+
Here's how you can import point cloud from file:
180+
```c++
181+
#include "diffCheck/geometry/DFPointCloud.hh"
182+
#include "diffCheck/geometry/DFMesh.hh"
183+
184+
// clouds
185+
std::shared_ptr<diffCheck::geometry::DFPointCloud> dfPointCloudPtr = std::make_shared<diffCheck::geometry::DFPointCloud>();
186+
std::string pathMesh = R"(C:\Users\yourfilecloudpath.ply)";
187+
dfPointCloudPtr->LoadFromPLY(pathCloud);
188+
189+
// mesh
190+
std::shared_ptr<diffCheck::geometry::DFMesh> dfMeshPtr = std::make_shared<diffCheck::geometry::DFMesh>();
191+
std::string pathCloud = R"(C:\Users\yourfilemeshpath.ply)";
192+
dfMeshPtr->LoadFromPLY(pathMesh);
176193
```
177194
195+
### Visualizer
196+
Clouds and mesh can be visualized like this:
197+
```c++
198+
#include "diffCheck/visualizer/DFVisualizer.hh"
199+
200+
// clouds
201+
std::shared_ptr<diffCheck::visualizer::DFVisualizer> dfVisualizerPtr = std::make_shared<diffCheck::visualizer::DFVisualizer>();
202+
dfVisualizerPtr->LoadPointCloud(dfPointCloudPtr);
203+
dfVisualizerPtr->Run();
204+
205+
// mesh
206+
std::shared_ptr<diffCheck::visualizer::DFVisualizer> dfVisualizerPtr = std::make_shared<diffCheck::visualizer::DFVisualizer>();
207+
dfVisualizerPtr->LoadMesh(dfMeshPtr);
208+
dfVisualizerPtr->Run();
209+
```
210+
211+
178212
### CTesting (TO BE UPDATED)
179213
When necessary, c++ testing is done by using CTest. Important/critical features (e.g., correcting functioning of graphics with OpenGL and Glfw) needs testing to be written (this is usefull for e.g., GitHub Actions). Such tests can be extracted from the main source code and integrated in a seperate section: cmake testing.
180214

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,18 @@ To build and test the project, follow the following steps:
5555
```terminal
5656
cmake -S . -B build
5757
cmake --build build
58-
./build/bin/diffCheck.exe
59-
```
58+
./build/bin/diffCheckApp.exe <-- for prototyping
59+
```
60+
61+
## Prototype diffCheck in C++
62+
To prototype:
63+
1) add a header/source file in `src/diffCheck` and include the header in `diffCheck.hh` interface
64+
1) test it in `diffCheckApp` (the cmake will output an executable in bin)
65+
66+
See the [CONTRIBUTING.md](https://github.com/diffCheckOrg/diffCheck/blob/main/CONTRIBUTING.md) for more information on how to prototype with diffCheck (code guidelines, visualizer, utilities, etc).
67+
68+
69+
## TODO:
70+
- [ ] @Andrea: add writing functions for mesh and point cloud
71+
- [ ] @Andrea: refactor `IOManager.hh` with a class `IOManager` and static methods
72+
- [ ] @Andrea: test Rhino exporeted `.ply` files

assets/img/gif_meshvisual.gif

1.67 MB
Loading

deps/fmt

src/diffCheck.cc

Lines changed: 0 additions & 90 deletions
This file was deleted.

src/diffCheck.hh

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,7 @@
66
#include <open3d/Open3D.h>
77

88
// diffCheck includes
9-
#include "diffCheck/libHeaderTemplate.hh" // This is a dummy include to test the include path
109
#include "diffCheck/geometry/DFPointCloud.hh"
10+
#include "diffCheck/geometry/DFMesh.hh"
1111
#include "diffCheck/IOManager.hh"
12-
#include "diffCheck/visualizer.hh"
13-
14-
15-
namespace diffCheck {
16-
/// @brief Function 1 of the library
17-
int func1();
18-
19-
/// @brief Function 2 of the library
20-
int func2();
21-
22-
/// @brief Function 3 of the library
23-
int func3();
24-
25-
/// @brief Testing open3d import
26-
void testOpen3d();
27-
} // namespace diffCheck
12+
#include "diffCheck/visualizer.hh"

src/diffCheck/IOManager.cc

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66

77
namespace diffCheck::io
88
{
9-
// TODO: return a dggeometry::Mesh object
10-
void ReadPLYMeshFromFile(const std::string &filename)
11-
{
12-
Eigen::MatrixXd V;
13-
Eigen::MatrixXi F;
14-
igl::readPLY(filename, V, F);
15-
}
16-
179
std::shared_ptr<diffCheck::geometry::DFPointCloud> ReadPLYPointCloud(const std::string &filename)
1810
{
1911
std::shared_ptr<diffCheck::geometry::DFPointCloud> pointCloud = std::make_shared<diffCheck::geometry::DFPointCloud>();
@@ -41,4 +33,39 @@ namespace diffCheck::io
4133
}
4234
return pointCloud;
4335
}
36+
37+
std::shared_ptr<diffCheck::geometry::DFMesh> ReadPLYMeshFromFile(const std::string &filename)
38+
{
39+
std::shared_ptr<diffCheck::geometry::DFMesh> mesh = std::make_shared<diffCheck::geometry::DFMesh>();
40+
Eigen::MatrixXd V;
41+
Eigen::MatrixXd C;
42+
Eigen::MatrixXd N;
43+
Eigen::MatrixXi F;
44+
45+
// read the ply file
46+
igl::readPLY(filename, V, F, C, N);
47+
48+
mesh->Vertices.resize(V.rows());
49+
for (int i = 0; i < V.rows(); i++)
50+
{
51+
mesh->Vertices[i] = V.row(i);
52+
}
53+
mesh->Faces.resize(F.rows());
54+
for (int i = 0; i < F.rows(); i++)
55+
{
56+
mesh->Faces[i] = F.row(i);
57+
}
58+
mesh->ColorsVertex.resize(C.rows());
59+
for (int i = 0; i < C.rows(); i++)
60+
{
61+
mesh->ColorsFace[i] = C.row(i);
62+
}
63+
mesh->NormalsVertex.resize(N.rows());
64+
for (int i = 0; i < N.rows(); i++)
65+
{
66+
mesh->NormalsFace[i] = N.row(i);
67+
}
68+
69+
return mesh;
70+
}
4471
} // namespace diffCheck::io

src/diffCheck/IOManager.hh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,24 @@
66
#include <igl/readPLY.h>
77

88
#include "diffCheck/geometry/DFPointCloud.hh"
9+
#include "diffCheck/geometry/DFMesh.hh"
910

1011
namespace diffCheck::io
1112
{
13+
// TODO: here we should add a class IOManager and the functions should be static
1214
/**
1315
* @brief Read a point cloud from a file
1416
*
1517
* @param filename the path to the file with the extension
18+
* @return std::shared_ptr<diffCheck::geometry::DFPointCloud> the point cloud
1619
*/
1720
std::shared_ptr<diffCheck::geometry::DFPointCloud> ReadPLYPointCloud(const std::string &filename);
1821

19-
// TODO: return a dggeometry::Mesh object
2022
/**
21-
* @brief Read mesh of format file
23+
* @brief Read mesh from ply format
2224
*
2325
* @param filename the path to the file with the extension
26+
* @return std::shared_ptr<diffCheck::geometry::DFMesh> the mesh
2427
*/
25-
void ReadPLYMeshFromFile(const std::string &filename);
28+
std::shared_ptr<diffCheck::geometry::DFMesh> ReadPLYMeshFromFile(const std::string &filename);
2629
} // namespace diffCheck::io

src/diffCheck/benchmark/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)