Skip to content

Commit b28db4b

Browse files
authored
Polymorphic CCD (#110)
* Implement polymorphic CCD choice * Fix compilation * Fix inexact CCD * Update Python bindings * Make CCD strategies private * Update GitHub Actions dependencies
1 parent 805aa76 commit b28db4b

Some content is hidden

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

70 files changed

+1545
-1295
lines changed

.github/workflows/continuous.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ jobs:
6161
uses: seanmiddleditch/gha-setup-ninja@master
6262

6363
- name: Get number of CPU cores
64-
uses: SimenB/github-actions-cpu-cores@v1
64+
uses: SimenB/github-actions-cpu-cores@v2.0.0
6565
id: cpu-cores
6666

6767
- name: Cache Build
6868
id: cache-build
69-
uses: actions/cache@v3.0.11
69+
uses: actions/cache@v4.0.2
7070
with:
7171
path: ${{ env.CACHE_PATH }}
7272
key: ${{ runner.os }}-${{ matrix.config }}-cache

.github/workflows/coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
3131
- name: Cache Build
3232
id: cache-build
33-
uses: actions/cache@v3.0.11
33+
uses: actions/cache@v4.0.2
3434
with:
3535
path: ${{ env.CACHE_PATH }}
3636
key: coverage-cache
@@ -61,7 +61,7 @@ jobs:
6161
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' '*tests/*' --output-file coverage.info
6262
6363
- name: Upload coverage reports to Codecov
64-
uses: codecov/codecov-action@v3
64+
uses: codecov/codecov-action@v4.5.0
6565
env:
6666
token: ${{ secrets.CODECOV_TOKEN }}
6767
files: coverage.info

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fetch-depth: 10
1717

1818
- name: Set up Python
19-
uses: actions/setup-python@v4.3.0
19+
uses: actions/setup-python@v5.1.1
2020
with:
2121
python-version: "3.10"
2222

@@ -30,7 +30,7 @@ jobs:
3030
3131
- name: Cache Build
3232
id: cache-build
33-
uses: actions/cache@v3.0.11
33+
uses: actions/cache@v4.0.2
3434
with:
3535
path: ${{ env.CACHE_PATH }}
3636
key: docs-cache

.github/workflows/pypi.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ jobs:
4343
uses: pypa/[email protected]
4444
# to supply options, put them in 'env', like:
4545
env:
46-
MACOSX_DEPLOYMENT_TARGET: "10.14"
46+
MACOSX_DEPLOYMENT_TARGET: "11.0"
4747
CIBW_ARCHS: auto64
4848
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
4949
CIBW_BUILD: ${{ matrix.python-version }}-*
5050
CIBW_SKIP: "cp36-* cp37-* pp* *musllinux* *manylinux1* *-win32 *linux_i686 *linux_aarch64 *linux_ppc64le *linux_s390x"
5151

52-
- uses: actions/upload-artifact@v3
52+
- uses: actions/upload-artifact@v4.3.4
5353
with:
5454
path: ./wheelhouse/*.whl
5555

@@ -62,7 +62,7 @@ jobs:
6262
- name: Build sdist
6363
run: pipx run build --sdist
6464

65-
- uses: actions/upload-artifact@v3
65+
- uses: actions/upload-artifact@v4.3.4
6666
with:
6767
path: dist/*.tar.gz
6868

.github/workflows/python.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
fetch-depth: 10
3939

4040
- name: Set up Python ${{ matrix.python-version }}
41-
uses: actions/setup-python@v4.3.0
41+
uses: actions/setup-python@v5.1.1
4242
with:
4343
python-version: ${{ matrix.python-version }}
4444

@@ -62,7 +62,7 @@ jobs:
6262
6363
- name: Cache Build
6464
id: cache-build
65-
uses: actions/cache@v3.0.11
65+
uses: actions/cache@v4.0.2
6666
with:
6767
path: ${{ env.CACHE_PATH }}
6868
key: ${{ runner.os }}-Python${{ matrix.python-version }}-cache

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,12 @@ option(IPC_TOOLKIT_WITH_RATIONAL_INTERSECTION "Use rational edge-triangle inters
6868
option(IPC_TOOLKIT_WITH_ROBIN_MAP "Use Tessil's robin-map rather than std maps" ON)
6969
option(IPC_TOOLKIT_WITH_ABSEIL "Use Abseil's hash functions" ON)
7070
option(IPC_TOOLKIT_WITH_FILIB "Use filib for interval arithmetic" ON)
71+
option(IPC_TOOLKIT_WITH_INEXACT_CCD "Use the original inexact CCD method of IPC" OFF)
7172

7273
# Advanced options
73-
option(IPC_TOOLKIT_WITH_INEXACT_CCD "Use the original inexact CCD method of IPC" OFF)
7474
option(IPC_TOOLKIT_WITH_SIMD "Enable SIMD" OFF)
7575
option(IPC_TOOLKIT_WITH_CODE_COVERAGE "Enable coverage reporting" OFF)
7676

77-
mark_as_advanced(IPC_TOOLKIT_WITH_INEXACT_CCD) # This is only for comparison purposes
7877
mark_as_advanced(IPC_TOOLKIT_WITH_SIMD) # This does not work reliably
7978
mark_as_advanced(IPC_TOOLKIT_WITH_CODE_COVERAGE) # This is used in GitHub Actions
8079

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ The following dependencies are optionally used based on CMake options:
9090
* [Etienne Vouga's Collision Detection Library](https://github.com/evouga/collisiondetection): inexact CCD
9191
* Included for comparison with the original IPC library
9292
* Enable by using the CMake option `IPC_TOOLKIT_WITH_INEXACT_CCD`
93-
* Replaces the default Tight-Inclusion CCD
9493

9594
## Usage
9695

python/src/bindings.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ PYBIND11_MODULE(ipctk, m)
1212

1313
// define these early because they are used in other definitions
1414
define_eigen_ext(m);
15+
define_narrow_phase_ccd(m);
16+
define_tight_inclusion_ccd(m);
1517

1618
// barrier
1719
define_barrier(m);
@@ -35,17 +37,18 @@ PYBIND11_MODULE(ipctk, m)
3537
define_edge_edge_candidate(m);
3638
define_edge_face_candidate(m);
3739
define_edge_vertex_candidate(m);
40+
define_face_face_candidate(m);
3841
define_face_vertex_candidate(m);
3942
define_vertex_vertex_candidate(m);
4043

4144
// ccd
4245
define_ccd_aabb(m);
43-
define_ccd(m);
44-
define_additive_ccd(m);
46+
define_check_initial_distance(m);
4547
define_inexact_point_edge(m);
46-
define_nonlinear_ccd(m);
4748
define_point_static_plane(m);
48-
define_tight_inclusion_ccd(m);
49+
define_inexact_ccd(m);
50+
define_additive_ccd(m);
51+
define_nonlinear_ccd(m);
4952

5053
// collisions
5154
define_distance_type(m); // define early because it is used next

python/src/broad_phase/aabb.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ void define_aabb(py::module_& m)
105105
vertices_t0, vertices_t1, vertex_boxes, inflation_radius);
106106
return vertex_boxes;
107107
},
108+
R"ipc_Qu8mg5v7(
109+
Build one AABB per vertex position moving linearly from t=0 to t=1.
110+
111+
Parameters:
112+
vertices_t0: Vertex positions at t=0 (rowwise).
113+
vertices_t1: Vertex positions at t=1 (rowwise).
114+
inflation_radius: Radius of a capsule around the temporal edges which the AABBs enclose.
115+
116+
Returns:
117+
Vertex AABBs.
118+
)ipc_Qu8mg5v7",
108119
py::arg("vertices_t0"), py::arg("vertices_t1"),
109120
py::arg("inflation_radius") = 0);
110121

@@ -116,6 +127,16 @@ void define_aabb(py::module_& m)
116127
build_edge_boxes(vertex_boxes, edges, edge_boxes);
117128
return edge_boxes;
118129
},
130+
R"ipc_Qu8mg5v7(
131+
Build one AABB per edge.
132+
133+
Parameters:
134+
vertex_boxes: Vertex AABBs.
135+
edges: Edges (rowwise).
136+
137+
Returns:
138+
edge_boxes: Edge AABBs.
139+
)ipc_Qu8mg5v7",
119140
py::arg("vertex_boxes"), py::arg("edges"));
120141

121142
m.def(
@@ -126,5 +147,15 @@ void define_aabb(py::module_& m)
126147
build_face_boxes(vertex_boxes, faces, face_boxes);
127148
return face_boxes;
128149
},
150+
R"ipc_Qu8mg5v7(
151+
Build one AABB per face.
152+
153+
Parameters:
154+
vertex_boxes: Vertex AABBs.
155+
faces: Faces (rowwise).
156+
157+
Returns:
158+
face_boxes: Face AABBs.
159+
)ipc_Qu8mg5v7",
129160
py::arg("vertex_boxes"), py::arg("faces"));
130161
}

python/src/broad_phase/broad_phase.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,19 @@ void define_broad_phase(py::module_& m)
139139
Returns:
140140
The candidate edge-face intersections.
141141
)ipc_Qu8mg5v7")
142+
.def(
143+
"detect_face_face_candidates",
144+
[](const BroadPhase& self) {
145+
std::vector<FaceFaceCandidate> candidates;
146+
self.detect_face_face_candidates(candidates);
147+
return candidates;
148+
},
149+
R"ipc_Qu8mg5v7(
150+
Find the candidate face-face collisions.
151+
152+
Returns:
153+
The candidate face-face collisions.
154+
)ipc_Qu8mg5v7")
142155
.def(
143156
"detect_collision_candidates",
144157
[](const BroadPhase& self, int dim) {

0 commit comments

Comments
 (0)