Skip to content

Commit

Permalink
init clean branch
Browse files Browse the repository at this point in the history
  • Loading branch information
nodtem66 committed Aug 27, 2020
0 parents commit d442022
Show file tree
Hide file tree
Showing 63 changed files with 8,735 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
out
.vs
CMakeSettings.json
diplib/lib
main_sources.cmake
14 changes: 14 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[submodule "external/diplib"]
path = external/diplib
url = https://github.com/DIPlib/diplib
[submodule "external/libigl"]
path = external/libigl
url = https://github.com/libigl/libigl.git
branch = dev
[submodule "external/vcglib"]
path = external/vcglib
url = https://github.com/cnr-isti-vclab/vcglib
branch = devel
[submodule "external/tbb"]
path = external/tbb
url = https://github.com/wjakob/tbb
39 changes: 39 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
language: cpp
os: linux
dist: xenial
branches:
only:
- master
- dev
jobs:
include:
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
env: COMPILER=g++-7 CPP_VER=11
- os: osx
osx_image: xcode10
env: COMPILER=g++-7 CPP_VER=11
before_install:
- brew update
- brew install gcc@7
- os: windows

install:
- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
- ${CXX} --version

before_script:
- mkdir -p -v build
- cd build
- cmake ..

script:
- cmake --build .

notifications:
email: off
60 changes: 60 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
cmake_minimum_required (VERSION 3.8)

project ("Scaffolder")

set(CGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# libigl
option(LIBIGL_WITH_OPENGL "Use OpenGL" OFF)
option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" OFF)

message(STATUS "PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}")

find_package(LIBIGL REQUIRED)
find_package(TBB REQUIRED)
find_package(VCG REQUIRED)
find_package(DIPlib REQUIRED)

# Add your project files
file(GLOB MAIN_SOURCES
"${PROJECT_SOURCE_DIR}/include/*.c"
"${PROJECT_SOURCE_DIR}/include/*.cpp"
"${PROJECT_SOURCE_DIR}/include/*.tpp"
"${PROJECT_SOURCE_DIR}/include/*.h"
"${PROJECT_SOURCE_DIR}/include/*.hpp"
"${PROJECT_SOURCE_DIR}/include/*/*.c"
"${PROJECT_SOURCE_DIR}/include/*/*.cpp"
"${PROJECT_SOURCE_DIR}/include/*/*.tpp"
"${PROJECT_SOURCE_DIR}/include/*/*.h"
"${PROJECT_SOURCE_DIR}/include/*/*.hpp"
"${PROJECT_SOURCE_DIR}/include/vcglib/*.h"
"${PROJECT_SOURCE_DIR}/include/vcglib/*/*.h"
"${PROJECT_SOURCE_DIR}/include/vcglib/*/*/*.h"
"${PROJECT_SOURCE_DIR}/include/vcglib/*/*/*/*.h"
"${VCG_INCLUDE_DIR}/wrap/ply/plylib.cpp"
)
include(update_deps_file)
update_deps_file("main_sources" "${MAIN_SOURCES}")

if(MSVC)
# Enable parallel compilation for Visual Studio
add_compile_options(/MP /bigobj)
add_definitions(-DNOMINMAX -D_USE_MATH_DEFINES)
endif()

add_definitions(-DDIP__IS_STATIC -DDIP__ENABLE_ASSERT -DDIP__HAS_JPEG -DDIP__EXCEPTIONS_RECORD_STACK_TRACE)
add_executable(${PROJECT_NAME} ${MAIN_SOURCES} ${PROJECT_SOURCE_DIR}/src/Main.cpp)
target_include_directories(${PROJECT_NAME} PRIVATE "${PROJECT_SOURCE_DIR}/include" ${TBB_INCLUDE_DIR} ${VCG_INCLUDE_DIR} ${DIPlib_INCLUDE_DIR} ${EIGEN_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} PRIVATE igl::core DIP tbb_static)

add_executable(SliceTest ${MAIN_SOURCES} ${PROJECT_SOURCE_DIR}/src/SliceTest.cpp)
target_include_directories(SliceTest PRIVATE "${PROJECT_SOURCE_DIR}/include" ${TBB_INCLUDE_DIR} ${VCG_INCLUDE_DIR} ${EIGEN_INCLUDE_DIR})
target_link_libraries(SliceTest PRIVATE tbb_static)

add_executable(Fixer ${MAIN_SOURCES} ${PROJECT_SOURCE_DIR}/src/FixSelfIntersect.cpp)
target_include_directories(Fixer PRIVATE "${PROJECT_SOURCE_DIR}/include" ${TBB_INCLUDE_DIR} ${VCG_INCLUDE_DIR} ${EIGEN_INCLUDE_DIR})
target_link_libraries(Fixer tbb_static)
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Jirawat I.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Scaffolder
[![Build Status](https://travis-ci.org/nodtem66/Scaffolder.svg?branch=master)](https://travis-ci.org/nodtem66/Scaffolder) [![Build Status](https://travis-ci.org/nodtem66/Scaffolder.svg?branch=dev)](https://travis-ci.org/nodtem66/Scaffolder) [![Build Status](https://dev.azure.com/n66/Public%20CI/_apis/build/status/nodtem66.Scaffolder?branchName=master)](https://dev.azure.com/n66/Public%20CI/_build/latest?definitionId=1&branchName=master) [![Build Status](https://dev.azure.com/n66/Public%20CI/_apis/build/status/nodtem66.Scaffolder?branchName=dev)](https://dev.azure.com/n66/Public%20CI/_build/latest?definitionId=1&branchName=dev)

Generate scaffold from STL file with implicit function (Schwarz P/ Gyroid).

```
Scaffolder - generate 3D scaffold from STL file
Usage:
Scaffolder [OPTION...] [option args]
-h, --help Print help
-q, --quiet Disable verbose output [default: false]
-m, --microstructure Analysis microstructure ( [default: false]
--m1 Export and analysis microstructure 1 (Image
processing technique) [default: false]
--m2 Export and analysis microstructure 2 (Slice
coutour technique) [default: false]
-f, --format arg Output format (OFF,PLY,STL,OBJ) [default:
ply]
-i, --input FILE Input file (STL)
-o, --output FILENAME Output filename without extension [default:
out]
-c, --coff DOUBLE default:4*PI
-s, --shell INT [default:0]
-n, --surface NAME rectlinear, schwarzp, schwarzd, gyroid,
double-p, double-d, double-gyroiod, lidinoid,
schoen_iwp, neovius, bcc, tubular_g_ab, tubular_g_c
[default: schwarzp]
-t, --thickness DOUBLE Thickness [default: 0]
-g, --grid_size INT Grid size [default: 100]
--grid_offset INT [default:3]
--smooth_step INT Smooth with laplacian (default: 5)
--method 0,1 Method of microstructure analysis: 0 (Image
processing technique) or 1 (Slice contour
technique) [default: 0]
--output_inverse additional output inverse scaffold
--inverse Enable build inverse 3D scaffold (for pore
connectivity analysis)
--dirty Disable autoclean
--fix_self_intersect Enable experimental fixing for self-intersect problems (default: false)
--qsim DOUBLE (0-1) % Quadric simplification for reducing the resolution of 3D mesh (default: false)
--minimum_diameter DOUBLE
used for removing small orphaned (between
0-1) [default: 0.25]
```

## Screenshots

** The figure of patterns implemented in this program

![TPMS Patterns](https://github.com/nodtem66/Scaffolder/raw/master/images/patterns.jpg)

** The examples of generated porous scaffold

![Examples porous scaffold](https://github.com/nodtem66/Scaffolder/raw/master/images/examples.jpg)

## Dependencies
- [libigl](https://libigl.github.io/)
- [vcglib](https://github.com/cnr-isti-vclab/vcglib)
- [diplib](https://github.com/DIPlib/diplib)

## How it works
- Read STL file and finding the boundary box
- Generate the grid and calculate the winding number with STL mesh
- Use winding number to determine the condition for [implicit isosurface function](https://wewanttolearn.wordpress.com/2019/02/03/triply-periodic-minimal-surfaces/)
- Generate the isosurface field in the same-size grid
- Perform [Dual marching cube](https://github.com/dominikwodniok/dualmc) to construct the manifold
- Clean up the duplicated vertices or faces, and abandon the group of connected faces having the diameter below the setting
- Export to the target 3D format

## Reference
- [dualmc](https://github.com/dominikwodniok/dualmc)
- [cxxopts](https://github.com/jarro2783/cxxopts)
- [ProgressBar](https://github.com/prakhar1989/progress-cpp)
- [Minimal surface Blog](https://minimalsurfaces.blog/)

## Citation

42 changes: 42 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- master
- dev

variables:
build_type: Debug
build_std: 11
CMAKE_BUILD_PARALLEL_LEVEL: 4

strategy:
matrix:
Linux14:
vmImage: 'ubuntu-latest'
macOS17:
vmImage: 'macOS-latest'
build_std: 17
macOS11:
vmImage: 'macOS-latest'
build_std: 11
Windows17:
vmImage: 'vs2017-win2016'
build_std: 17
Windows11:
vmImage: 'vs2017-win2016'
build_std: 11
pool:
vmImage: $(vmImage)
steps:
- checkout: self
submodules: true
- task: CMake@1
inputs:
cmakeArgs: .. -DCMAKE_CXX_STANDARD=$(build_std) -DCMAKE_BUILD_TYPE=$(build_type)
displayName: 'Configure'
- script: cmake --build .
displayName: 'Build'
workingDirectory: build
42 changes: 42 additions & 0 deletions cmake/FindDIPlib.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# - Try to find the DIPlib library
# Once done this will define
#
# DIPlib_FOUND - system has DIPlib
# DIPlib_INCLUDE_DIR - **the** DIPlib include directory
if(DIPlib_FOUND)
return()
endif()

find_path(DIPlib_INCLUDE_DIR diplib.h
HINTS
${DIPlib_DIR}
ENV DIPlib_DIR
PATHS
${PROJECT_SOURCE_DIR}/external/diplib
${PROJECT_SOURCE_DIR}/../external/diplib
${PROJECT_SOURCE_DIR}/../../external/diplib
PATH_SUFFIXES include
NO_DEFAULT_PATH
)
# TODO: Rewrite this cmake to add the source without compiled lib
set(DIPlib_LIB_DIR ${DIPlib_INCLUDE_DIR}/../lib)
set(DIPlib_ROOT_DIR ${DIPlib_INCLUDE_DIR}/../)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DIPlib
"\nDIPlib not found --- You can download it using:\n\tgit clone https://github.com/DIPlib/diplib ${CMAKE_SOURCE_DIR}/../diplib"
DIPlib_INCLUDE_DIR)
mark_as_advanced(DIPlib_INCLUDE_DIR)

set(DIP_BUILD_DIPIMAGE OFF CACHE INTERNAL "")
set(DIP_BUILD_JAVAIO OFF CACHE INTERNAL "")
set(DIP_BUILD_PYDIP OFF CACHE INTERNAL "")
set(DIP_SHARED_LIBRARY OFF CACHE INTERNAL "")
set(DIP_ENABLE_UNICODE OFF CACHE INTERNAL "")
set(DIP_ENABLE_DOCTEST OFF CACHE INTERNAL "")
set(DIP_ENABLE_STACK_TRACE OFF CACHE INTERNAL "")
#set(DIP_ENABLE_MULTITHREADING ON CACHE INTERNAL "")

list(APPEND CMAKE_MODULE_PATH "${DIPlib_ROOT_DIR}")
message(STATUS "USE DIR: ${DIPlib_ROOT_DIR}")
add_subdirectory(${DIPlib_ROOT_DIR})
34 changes: 34 additions & 0 deletions cmake/FindHighFive.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# - Try to find the HighFive library
# Once done this will define
#
# HighFive_FOUND - system has HighFive
# HighFive_INCLUDE_DIR - **the** HighFive include directory
if(HighFive_FOUND)
return()
endif()
find_path(HighFive_INCLUDE_DIR H5Easy.hpp
HINTS
${HighFive_DIR}
ENV HighFive_DIR
PATHS
${CMAKE_SOURCE_DIR}/HighFive
${CMAKE_SOURCE_DIR}/../HighFive
${CMAKE_SOURCE_DIR}/../../HighFive
${CMAKE_SOURCE_DIR}/../..
${CMAKE_SOURCE_DIR}/..
${CMAKE_SOURCE_DIR}
/usr
/usr/local
/usr/local/igl/HighFive
PATH_SUFFIXES include/highfive
)

# find_path(H5_INCLUDE_DIR H5Ppublic.h)
# LIST(APPEND HighFive_INCLUDE_DIR ${H5_INCLUDE_DIR})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HighFive
"\nHighFive not found --- You can download it using:\n\tgit clone https://github.com/BlueBrain/HighFive ${CMAKE_SOURCE_DIR}/../HighFive"
HighFive_INCLUDE_DIR)
mark_as_advanced(HighFive_INCLUDE_DIR)
message(STATUS "USE DIR: ${HighFive_INCLUDE_DIR}/")
34 changes: 34 additions & 0 deletions cmake/FindLIBIGL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# - Try to find the LIBIGL library
# Once done this will define
#
# LIBIGL_FOUND - system has LIBIGL
# LIBIGL_INCLUDE_DIR - **the** LIBIGL include directory
if(LIBIGL_FOUND)
return()
endif()
find_path(LIBIGL_INCLUDE_DIR igl/readOBJ.h
HINTS
${LIBIGL_DIR}
ENV LIBIGL_DIR
PATHS
${PROJECT_SOURCE_DIR}/external/libigl
${PROJECT_SOURCE_DIR}/../external/libigl
${PROJECT_SOURCE_DIR}/../../external/libigl
PATH_SUFFIXES include
NO_DEFAULT_PATH
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBIGL
"\nlibigl not found --- You can download it using:\n\tgit clone https://github.com/libigl/libigl.git ${CMAKE_SOURCE_DIR}/../libigl"
LIBIGL_INCLUDE_DIR)
mark_as_advanced(LIBIGL_INCLUDE_DIR)

set(LIBIGL_WITH_OPENGL OFF CACHE INTERNAL "turn off OPENGL in LIBIGL")
set(LIBIGL_WITH_OPENGL_GLFW OFF CACHE INTERNAL "turn off OPENGL GLFW in LIBIGL")
set(LIBIGL_USE_STATIC_LIBRARY OFF CACHE INTERNAL "prefer STATIC build")

list(APPEND CMAKE_MODULE_PATH "${LIBIGL_INCLUDE_DIR}/../cmake")
message(STATUS "USE DIR: ${LIBIGL_INCLUDE_DIR}")
set(EIGEN_INCLUDE_DIR "${LIBIGL_INCLUDE_DIR}/../external/eigen")
include(libigl)
Loading

0 comments on commit d442022

Please sign in to comment.