Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit 8dda64a

Browse files
committed
Merge commit '617b80e92eb4310791a722fd1cc20c902b17683f' into fix-bug
2 parents 2c29a4d + 617b80e commit 8dda64a

File tree

114 files changed

+2361208
-1088
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+2361208
-1088
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ tests/src/tests/config.hpp
265265
docs/_doxygen
266266

267267
notebooks/*.[ch]pp
268-
tests/data/cloth_ball_bf_ccd_candidated.json
268+
tests/data/cloth_ball_bf_ccd_candidates.json
269269
python/update_bindings.py
270270

271271
cmake-build-debug/

CMakeLists.txt

Lines changed: 23 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,21 @@ project(IPCToolkit
6363

6464
option(IPC_TOOLKIT_BUILD_TESTS "Build unit-tests" ${IPC_TOOLKIT_TOPLEVEL_PROJECT})
6565
option(IPC_TOOLKIT_BUILD_PYTHON "Build Python bindings" OFF)
66-
option(IPC_TOOLKIT_WITH_CORRECT_CCD "Use Tight Inclusion CCD" ON)
67-
option(IPC_TOOLKIT_WITH_SIMD "Enable SIMD" OFF)
6866
option(IPC_TOOLKIT_WITH_CUDA "Enable CUDA CCD" OFF)
6967
option(IPC_TOOLKIT_WITH_RATIONAL_INTERSECTION "Use rational edge-triangle intersection check" OFF)
7068
option(IPC_TOOLKIT_WITH_ROBIN_MAP "Use Tessil's robin-map rather than std maps" ON)
7169
option(IPC_TOOLKIT_WITH_ABSEIL "Use Abseil's hash functions" ON)
7270
option(IPC_TOOLKIT_WITH_FILIB "Use filib for interval arithmetic" ON)
71+
72+
# Advanced options
73+
option(IPC_TOOLKIT_WITH_INEXACT_CCD "Use the original inexact CCD method of IPC" OFF)
74+
option(IPC_TOOLKIT_WITH_SIMD "Enable SIMD" OFF)
7375
option(IPC_TOOLKIT_WITH_CODE_COVERAGE "Enable coverage reporting" OFF)
7476
option(IPC_TOOLKIT_WITH_AUTODIFF "Enable AutoDiff for computing derivatives" OFF)
75-
mark_as_advanced(IPC_TOOLKIT_WITH_CODE_COVERAGE)
77+
78+
mark_as_advanced(IPC_TOOLKIT_WITH_INEXACT_CCD) # This is only for comparison purposes
79+
mark_as_advanced(IPC_TOOLKIT_WITH_SIMD) # This does not work reliably
80+
mark_as_advanced(IPC_TOOLKIT_WITH_CODE_COVERAGE) # This is used in GitHub Actions
7681

7782
# Set default minimum C++ standard
7883
if(IPC_TOOLKIT_TOPLEVEL_PROJECT)
@@ -126,14 +131,13 @@ target_compile_definitions(ipc_toolkit PUBLIC NOMINMAX)
126131
# Dependencies
127132
################################################################################
128133

129-
# libigl
134+
# Eigen
130135
include(eigen)
136+
target_link_libraries(ipc_toolkit PUBLIC Eigen3::Eigen)
137+
138+
# libigl
131139
include(libigl)
132-
target_link_libraries(ipc_toolkit PUBLIC
133-
Eigen3::Eigen
134-
igl::core
135-
igl::predicates
136-
)
140+
target_link_libraries(ipc_toolkit PUBLIC igl::core igl::predicates)
137141

138142
# autodiff
139143
include(autodiff)
@@ -142,12 +146,16 @@ include(autodiff)
142146
include(onetbb)
143147
target_link_libraries(ipc_toolkit PUBLIC TBB::tbb)
144148

149+
# Provably conservative CCD of [Wang and Ferguson et al. 2021]
150+
include(tight_inclusion)
151+
target_link_libraries(ipc_toolkit PUBLIC tight_inclusion::tight_inclusion)
152+
153+
# Scalable CCD (STQ broad phase and GPU Tight Inclusion)
154+
include(scalable_ccd)
155+
target_link_libraries(ipc_toolkit PUBLIC scalable_ccd::scalable_ccd)
156+
145157
# CCD
146-
if(IPC_TOOLKIT_WITH_CORRECT_CCD)
147-
# Provably conservative CCD of [Wang and Ferguson et al. 2021]
148-
include(tight_inclusion)
149-
target_link_libraries(ipc_toolkit PUBLIC tight_inclusion::tight_inclusion)
150-
else()
158+
if(IPC_TOOLKIT_WITH_INEXACT_CCD)
151159
# Etienne Vouga's CTCD Library for the floating point root finding algorithm
152160
include(evouga_ccd)
153161
target_link_libraries(ipc_toolkit PUBLIC evouga::ccd)
@@ -167,17 +175,6 @@ if(IPC_TOOLKIT_WITH_RATIONAL_INTERSECTION)
167175
target_link_libraries(ipc_toolkit PUBLIC rational::rational)
168176
endif()
169177

170-
# Sweep and Tiniest Queue and CCD
171-
if(IPC_TOOLKIT_WITH_CUDA)
172-
include(gpu_ccd)
173-
target_link_libraries(ipc_toolkit PUBLIC gpu_ccd::gpu_ccd)
174-
target_link_libraries(ipc_toolkit PUBLIC STQ::CPU)
175-
else()
176-
set(STQ_WITH_CUDA OFF CACHE BOOL "Enable CUDA Implementation" FORCE)
177-
include(sweep_and_tiniest_queue)
178-
target_link_libraries(ipc_toolkit PUBLIC STQ::CPU)
179-
endif()
180-
181178
# Faster unordered map
182179
if(IPC_TOOLKIT_WITH_ROBIN_MAP)
183180
include(robin_map)
@@ -239,27 +236,15 @@ if(IPC_TOOLKIT_WITH_CUDA)
239236

240237
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24.0")
241238
set(CMAKE_CUDA_ARCHITECTURES "native")
242-
set_target_properties(ipc_toolkit PROPERTIES CUDA_ARCHITECTURES "native")
243239
else()
244240
include(FindCUDA/select_compute_arch)
245241
CUDA_DETECT_INSTALLED_GPUS(CUDA_ARCH_LIST)
246242
string(STRIP "${CUDA_ARCH_LIST}" CUDA_ARCH_LIST)
247243
string(REPLACE " " ";" CUDA_ARCH_LIST "${CUDA_ARCH_LIST}")
248244
string(REPLACE "." "" CUDA_ARCH_LIST "${CUDA_ARCH_LIST}")
249245
set(CMAKE_CUDA_ARCHITECTURES ${CUDA_ARCH_LIST})
250-
set_target_properties(ipc_toolkit PROPERTIES CUDA_ARCHITECTURES "${CUDA_ARCH_LIST}")
251-
endif()
252-
253-
if(APPLE)
254-
# We need to add the path to the driver (libcuda.dylib) as an rpath,
255-
# so that the static cuda runtime can find it at runtime.
256-
set_property(TARGET ipc_toolkit
257-
PROPERTY
258-
BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
259246
endif()
260-
261-
find_package(CUDAToolkit)
262-
target_link_libraries(ipc_toolkit PRIVATE CUDA::cudart)
247+
set_target_properties(scalable_ccd PROPERTIES CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES}")
263248
endif()
264249

265250
################################################################################

IPCToolkitOptions.cmake.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030

3131
# option(IPC_TOOLKIT_BUILD_TESTS "Build unit-tests" ON)
3232
# option(IPC_TOOLKIT_BUILD_PYTHON "Build Python bindings" OFF)
33-
# option(IPC_TOOLKIT_WITH_CORRECT_CCD "Use Tight Inclusion CCD" ON)
34-
# option(IPC_TOOLKIT_WITH_SIMD "Enable SIMD" OFF)
3533
# option(IPC_TOOLKIT_WITH_CUDA "Enable CUDA CCD" OFF)
3634
# option(IPC_TOOLKIT_WITH_RATIONAL_INTERSECTION "Use rational edge-triangle intersection check" OFF)
3735
# option(IPC_TOOLKIT_WITH_ROBIN_MAP "Use Tessil's robin-map rather than std maps" ON)
3836
# option(IPC_TOOLKIT_WITH_ABSEIL "Use Abseil's hash functions" ON)
3937
# option(IPC_TOOLKIT_WITH_FILIB "Use filib for interval arithmetic" ON)
38+
# option(IPC_TOOLKIT_WITH_INEXACT_CCD "Use the original inexact CCD method of IPC" OFF)
39+
# option(IPC_TOOLKIT_WITH_SIMD "Enable SIMD" OFF)
4040
# option(IPC_TOOLKIT_WITH_CODE_COVERAGE "Enable coverage reporting" OFF)
4141
# option(IPC_TOOLKIT_TESTS_CCD_BENCHMARK "Enable CCD benchmark test" ON)
4242
# set(IPC_TOOLKIT_TESTS_CCD_BENCHMARK_DIR "" CACHE PATH "Path to the CCD benchmark directory")

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ IPC Toolkit is a set of reusable functions to integrate Incremental Potential Co
1717
### Features
1818

1919
* IPC barrier function and its derivatives and adaptive barrier stiffness algorithm
20-
* Broad-phase and narrow-phase continuous collision detection (CCD)
20+
* Broad- and narrow-phase continuous collision detection (CCD) of linear and nonlinear trajectories
2121
* Distance computation and derivatives between edges in 2D and triangles in 3D
2222
* Distance barrier potential and its derivatives
2323
* Smooth and lagged dissipative friction potential and its derivatives
@@ -32,7 +32,7 @@ This is not a full simulation library. As such it does not include any physics o
3232

3333
The easiest way to add the toolkit to an existing CMake project is to download it through CMake.
3434
CMake provides functionality for doing this called [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) (requires CMake ≥ 3.14).
35-
We use this same process to download all external dependencies.
35+
We use a very similar process to download all external dependencies (using [CPM](https://github.com/cpm-cmake/CPM.cmake)).
3636

3737
For example,
3838

@@ -66,12 +66,15 @@ The following libraries are used in this project:
6666
* [Eigen](https://eigen.tuxfamily.org/): linear algebra
6767
* [libigl](https://github.com/libigl/libigl): basic geometry functions and predicates
6868
* [oneTBB](https://github.com/oneapi-src/oneTBB): parallelism
69-
* [Tight-Inclusion](https://github.com/Continuous-Collision-Detection/Tight-Inclusion): correct (conservative) CCD
69+
* [Tight-Inclusion](https://github.com/Continuous-Collision-Detection/Tight-Inclusion): provably conservative CCD of [Wang and Ferguson et al. 2021]
7070
* [SimpleBVH](https://github.com/ipc-sim/SimpleBVH): a simple bounding volume hierarchy data structure
71+
* [Scalable-CCD](https://github.com/Continuous-Collision-Detection/Scalable-CCD): scalable (GPU) CCD of [Belgrod et al. 2023]
7172
* [spdlog](https://github.com/gabime/spdlog): logging information
7273

7374
#### Optional
7475

76+
The following dependencies are optionally used based on CMake options:
77+
7578
* [robin-map](https://github.com/Tessil/robin-map): faster hash set/map than `std::unordered_set`/`std::unordered_map`
7679
* Enable by using the CMake option `IPC_TOOLKIT_WITH_ROBIN_MAP`
7780
* Enabled by default
@@ -86,7 +89,7 @@ The following libraries are used in this project:
8689
* Requires [GMP](https://gmplib.org/) to be installed at a system level
8790
* [Etienne Vouga's Collision Detection Library](https://github.com/evouga/collisiondetection): inexact CCD
8891
* Included for comparison with the original IPC library
89-
* Enable by disabling the CMake option `IPC_TOOLKIT_WITH_CORRECT_CCD`
92+
* Enable by using the CMake option `IPC_TOOLKIT_WITH_INEXACT_CCD`
9093
* Replaces the default Tight-Inclusion CCD
9194

9295
## Usage
@@ -96,11 +99,11 @@ See the [tutorial](https://ipctk.xyz/tutorial/getting_started.html) for a quick
9699
## Unit Tests
97100

98101
We provide unit tests to ensure the correctness of our algorithmic pieces.
99-
To enable the unit tests use the CMake option `IPC_TOOLKIT_BUILD_UNIT_TESTS`.
102+
To enable the unit tests use the CMake option `IPC_TOOLKIT_BUILD_TESTS`.
100103

101104
### Dependencies
102105

103-
The following are downloaded when unit tests are enabled (`IPC_TOOLKIT_BUILD_TESTS`)
106+
The following are downloaded when unit tests are enabled:
104107

105108
* [Catch2](https://github.com/catchorg/Catch2.git): testing framework
106109
* [finite-diff](https://github.com/zfergus/finite-diff): finite-difference comparisons

cmake/ipc_toolkit/ipc_toolkit_warnings.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ set(IPC_TOOLKIT_WARNING_FLAGS
4545
-Werror=int-to-pointer-cast
4646
-Werror=pointer-to-int-cast
4747
-Werror=inconsistent-missing-override
48+
-Werror=return-stack-address
4849

4950
-Wunused-variable
5051
-Wunused-but-set-variable

cmake/recipes/eigen.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ CPMAddPackage(
1515
NAME eigen
1616
GITLAB_REPOSITORY libeigen/eigen
1717
GIT_TAG 3.4.0
18-
DOWNLOAD_ONLY ON
18+
DOWNLOAD_ONLY YES
1919
)
2020

2121
add_library(Eigen3_Eigen INTERFACE)

cmake/recipes/evouga_ccd.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ message(STATUS "Third-party: creating target 'evouga::ccd'")
88

99
include(CPM)
1010
CPMAddPackage(
11-
evccd
12-
GIT_REPOSITORY https://github.com/evouga/collisiondetection.git
11+
NAME evccd
12+
GITHUB_REPOSITORY evouga/collisiondetection
1313
GIT_TAG e5fe5c9767207df5047e375fb20180a665ae186f
14-
DOWNLOAD_ONLY ON
14+
DOWNLOAD_ONLY YES
1515
)
1616

1717
# file(GLOB EVOUGA_CCD_SOURCE_FILES "${evccd_SOURCE_DIR}/src/*.cpp")
1818
add_library(evouga_ccd
19-
"${collisiondetection_SOURCE_DIR}/src/CTCD.cpp"
19+
"${evccd_SOURCE_DIR}/src/CTCD.cpp"
2020
)
2121
add_library(evouga::ccd ALIAS evouga_ccd)
2222

23-
target_include_directories(evouga_ccd PUBLIC "${collisiondetection_SOURCE_DIR}/include")
23+
target_include_directories(evouga_ccd PUBLIC "${evccd_SOURCE_DIR}/include")
2424

2525
include(eigen)
2626
target_link_libraries(evouga_ccd PUBLIC Eigen3::Eigen)

cmake/recipes/gpu_ccd.cmake

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

cmake/recipes/json.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ CPMAddPackage(
1414
NAME nlohmann_json
1515
URL "https://github.com/nlohmann/json/releases/download/${NLOHMANNJSON_VERSION}/include.zip"
1616
URL_HASH SHA256=e5c7a9f49a16814be27e4ed0ee900ecd0092bfb7dbfca65b5a421b774dccaaed
17+
DOWNLOAD_ONLY YES
1718
)
1819

1920
add_library(nlohmann_json INTERFACE)
2021
add_library(nlohmann_json::nlohmann_json ALIAS nlohmann_json)
2122

2223
include(GNUInstallDirs)
23-
target_include_directories(nlohmann_json INTERFACE
24+
target_include_directories(nlohmann_json SYSTEM INTERFACE
2425
"$<BUILD_INTERFACE:${nlohmann_json_SOURCE_DIR}>/include"
2526
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
2627
)

cmake/recipes/scalable_ccd.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Scalable-CCD (https://github.com/continuous-collision-detection/scalable-ccd)
2+
# License: Apache 2.0
3+
if(TARGET scalable_ccd::scalable_ccd)
4+
return()
5+
endif()
6+
7+
message(STATUS "Third-party: creating target 'scalable_ccd::scalable_ccd'")
8+
9+
set(SCALABLE_CCD_WITH_CUDA ${IPC_TOOLKIT_WITH_CUDA} CACHE BOOL "Enable CUDA CCD" FORCE)
10+
11+
include(CPM)
12+
CPMAddPackage("gh:continuous-collision-detection/scalable-ccd#60692d7cbc03390a3a198792a3ff2b869c5da05b")

0 commit comments

Comments
 (0)