Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ name: Python

on:
push:
branches:
- main
- python
branches: [main]
pull_request:
branches:
- main
paths:
- '.github/workflows/python.yml'
- 'cmake/**'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,4 @@ docs/_doxygen

notebooks/*.[ch]pp
tests/data/cloth_ball_bf_ccd_candidated.json
python/update_bindings.py
2 changes: 1 addition & 1 deletion cmake/recipes/filib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ endif()
message(STATUS "Third-party: creating target 'filib::filib'")

include(CPM)
CPMAddPackage("gh:zfergus/filib#63acb1f78dcdf7667ca2d214f7a3fa3505fdf339")
CPMAddPackage("gh:zfergus/filib#1cd377a7c833a68dc47217829e333f4886c5c46d")
2 changes: 1 addition & 1 deletion cmake/recipes/pybind11.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})

include(CPM)
CPMAddPackage("gh:pybind/pybind11@2.10.3")
CPMAddPackage("gh:pybind/pybind11@2.11.1")
2 changes: 1 addition & 1 deletion docs/source/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2332,7 +2332,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED =
PREDEFINED = IPC_TOOLKIT_WITH_CORRECT_CCD IPC_TOOLKIT_WITH_ROBIN_MAP IPC_TOOLKIT_WITH_ABSEIL IPC_TOOLKIT_WITH_FILIB

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
39 changes: 38 additions & 1 deletion docs/source/cpp-api/ccd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,44 @@ Continuous Collision Detection
.. doxygenvariable:: ipc::DEFAULT_CCD_MAX_ITERATIONS
.. doxygenvariable:: ipc::DEFAULT_CCD_CONSERVATIVE_RESCALING

Individual CCD Functions
------------------------

.. doxygenfunction:: ipc::point_point_ccd
.. doxygenfunction:: ipc::point_edge_ccd
.. doxygenfunction:: ipc::edge_edge_ccd
.. doxygenfunction:: ipc::point_triangle_ccd
.. doxygenfunction:: ipc::point_triangle_ccd

Generic Interface
^^^^^^^^^^^^^^^^^

.. doxygenfunction:: ipc::ccd_strategy

Additive CCD
------------

.. doxygenfunction:: ipc::additive_ccd::point_point_ccd
.. doxygenfunction:: ipc::additive_ccd::point_edge_ccd
.. doxygenfunction:: ipc::additive_ccd::edge_edge_ccd
.. doxygenfunction:: ipc::additive_ccd::point_triangle_ccd

Generic Interface
^^^^^^^^^^^^^^^^^

.. doxygenfunction:: ipc::additive_ccd::additive_ccd

Nonlinear CCD
-------------

.. doxygenclass:: ipc::NonlinearTrajectory
.. doxygenclass:: ipc::IntervalNonlinearTrajectory

.. doxygenfunction:: ipc::point_point_nonlinear_ccd
.. doxygenfunction:: ipc::point_edge_nonlinear_ccd
.. doxygenfunction:: ipc::edge_edge_nonlinear_ccd
.. doxygenfunction:: ipc::point_triangle_nonlinear_ccd

Generic Interface
^^^^^^^^^^^^^^^^^

.. doxygenfunction:: ipc::conservative_piecewise_linear_ccd
5 changes: 5 additions & 0 deletions docs/source/cpp-api/intersections.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Intersections
=============

.. doxygenfunction:: ipc::has_intersections
.. doxygenfunction:: ipc::is_edge_intersecting_triangle
13 changes: 11 additions & 2 deletions docs/source/cpp-api/utils.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
Utils
=====

.. doxygenfunction:: compute_minimum_distance
.. doxygenfunction:: has_intersections
Logger
------

.. doxygenfunction:: ipc::logger
.. doxygenfunction:: ipc::set_logger

Positive Semi-Definite Projection
---------------------------------

.. doxygenfunction:: ipc::project_to_psd
.. doxygenfunction:: ipc::project_to_pd
2 changes: 2 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
cpp-api/ccd.rst
cpp-api/distance.rst
cpp-api/barrier.rst
cpp-api/intersections.rst
cpp-api/utils.rst

.. toctree::
Expand All @@ -43,6 +44,7 @@
python-api/ccd.rst
python-api/distance.rst
python-api/barrier.rst
python-api/intersections.rst
python-api/utils.rst

.. toctree::
Expand Down
44 changes: 43 additions & 1 deletion docs/source/python-api/ccd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,53 @@ Continuous Collision Detection

.. autofunction:: ipctk.compute_collision_free_stepsize

Individual CCD Functions
------------------------

.. .. autovariable:: ipctk.DEFAULT_CCD_TOLERANCE
.. .. autovariable:: ipctk.DEFAULT_CCD_MAX_ITERATIONS
.. .. autovariable:: ipctk.DEFAULT_CCD_CONSERVATIVE_RESCALING

.. autofunction:: ipctk.point_point_ccd
.. autofunction:: ipctk.point_edge_ccd
.. autofunction:: ipctk.edge_edge_ccd
.. autofunction:: ipctk.point_triangle_ccd
.. autofunction:: ipctk.point_triangle_ccd

Generic Interface
^^^^^^^^^^^^^^^^^

.. autofunction:: ipctk.ccd_strategy

Additive CCD
------------

.. autofunction:: ipctk.additive_ccd.point_point_ccd
.. autofunction:: ipctk.additive_ccd.point_edge_ccd
.. autofunction:: ipctk.additive_ccd.edge_edge_ccd
.. autofunction:: ipctk.additive_ccd.point_triangle_ccd

Generic Interface
^^^^^^^^^^^^^^^^^

.. autofunction:: ipctk.additive_ccd.additive_ccd

Nonlinear CCD
-------------

.. autoclass:: ipctk.NonlinearTrajectory

.. autoclasstoc::

.. autoclass:: ipctk.IntervalNonlinearTrajectory

.. autoclasstoc::

.. autofunction:: ipctk.point_point_nonlinear_ccd
.. autofunction:: ipctk.point_edge_nonlinear_ccd
.. autofunction:: ipctk.edge_edge_nonlinear_ccd
.. autofunction:: ipctk.point_triangle_nonlinear_ccd

Generic Interface
^^^^^^^^^^^^^^^^^

.. autofunction:: ipctk.conservative_piecewise_linear_ccd
6 changes: 6 additions & 0 deletions docs/source/python-api/intersections.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Intersections
=============

.. autofunction:: ipctk.has_intersections
.. autofunction:: ipctk.is_edge_intersecting_triangle
.. autofunction:: ipctk.segment_segment_intersect
6 changes: 6 additions & 0 deletions docs/source/python-api/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ Multi-Threading

.. autofunction:: ipctk.get_num_threads
.. autofunction:: ipctk.set_num_threads

Positive Semi-Definite Projection
---------------------------------

.. autofunction:: ipctk.project_to_psd
.. autofunction:: ipctk.project_to_pd
2 changes: 2 additions & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pybind11_add_module(ipctk
src/ccd/ccd.cpp
src/ccd/additive_ccd.cpp
src/ccd/inexact_point_edge.cpp
src/ccd/nonlinear_ccd.cpp
src/ccd/point_static_plane.cpp

src/collisions/collision_constraint.cpp
Expand Down Expand Up @@ -67,6 +68,7 @@ pybind11_add_module(ipctk

src/utils/area_gradient.cpp
src/utils/eigen_ext.cpp
src/utils/interval.cpp
src/utils/intersection.cpp
src/utils/logger.cpp
src/utils/thread_limiter.cpp
Expand Down
27 changes: 17 additions & 10 deletions python/src/barrier/barrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ void define_barrier(py::module_& m)
R"ipc_Qu8mg5v7(
Function that grows to infinity as d approaches 0 from the right.

.. math:: b(d) = -(d-\hat{d})^2\ln\left(\frac{d}{\hat{d}}\right)
.. math::

b(d) = -(d-\hat{d})^2\ln\left(\frac{d}{\hat{d}}\right)

Parameters:
d: distance
dhat: activation distance of the barrier
d: The distance.
dhat: Activation distance of the barrier.

Returns:
The value of the barrier function at d.

)ipc_Qu8mg5v7",
py::arg("d"), py::arg("dhat"));

Expand All @@ -29,11 +30,14 @@ void define_barrier(py::module_& m)
R"ipc_Qu8mg5v7(
Derivative of the barrier function.

.. math:: b'(d) = (\hat{d}-d) \left( 2\ln\left( \frac{d}{\hat{d}} \right) - \frac{\hat{d}}{d} + 1\right)
.. math::

b'(d) = (\hat{d}-d) \left( 2\ln\left( \frac{d}{\hat{d}} \right) -
\frac{\hat{d}}{d} + 1\right)

Parameters:
d: distance
dhat: activation distance of the barrier
d: The distance.
dhat: Activation distance of the barrier.

Returns:
The derivative of the barrier wrt d.
Expand All @@ -45,11 +49,14 @@ void define_barrier(py::module_& m)
R"ipc_Qu8mg5v7(
Second derivative of the barrier function.

.. math:: b''(d) = \left( \frac{\hat{d}}{d} + 2 \right) \frac{\hat{d}}{d} - 2\ln\left( \frac{d}{\hat{d}} \right) - 3
.. math::

b''(d) = \left( \frac{\hat{d}}{d} + 2 \right) \frac{\hat{d}}{d} -
2\ln\left( \frac{d}{\hat{d}} \right) - 3

Parameters:
d: distance
dhat: activation distance of the barrier
d: The distance.
dhat: Activation distance of the barrier.

Returns:
The second derivative of the barrier wrt d.
Expand Down
4 changes: 3 additions & 1 deletion python/src/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PYBIND11_MODULE(ipctk, m)
define_bvh(m);
define_hash_grid(m);
define_spatial_hash(m);
define_sweep(m);
define_sweep_and_tiniest_queue(m);
define_voxel_size_heuristic(m);

// candidates
Expand All @@ -39,6 +39,7 @@ PYBIND11_MODULE(ipctk, m)
define_ccd(m);
define_additive_ccd(m);
define_inexact_point_edge(m);
define_nonlinear_ccd(m);
define_point_static_plane(m);

// collisions
Expand Down Expand Up @@ -83,6 +84,7 @@ PYBIND11_MODULE(ipctk, m)
// utils
define_area_gradient(m);
define_eigen_ext(m);
define_interval(m);
define_intersection(m);
define_logger(m);
define_thread_limiter(m);
Expand Down
35 changes: 22 additions & 13 deletions python/src/broad_phase/aabb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ using namespace ipc;
void define_aabb(py::module_& m)
{
py::class_<AABB>(m, "AABB")
.def(py::init(), "")
.def(py::init())
.def(
py::init<const ArrayMax3d&, const ArrayMax3d&>(), "",
py::arg("min"), py::arg("max"))
py::init<const ArrayMax3d&, const ArrayMax3d&>(), py::arg("min"),
py::arg("max"))
.def(
py::init<const AABB&, const AABB&>(), "", py::arg("aabb1"),
py::init<const AABB&, const AABB&>(), py::arg("aabb1"),
py::arg("aabb2"))
.def(
py::init<const AABB&, const AABB&, const AABB&>(), "",
py::arg("aabb1"), py::arg("aabb2"), py::arg("aabb3"))
py::init<const AABB&, const AABB&, const AABB&>(), py::arg("aabb1"),
py::arg("aabb2"), py::arg("aabb3"))
.def_static(
"from_point",
py::overload_cast<const VectorMax3d&, const double>(
&AABB::from_point),
R"ipc_Qu8mg5v7(
Compute a AABB for a static point.
Construct an AABB for a static point.

Parameters:
p: The point's position.
Expand All @@ -39,7 +39,7 @@ void define_aabb(py::module_& m)
const VectorMax3d&, const VectorMax3d&, const double>(
&AABB::from_point),
R"ipc_Qu8mg5v7(
Compute a AABB for a moving point (i.e. temporal edge).
Construct an AABB for a moving point (i.e. temporal edge).

Parameters:
p_t0: The point's position at time t=0.
Expand Down Expand Up @@ -83,8 +83,17 @@ void define_aabb(py::module_& m)
build_vertex_boxes(vertices, vertex_boxes, inflation_radius);
return vertex_boxes;
},
"Build one AABB per vertex position (row of V).", py::arg("vertices"),
py::arg("inflation_radius") = 0);
R"ipc_Qu8mg5v7(
Build one AABB per vertex position (row of V).

Parameters:
vertices: Vertex positions (rowwise).
inflation_radius: Radius of a sphere around the points which the AABBs enclose.

Returns:
Vertex AABBs.
)ipc_Qu8mg5v7",
py::arg("vertices"), py::arg("inflation_radius") = 0);

m.def(
"build_vertex_boxes",
Expand All @@ -96,7 +105,7 @@ void define_aabb(py::module_& m)
vertices_t0, vertices_t1, vertex_boxes, inflation_radius);
return vertex_boxes;
},
"", py::arg("vertices_t0"), py::arg("vertices_t1"),
py::arg("vertices_t0"), py::arg("vertices_t1"),
py::arg("inflation_radius") = 0);

m.def(
Expand All @@ -107,7 +116,7 @@ void define_aabb(py::module_& m)
build_edge_boxes(vertex_boxes, edges, edge_boxes);
return edge_boxes;
},
"", py::arg("vertex_boxes"), py::arg("edges"));
py::arg("vertex_boxes"), py::arg("edges"));

m.def(
"build_face_boxes",
Expand All @@ -117,5 +126,5 @@ void define_aabb(py::module_& m)
build_face_boxes(vertex_boxes, faces, face_boxes);
return face_boxes;
},
"", py::arg("vertex_boxes"), py::arg("faces"));
py::arg("vertex_boxes"), py::arg("faces"));
}
2 changes: 1 addition & 1 deletion python/src/broad_phase/bindings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ void define_brute_force(py::module_& m);
void define_bvh(py::module_& m);
void define_hash_grid(py::module_& m);
void define_spatial_hash(py::module_& m);
void define_sweep(py::module_& m);
void define_sweep_and_tiniest_queue(py::module_& m);
void define_voxel_size_heuristic(py::module_& m);
Loading