Skip to content

Commit 5489f06

Browse files
committed
ADD: boost and cgal integrated
1 parent e036847 commit 5489f06

9 files changed

+39
-115
lines changed

CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ else()
6363
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
6464
endif()
6565

66-
add_external_package(Open3D 0.18.0 REQUIRED)
66+
find_package(Open3D 0.18.0 REQUIRED)
6767

6868
# print the version debug or release of the package
6969
message(STATUS "Open3D version: ${Open3D_VERSION}"
@@ -85,23 +85,23 @@ if(WIN32)
8585
endif()
8686
endif()
8787

88-
# Boost (header-only) -----------------------------------------------------
89-
# download_submodule_project(boost)
90-
# add_subdirectory(deps/boost)
91-
# target_include_directories(${SHARED_LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/deps/boost/include)
88+
# Boost (from system) -----------------------------------------------------
89+
# download and install from https://sourceforge.net/projects/boost/files/boost-binaries/1.84.0/boost_1_84_0-msvc-14.3-64.exe/download
90+
find_package(Boost REQUIRED)
9291

93-
# CGAL (header-only) ------------------------------------------------------
94-
# download_submodule_project(cgal)
95-
# add_subdirectory(deps/cgal)
96-
# target_include_directories(${SHARED_LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/deps/cgal/include)
92+
# print boost include dir
93+
message(STATUS "Boost include dir: ${Boost_INCLUDE_DIRS}")
94+
95+
target_include_directories(${SHARED_LIB_NAME} PUBLIC ${Boost_INCLUDE_DIRS})
9796

97+
# CGAL (header-only) ------------------------------------------------------
98+
target_include_directories(${SHARED_LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/deps/cgal/include)
9899

99100
#--------------------------------------------------------------------------
100101
# executable for prototyping
101102
#--------------------------------------------------------------------------
102103
set(APP_NAME_EXE diffCheckApp)
103104

104-
105105
add_executable(${APP_NAME_EXE} src/diffCheckApp.cc)
106106

107107
set_target_properties(${APP_NAME_EXE} PROPERTIES

ScreenCamera_2024-03-28-11-19-34.json

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

ScreenCamera_2024-03-28-11-53-35.json

Lines changed: 0 additions & 41 deletions
This file was deleted.
-72 KB
Binary file not shown.
-31.2 KB
Binary file not shown.

cmake/install_open3d.bat

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,16 @@ if not exist "%targetDir%" (
4444

4545
:: Download the file
4646
echo Downloading Open3D...
47-
curl -L -o "%targetDir%\open3d.zip" "%url%"
48-
49-
:: wait for the file to be completely downloaded
50-
ping -n 5
51-
52-
:: check if the file was downloaded
53-
if not exist "%targetDir%\open3d.zip" (
54-
echo Failed to download Open3D.
55-
exit /b 1
47+
curl -L -o "%filePath%" "%url%"
48+
49+
:: check if the file was downloaded if not wait
50+
:wait
51+
if not exist "%filePath%" (
52+
echo Waiting for download to complete...
53+
timeout /t 5 /nobreak >nul
54+
goto wait
5655
)
57-
56+
echo File downloaded.
5857

5958
:: Extract the file
6059
echo Extracting Open3D...

src/diffCheck.hh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#pragma once
22

33

4-
// // include CGAL
5-
// #include <CGAL/IO/PLY/PLY_reader.h>
4+
// include CGAL
65

76
#include <open3d/Open3D.h>
87

src/diffCheck/IOManager.cc

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
#include <open3d/Open3D.h>
44

5+
#include <CGAL/Simple_cartesian.h>
6+
#include <CGAL/Polyhedron_3.h>
7+
#include <CGAL/IO/PLY/PLY_reader.h>
8+
9+
typedef CGAL::Simple_cartesian<double> Kernel;
10+
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
11+
512

613
namespace diffCheck::io
714
{
@@ -15,29 +22,26 @@ namespace diffCheck::io
1522

1623
std::shared_ptr<diffCheck::geometry::DFMesh> ReadPLYMeshFromFile(const std::string &filename)
1724
{
18-
std::shared_ptr<open3d::geometry::TriangleMesh> open3dMesh = open3d::io::CreateMeshFromFile(filename);
1925
std::shared_ptr<diffCheck::geometry::DFMesh> mesh = std::make_shared<diffCheck::geometry::DFMesh>();
26+
std::shared_ptr<open3d::geometry::TriangleMesh> open3dMesh = open3d::io::CreateMeshFromFile(filename);
2027
mesh->Cvt2DFMesh(open3dMesh);
21-
return mesh;
22-
23-
// FIXME: test if the variable length in open3d is working
24-
// // check if the ply is from Rhino by searching for the string "Rhinoceros"
28+
29+
// bool isFromRhino = false;
2530
// std::ifstream file(filename);
2631
// std::string line;
27-
// bool isRhino = false;
2832
// while (std::getline(file, line))
2933
// {
30-
// if (line.find("Rhinoceros") != std::string::npos)
34+
// if (line.find("Rhinoeros") != std::string::npos)
3135
// {
32-
// isRhino = true;
36+
// isFromRhino = true;
3337
// break;
3438
// }
3539
// }
3640
// file.close();
37-
// std::cout << "isRhino: " << isRhino << std::endl;
41+
// std::cout << "isFromRhino: " << isFromRhino << std::endl;
42+
3843

39-
// // detect if the ply is of fixed variable lengths or not
40-
// bool isFixedLength = false;
44+
// bool isFixedLength = false; // aka Rhino quad/tri exported mesh
4145
// std::ifstream file2(filename);
4246
// std::string line2;
4347
// while (std::getline(file2, line2))
@@ -50,5 +54,7 @@ namespace diffCheck::io
5054
// }
5155
// file2.close();
5256
// std::cout << "isFixedLength: " << isFixedLength << std::endl;
57+
58+
return mesh;
5359
}
5460
} // namespace diffCheck::io

src/diffCheckApp.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ int main()
1616

1717
std::string pathCloud = R"(C:\Users\andre\Downloads\scan_data_normals.ply\scan_data_normals.ply)";
1818
std::string pathMesh = R"(F:\diffCheck\assets\dataset\mesh_fromRh_unfixedLength.ply)";
19+
// std::string pathMesh = R"(F:\diffCheck\temp\03_mesh.ply)";
20+
1921

2022
dfMeshPtr->LoadFromPLY(pathMesh);
2123
// dfPointCloudPtr->LoadFromPLY(pathCloud);

0 commit comments

Comments
 (0)