fix typo
This commit is contained in:
committed by
Tarik Moussa
parent
5be43c90bc
commit
e1a90dbd85
12
README.md
12
README.md
@@ -29,19 +29,17 @@ API, file formats and command‑line interface are all subject to change.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://codeberg.org/user2595/ConformalLabpp
|
git clone https://codeberg.org/user2595/ConformalLabpp
|
||||||
cd conformallabpp
|
cd conformallabpp/code
|
||||||
git submodule update --init --recursive
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configure and build
|
### Configure and build
|
||||||
```bash
|
```bash
|
||||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
cmake -S . -B build && cmake --build build
|
||||||
cmake --build build
|
|
||||||
Run a simple example
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Run the binare
|
||||||
```bash
|
```bash
|
||||||
# ./build/bin/conformallabpp
|
./bin/conformallab_core --input ./data/off/simple_cupe.off
|
||||||
(Example command, to be adapted once the first tools are implemented.)
|
|
||||||
```
|
```
|
||||||
### License
|
### License
|
||||||
conformallabpp is released under the MIT License (see LICENSE).
|
conformallabpp is released under the MIT License (see LICENSE).
|
||||||
|
|||||||
8
code/.gitignore
vendored
8
code/.gitignore
vendored
@@ -8,12 +8,14 @@ build/
|
|||||||
# Dependencies: Tarballs immer committen, entpackte ignorieren
|
# Dependencies: Tarballs immer committen, entpackte ignorieren
|
||||||
|
|
||||||
# exclude alle subdirs von depd without excluding the tarballs and single_includes
|
# exclude alle subdirs von depd without excluding the tarballs and single_includes
|
||||||
deps/*/*/
|
deps/*
|
||||||
!deps/tarballs/*.tar.*
|
!deps/tarballs
|
||||||
!deps/single_includes/
|
!deps/single_includes/
|
||||||
!deps/Cmakelists.txt
|
!deps/CMakeLists.txt
|
||||||
|
|
||||||
|
|
||||||
|
bin
|
||||||
|
|
||||||
# IDEs
|
# IDEs
|
||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.20)
|
|||||||
|
|
||||||
set(PROJECT_NAME "conformallab_core")
|
set(PROJECT_NAME "conformallab_core")
|
||||||
|
|
||||||
project(${PROJECT_NAME} LANGUAGES CXX)
|
project(${PROJECT_NAME} LANGUAGES C CXX)
|
||||||
|
|
||||||
message(STATUS "Configuring ${PROJECT_NAME}...")
|
message(STATUS "Configuring ${PROJECT_NAME}...")
|
||||||
|
|
||||||
@@ -32,8 +32,11 @@ endif()
|
|||||||
|
|
||||||
add_subdirectory(deps)
|
add_subdirectory(deps)
|
||||||
|
|
||||||
|
add_subdirectory(deps/glfw-3.4)
|
||||||
|
|
||||||
|
|
||||||
# --------- Executable ---------
|
# --------- Executable ---------
|
||||||
add_executable(${PROJECT_NAME} src/apps/conformallab_cli.cpp src/apps/unwarp_job.cpp)
|
add_executable(${PROJECT_NAME} src/apps/v0/conformallab_cli.cpp )
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
@@ -42,9 +45,28 @@ target_include_directories(${PROJECT_NAME} PRIVATE
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/deps/CGAL-6.1.1/include
|
${CMAKE_CURRENT_SOURCE_DIR}/deps/CGAL-6.1.1/include
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/deps/boost_1_90_0/
|
${CMAKE_CURRENT_SOURCE_DIR}/deps/boost_1_90_0/
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/deps/libigl-2.6.0/include
|
${CMAKE_CURRENT_SOURCE_DIR}/deps/libigl-2.6.0/include
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/deps/libigl-glad/include
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
add_library(glad STATIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/deps/libigl-glad/src/glad.c
|
||||||
|
)
|
||||||
|
target_include_directories(glad PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/deps/libigl-glad/include
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||||
|
CGAL_DISABLE_GMP
|
||||||
|
CGAL_DISABLE_MPFR
|
||||||
)
|
)
|
||||||
|
|
||||||
# Output-Ordner
|
# Output-Ordner
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin
|
||||||
|
|
||||||
)
|
)
|
||||||
|
target_link_libraries(${PROJECT_NAME}
|
||||||
|
PRIVATE glad glfw
|
||||||
|
)
|
||||||
|
|
||||||
|
|||||||
16
code/data/off/simple_cupe.off
Normal file
16
code/data/off/simple_cupe.off
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
OFF
|
||||||
|
8 6 0
|
||||||
|
-0.500000 -0.500000 0.500000
|
||||||
|
0.500000 -0.500000 0.500000
|
||||||
|
-0.500000 0.500000 0.500000
|
||||||
|
0.500000 0.500000 0.500000
|
||||||
|
-0.500000 0.500000 -0.500000
|
||||||
|
0.500000 0.500000 -0.500000
|
||||||
|
-0.500000 -0.500000 -0.500000
|
||||||
|
0.500000 -0.500000 -0.500000
|
||||||
|
4 0 1 3 2
|
||||||
|
4 2 3 5 4
|
||||||
|
4 4 5 7 6
|
||||||
|
4 6 7 1 0
|
||||||
|
4 1 7 5 3
|
||||||
|
4 6 0 2 4
|
||||||
@@ -7,13 +7,21 @@ function(setup_dependency NAME SUBDIR)
|
|||||||
if(NOT TARBALL)
|
if(NOT TARBALL)
|
||||||
message(FATAL_ERROR "❌ No '${NAME}*.tar.*' in deps/tarballs/")
|
message(FATAL_ERROR "❌ No '${NAME}*.tar.*' in deps/tarballs/")
|
||||||
else()
|
else()
|
||||||
|
message(STATUS "${CMAKE_COMMAND} ${TARBALL}" )
|
||||||
message(STATUS "${CMAKE_COMMAND} ${TARBALL}" )
|
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E tar xf "${TARBALL}" "${NAME}/${SUBDIR}" RESULT_VARIABLE TAR_STATUS WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" )
|
if(SUBDIR STREQUAL "")
|
||||||
message(STATUS "Extracting ${NAME}... Output: ${TAR_OUTPUT} Status: ${TAR_STATUS}")
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E tar xf "${TARBALL}" RESULT_VARIABLE TAR_STATUS WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" )
|
||||||
if(NOT TAR_STATUS EQUAL 0)
|
message(STATUS "Extracting ${NAME}... Output: ${TAR_OUTPUT} Status: ${TAR_STATUS}")
|
||||||
message(FATAL_ERROR "❌ Extract failed: ${NAME}")
|
if(NOT TAR_STATUS EQUAL 0)
|
||||||
endif()
|
message(FATAL_ERROR "❌ Extract failed: ${NAME}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E tar xf "${TARBALL}" "${NAME}/${SUBDIR}" RESULT_VARIABLE TAR_STATUS WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" )
|
||||||
|
message(STATUS "Extracting ${NAME}... Output: ${TAR_OUTPUT} Status: ${TAR_STATUS}")
|
||||||
|
if(NOT TAR_STATUS EQUAL 0)
|
||||||
|
message(FATAL_ERROR "❌ Extract failed: ${NAME}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(STATUS "✅ ${NAME} already exists, skipping extraction.")
|
message(STATUS "✅ ${NAME} already exists, skipping extraction.")
|
||||||
@@ -24,5 +32,6 @@ setup_dependency("CGAL-6.1.1" "include" )
|
|||||||
setup_dependency("eigen-3.4.0" "Eigen" )
|
setup_dependency("eigen-3.4.0" "Eigen" )
|
||||||
setup_dependency("boost_1_90_0" "boost" )
|
setup_dependency("boost_1_90_0" "boost" )
|
||||||
setup_dependency("libigl-2.6.0" "include" )
|
setup_dependency("libigl-2.6.0" "include" )
|
||||||
|
setup_dependency("libigl-glad" "" )
|
||||||
|
setup_dependency("glfw-3.4" "" )
|
||||||
|
|
||||||
|
|||||||
BIN
code/deps/tarballs/glfw-3.4.tar.gz
Normal file
BIN
code/deps/tarballs/glfw-3.4.tar.gz
Normal file
Binary file not shown.
BIN
code/deps/tarballs/libigl-glad.tar.gz
Normal file
BIN
code/deps/tarballs/libigl-glad.tar.gz
Normal file
Binary file not shown.
93
code/src/apps/v0/conformallab_cli.cpp
Normal file
93
code/src/apps/v0/conformallab_cli.cpp
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
#include <CGAL/Simple_cartesian.h>
|
||||||
|
#include <CGAL/Surface_mesh.h>
|
||||||
|
#include <CGAL/IO/polygon_mesh_io.h>
|
||||||
|
|
||||||
|
#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
|
||||||
|
|
||||||
|
#include <CLI11.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <igl/opengl/glfw/Viewer.h>
|
||||||
|
#include <Eigen/Core>
|
||||||
|
|
||||||
|
|
||||||
|
using Kernel = CGAL::Simple_cartesian<double>;
|
||||||
|
using Point = Kernel::Point_3;
|
||||||
|
using Mesh = CGAL::Surface_mesh<Point>;
|
||||||
|
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
CLI::App app{"demo of conformallab"};
|
||||||
|
std::string input_file;
|
||||||
|
std::string output_file; // default output file name
|
||||||
|
|
||||||
|
app.add_option("-i,--input", input_file, "Input OFF file")->required();
|
||||||
|
app.add_option("-o,--output", output_file, "Output OFF file (optional)");
|
||||||
|
CLI11_PARSE(app, argc, argv);
|
||||||
|
|
||||||
|
if (input_file.empty()) {
|
||||||
|
std::cerr << "Input file is required.\n";
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input_file.substr(input_file.find_last_of('.') + 1) != "off") {
|
||||||
|
std::cerr << "Unsupported file format. Please provide an OFF file.\n";
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Mesh surface_mesh;
|
||||||
|
if (!CGAL::IO::read_polygon_mesh(input_file, surface_mesh) || surface_mesh.is_empty()) {
|
||||||
|
std::cerr << "Invalid input file: " << input_file << "\n";
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// #TODO: later: here we would call the unwrapping code, e.g.:
|
||||||
|
// UnwrapSettings settings;
|
||||||
|
// settings.target_geometry = TargetGeometry::Euclidean;
|
||||||
|
// UnwrapJob job(surface_mesh, settings);
|
||||||
|
// auto result = job.run();
|
||||||
|
// Mesh unwrapped = result.surface_unwrapped;
|
||||||
|
|
||||||
|
|
||||||
|
// CGAL -> libigl
|
||||||
|
PMP::triangulate_faces(surface_mesh);
|
||||||
|
//todo : we should check if the mesh is already triangulated, and only call this if it isn't, to avoid unnecessary processing. CGAL::Polygon_mesh_processing::is_triangulated() can be used for this check.
|
||||||
|
Eigen::MatrixXd Vertices;
|
||||||
|
Eigen::MatrixXi Faces;
|
||||||
|
Vertices.resize(surface_mesh.number_of_vertices(), 3);
|
||||||
|
Faces.resize(surface_mesh.number_of_faces(), 3);
|
||||||
|
|
||||||
|
for (auto v : surface_mesh.vertices()) {
|
||||||
|
const auto& p = surface_mesh.point(v);
|
||||||
|
Vertices(v.idx(), 0) = p.x();
|
||||||
|
Vertices(v.idx(), 1) = p.y();
|
||||||
|
Vertices(v.idx(), 2) = p.z();
|
||||||
|
}
|
||||||
|
|
||||||
|
int f_i = 0;
|
||||||
|
for (auto f : surface_mesh.faces()) {
|
||||||
|
int k = 0;
|
||||||
|
for (auto hv : CGAL::halfedges_around_face(surface_mesh.halfedge(f), surface_mesh)) {
|
||||||
|
auto v = surface_mesh.target(hv);
|
||||||
|
Faces(f_i, k) = v.idx();
|
||||||
|
++k;
|
||||||
|
}
|
||||||
|
++f_i;
|
||||||
|
}
|
||||||
|
|
||||||
|
igl::opengl::glfw::Viewer viewer;
|
||||||
|
viewer.data().set_mesh(Vertices, Faces);
|
||||||
|
viewer.launch();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// for now, we just write the input mesh to the output file as a placeholder
|
||||||
|
if (!output_file.empty() && !CGAL::IO::write_polygon_mesh(output_file, surface_mesh)) {
|
||||||
|
std::cerr << "Failed to write output file: " << output_file << "\n";
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user