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

Commit afd7559

Browse files
authored
Update Documentation for Time Integration (#166)
* Fix documentation warnings * Remove fixed PYTHON_EXECUTABLE * Add optimization-based time integration section to simulation documentation
1 parent f73d5b8 commit afd7559

File tree

16 files changed

+72
-73
lines changed

16 files changed

+72
-73
lines changed

cmake/recipes/pybind11.cmake

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,5 @@ if (NOT DEFINED Python_FIND_FRAMEWORK)
1919
set(Python_FIND_FRAMEWORK "LAST")
2020
endif ()
2121

22-
# Pybind11 still uses the deprecated FindPythonInterp. So let's call CMake's
23-
# new FindPython module and set PYTHON_EXECUTABLE for Pybind11 to pick up.
24-
# This works well with conda environments.
25-
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
26-
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
27-
2822
include(CPM)
2923
CPMAddPackage("gh:pybind/[email protected]")

docs/source/Doxyfile

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,15 +1387,6 @@ HTML_COLORSTYLE_SAT = 100
13871387

13881388
HTML_COLORSTYLE_GAMMA = 80
13891389

1390-
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
1391-
# page will contain the date and time when the page was generated. Setting this
1392-
# to YES can help to show when doxygen was last run and thus if the
1393-
# documentation is up to date.
1394-
# The default value is: NO.
1395-
# This tag requires that the tag GENERATE_HTML is set to YES.
1396-
1397-
HTML_TIMESTAMP = NO
1398-
13991390
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
14001391
# documentation will contain a main index with vertical navigation menus that
14011392
# are dynamically created via JavaScript. If disabled, the navigation index will
@@ -2056,14 +2047,6 @@ LATEX_HIDE_INDICES = NO
20562047

20572048
LATEX_BIB_STYLE = plainnat
20582049

2059-
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
2060-
# page will contain the date and time when the page was generated. Setting this
2061-
# to NO can help when comparing the output of multiple runs.
2062-
# The default value is: NO.
2063-
# This tag requires that the tag GENERATE_LATEX is set to YES.
2064-
2065-
LATEX_TIMESTAMP = NO
2066-
20672050
# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
20682051
# path from which the emoji images will be read. If a relative path is entered,
20692052
# it will be relative to the LATEX_OUTPUT directory. If left blank the

docs/source/tutorial/simulation.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ While the IPC Toolkit provides all the principle components of the IPC algorithm
55

66
We provide several helper functions to make your job easier. The following examples show how to use these functions.
77

8+
Optimization-Based Time Integration
9+
-----------------------------------
10+
11+
IPC defines barrier potential :math:`B(\mathbf{x})` and a friction potential :math:`D(\mathbf{v})`. To add these into a optimization-based time integration, we need to scale the potentials by the time-integrators acceleration scaling. For implicit Euler, this is h^2, where h is the timestep.
12+
13+
With elasticity :math:`\Psi(\mathbf{x})`, the total optimization problem is:
14+
15+
.. math::
16+
\mathbf{x}^{t+1} = \underset{\mathbf{x}}{\arg\min} ~ \tfrac{1}{2} (\mathbf{x} - \hat{\mathbf{x}})^\top\mathbf{M}(\mathbf{x}-\hat{\mathbf{x}})+h^2\Psi(\mathbf{x}) + h^2 \kappa B(\mathbf{x}) + h^2 D(\mathbf{v}(\mathbf{x}))
17+
18+
where :math:`\hat{\mathbf{x}} = \mathbf{x}^t + h\mathbf{v}^t + h^2\mathbf{g}` is the time integration scheme-specific “predicted positions.”
19+
20+
.. note::
21+
In \cite{Li2020}, all the constants are wrapped up into $\kappa$, which is adaptively modified. In follow-up works, we treat the barrier as a physical energy, and so it should have the same multiplier as the elastic energy ($h^2$ for implicit Euler).
22+
823
Volumetric Meshes
924
-----------------
1025

src/ipc/barrier/adaptive_stiffness.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ double update_barrier_stiffness(
5353
/// @brief Compute the semi-implicit stiffness for a single collision.
5454
/// See [Ando 2024] for details.
5555
/// @param stencil Collision stencil.
56-
/// @param vertex_ids Vertex indices of the collision.
5756
/// @param vertices Vertex positions.
5857
/// @param mass Vertex masses.
5958
/// @param local_hess Local hessian of the elasticity energy function.

src/ipc/candidates/candidates.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Candidates {
2020
/// @param mesh The surface of the collision mesh.
2121
/// @param vertices Surface vertex positions (rowwise).
2222
/// @param inflation_radius Amount to inflate the bounding boxes.
23-
/// @param broad_phase_method Broad phase method to use.
23+
/// @param broad_phase Broad phase method to use.
2424
void build(
2525
const CollisionMesh& mesh,
2626
Eigen::ConstRef<Eigen::MatrixXd> vertices,
@@ -34,7 +34,7 @@ class Candidates {
3434
/// @param vertices_t0 Surface vertex starting positions (rowwise).
3535
/// @param vertices_t1 Surface vertex ending positions (rowwise).
3636
/// @param inflation_radius Amount to inflate the bounding boxes.
37-
/// @param broad_phase_method Broad phase method to use.
37+
/// @param broad_phase Broad phase method to use.
3838
void build(
3939
const CollisionMesh& mesh,
4040
Eigen::ConstRef<Eigen::MatrixXd> vertices_t0,
@@ -99,6 +99,7 @@ class Candidates {
9999
/// @param vertices_t1 Surface vertex ending positions (rowwise).
100100
/// @param dhat Barrier activation distance.
101101
/// @param min_distance The minimum distance allowable between any two elements.
102+
/// @param broad_phase The broad phase algorithm to use.
102103
/// @param narrow_phase_ccd The narrow phase CCD algorithm to use.
103104
double compute_cfl_stepsize(
104105
const CollisionMesh& mesh,

src/ipc/ccd/additive_ccd.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class AdditiveCCD : public NarrowPhaseCCD {
2626
static constexpr double DEFAULT_CONSERVATIVE_RESCALING = 0.9;
2727

2828
/// @brief Construct a new AdditiveCCD object.
29+
/// @param max_iterations The maximum number of iterations to use for the CCD algorithm. If set to UNLIMITTED_ITERATIONS, the algorithm will run until it converges.
2930
/// @param conservative_rescaling The conservative rescaling of the time of impact.
3031
AdditiveCCD(
3132
const long max_iterations = UNLIMITTED_ITERATIONS,
@@ -39,7 +40,6 @@ class AdditiveCCD : public NarrowPhaseCCD {
3940
/// @param[out] toi The time of impact between the two points.
4041
/// @param min_distance The minimum distance between two objects.
4142
/// @param tmax The maximum time to check for collisions.
42-
/// @param conservative_rescaling The conservative rescaling of the time of impact.
4343
/// @return True if a collision was detected, false otherwise.
4444
bool point_point_ccd(
4545
Eigen::ConstRef<VectorMax3d> p0_t0,
@@ -60,7 +60,6 @@ class AdditiveCCD : public NarrowPhaseCCD {
6060
/// @param[out] toi The time of impact between the point and the edge.
6161
/// @param min_distance The minimum distance between two objects.
6262
/// @param tmax The maximum time to check for collisions.
63-
/// @param conservative_rescaling The conservative rescaling of the time of impact.
6463
/// @return True if a collision was detected, false otherwise.
6564
bool point_edge_ccd(
6665
Eigen::ConstRef<VectorMax3d> p_t0,
@@ -85,7 +84,6 @@ class AdditiveCCD : public NarrowPhaseCCD {
8584
/// @param[out] toi The time of impact between the point and the triangle.
8685
/// @param min_distance The minimum distance between two objects.
8786
/// @param tmax The maximum time to check for collisions.
88-
/// @param conservative_rescaling The conservative rescaling of the time of impact.
8987
/// @return True if a collision was detected, false otherwise.
9088
bool point_triangle_ccd(
9189
Eigen::ConstRef<Eigen::Vector3d> p_t0,
@@ -112,7 +110,6 @@ class AdditiveCCD : public NarrowPhaseCCD {
112110
/// @param[out] toi The time of impact between the two edges.
113111
/// @param min_distance The minimum distance between two objects.
114112
/// @param tmax The maximum time to check for collisions.
115-
/// @param conservative_rescaling The conservative rescaling of the time of impact.
116113
/// @return True if a collision was detected, false otherwise.
117114
bool edge_edge_ccd(
118115
Eigen::ConstRef<Eigen::Vector3d> ea0_t0,
@@ -135,11 +132,13 @@ class AdditiveCCD : public NarrowPhaseCCD {
135132

136133
private:
137134
/// @brief Computes the time of impact between two objects using additive continuous collision detection.
135+
/// @param x Initial positions
136+
/// @param dx Displacements
138137
/// @param distance_squared A function that computes the squared distance between the two objects at a given time.
138+
/// @param max_disp_mag The maximum displacement magnitude.
139139
/// @param[out] toi The time of impact between the two objects.
140140
/// @param min_distance The minimum distance between the objects.
141141
/// @param tmax The maximum time to check for collisions.
142-
/// @param conservative_rescaling The amount to rescale the objects by to ensure conservative advancement.
143142
/// @return True if a collision was detected, false otherwise.
144143
bool additive_ccd(
145144
VectorMax12d x, // mutable copy

src/ipc/ccd/tight_inclusion_ccd.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class TightInclusionCCD : public NarrowPhaseCCD {
1818
static constexpr double SMALL_TOI = 1e-6;
1919

2020
/// @brief Construct a new AdditiveCCD object.
21+
/// @param tolerance The tolerance used for the CCD algorithm.
22+
/// @param max_iterations The maximum number of iterations for the CCD algorithm.
2123
/// @param conservative_rescaling The conservative rescaling of the time of impact.
2224
TightInclusionCCD(
2325
const double tolerance = DEFAULT_TOLERANCE,

src/ipc/collision_mesh.hpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ class CollisionMesh {
1313
CollisionMesh() = default;
1414

1515
/// @brief Construct a new Collision Mesh object directly from the collision mesh vertices.
16-
/// @param rest_positions The vertices of the collision mesh at rest (#V × dim).
17-
/// @param edges The edges of the collision mesh (#E × 2).
18-
/// @param faces The faces of the collision mesh (#F × 3).
16+
/// @param rest_positions The vertices of the collision mesh at rest (|V| × dim).
17+
/// @param edges The edges of the collision mesh (|E| × 2).
18+
/// @param faces The faces of the collision mesh (|F| × 3).
1919
/// @param displacement_map The displacement mapping from displacements on the full mesh to the collision mesh.
2020
CollisionMesh(
2121
Eigen::ConstRef<Eigen::MatrixXd> rest_positions,
@@ -26,9 +26,9 @@ class CollisionMesh {
2626

2727
/// @brief Construct a new Collision Mesh object from a full mesh vertices.
2828
/// @param include_vertex Vector of bools indicating whether each vertex should be included in the collision mesh.
29-
/// @param full_rest_positions The vertices of the full mesh at rest (#V × dim).
30-
/// @param edges The edges of the collision mesh indexed into the full mesh vertices (#E × 2).
31-
/// @param faces The faces of the collision mesh indexed into the full mesh vertices (#F × 3).
29+
/// @param full_rest_positions The vertices of the full mesh at rest (|V| × dim).
30+
/// @param edges The edges of the collision mesh indexed into the full mesh vertices (|E| × 2).
31+
/// @param faces The faces of the collision mesh indexed into the full mesh vertices (|F| × 3).
3232
/// @param displacement_map The displacement mapping from displacements on the full mesh to the collision mesh.
3333
CollisionMesh(
3434
const std::vector<bool>& include_vertex,
@@ -39,9 +39,9 @@ class CollisionMesh {
3939
Eigen::SparseMatrix<double>());
4040

4141
/// @brief Helper function that automatically builds include_vertex using construct_is_on_surface.
42-
/// @param full_rest_positions The full vertices at rest (#FV × dim).
43-
/// @param edges The edge matrix of mesh (#E × 2).
44-
/// @param faces The face matrix of mesh (#F × 3).
42+
/// @param full_rest_positions The full vertices at rest (|FV| × dim).
43+
/// @param edges The edge matrix of mesh (|E| × 2).
44+
/// @param faces The face matrix of mesh (|F| × 3).
4545
/// @return Constructed CollisionMesh.
4646
static CollisionMesh build_from_full_mesh(
4747
Eigen::ConstRef<Eigen::MatrixXd> full_rest_positions,
@@ -91,22 +91,22 @@ class CollisionMesh {
9191
/// @brief Get the number of degrees of freedom in the full mesh.
9292
size_t full_ndof() const { return full_num_vertices() * dim(); }
9393

94-
/// @brief Get the vertices of the collision mesh at rest (#V × dim).
94+
/// @brief Get the vertices of the collision mesh at rest (|V| × dim).
9595
const Eigen::MatrixXd& rest_positions() const { return m_rest_positions; }
9696

97-
/// @brief Get the indices of codimensional vertices of the collision mesh (#CV x 1).
97+
/// @brief Get the indices of codimensional vertices of the collision mesh (|CV| x 1).
9898
const Eigen::VectorXi& codim_vertices() const { return m_codim_vertices; }
9999

100-
/// @brief Get the indices of codimensional edges of the collision mesh (#CE x 1).
100+
/// @brief Get the indices of codimensional edges of the collision mesh (|CE| x 1).
101101
const Eigen::VectorXi& codim_edges() const { return m_codim_edges; }
102102

103-
/// @brief Get the edges of the collision mesh (#E × 2).
103+
/// @brief Get the edges of the collision mesh (|E| × 2).
104104
const Eigen::MatrixXi& edges() const { return m_edges; }
105105

106-
/// @brief Get the faces of the collision mesh (#F × 3).
106+
/// @brief Get the faces of the collision mesh (|F| × 3).
107107
const Eigen::MatrixXi& faces() const { return m_faces; }
108108

109-
/// @brief Get the mapping from faces to edges of the collision mesh (#F × 3).
109+
/// @brief Get the mapping from faces to edges of the collision mesh (|F| × 3).
110110
const Eigen::MatrixXi& faces_to_edges() const { return m_faces_to_edges; }
111111

112112
// const std::vector<std::vector<int>>& vertices_to_edges() const
@@ -122,20 +122,20 @@ class CollisionMesh {
122122
// -----------------------------------------------------------------------
123123

124124
/// @brief Compute the vertex positions from the positions of the full mesh.
125-
/// @param full_positions The vertex positions of the full mesh (#FV × dim).
126-
/// @return The vertex positions of the collision mesh (#V × dim).
125+
/// @param full_positions The vertex positions of the full mesh (|FV| × dim).
126+
/// @return The vertex positions of the collision mesh (|V| × dim).
127127
Eigen::MatrixXd
128128
vertices(Eigen::ConstRef<Eigen::MatrixXd> full_positions) const;
129129

130130
/// @brief Compute the vertex positions from vertex displacements on the full mesh.
131-
/// @param full_displacements The vertex displacements on the full mesh (#FV × dim).
132-
/// @return The vertex positions of the collision mesh (#V × dim).
131+
/// @param full_displacements The vertex displacements on the full mesh (|FV| × dim).
132+
/// @return The vertex positions of the collision mesh (|V| × dim).
133133
Eigen::MatrixXd displace_vertices(
134134
Eigen::ConstRef<Eigen::MatrixXd> full_displacements) const;
135135

136136
/// @brief Map vertex displacements on the full mesh to vertex displacements on the collision mesh.
137-
/// @param full_displacements The vertex displacements on the full mesh (#FV × dim).
138-
/// @return The vertex displacements on the collision mesh (#V × dim).
137+
/// @param full_displacements The vertex displacements on the full mesh (|FV| × dim).
138+
/// @return The vertex displacements on the collision mesh (|V| × dim).
139139
Eigen::MatrixXd map_displacements(
140140
Eigen::ConstRef<Eigen::MatrixXd> full_displacements) const;
141141

@@ -263,17 +263,17 @@ class CollisionMesh {
263263

264264
/// @brief Construct a vector of bools indicating whether each vertex is on the surface.
265265
/// @param num_vertices The number of vertices in the mesh.
266-
/// @param edges The surface edges of the mesh (#E × 2).
267-
/// @param codim_vertices The indices of codimensional vertices (#CV x 1).
266+
/// @param edges The surface edges of the mesh (|E| × 2).
267+
/// @param codim_vertices The indices of codimensional vertices (|CV| x 1).
268268
/// @return A vector of bools indicating whether each vertex is on the surface.
269269
static std::vector<bool> construct_is_on_surface(
270270
const size_t num_vertices,
271271
Eigen::ConstRef<Eigen::MatrixXi> edges,
272272
Eigen::ConstRef<Eigen::VectorXi> codim_vertices = Eigen::VectorXi());
273273

274274
/// @brief Construct a matrix that maps from the faces' edges to rows in the edges matrix.
275-
/// @param faces The face matrix of mesh (#F × 3).
276-
/// @param edges The edge matrix of mesh (#E × 2).
275+
/// @param faces The face matrix of mesh (|F| × 3).
276+
/// @param edges The edge matrix of mesh (|E| × 2).
277277
/// @return Matrix that maps from the faces' edges to rows in the edges matrix.
278278
static Eigen::MatrixXi construct_faces_to_edges(
279279
Eigen::ConstRef<Eigen::MatrixXi> faces,
@@ -303,19 +303,19 @@ class CollisionMesh {
303303

304304
// -----------------------------------------------------------------------
305305

306-
/// @brief The full vertex positions at rest (#FV × dim).
306+
/// @brief The full vertex positions at rest (|FV| × dim).
307307
Eigen::MatrixXd m_full_rest_positions;
308-
/// @brief The vertex positions at rest (#V × dim).
308+
/// @brief The vertex positions at rest (|V| × dim).
309309
Eigen::MatrixXd m_rest_positions;
310-
/// @brief The indices of codimensional vertices (#CV x 1).
310+
/// @brief The indices of codimensional vertices (|CV| x 1).
311311
Eigen::VectorXi m_codim_vertices;
312-
/// @brief The indices of codimensional edges (#CE x 1).
312+
/// @brief The indices of codimensional edges (|CE| x 1).
313313
Eigen::VectorXi m_codim_edges;
314-
/// @brief Edges as rows of indicies into vertices (#E × 2).
314+
/// @brief Edges as rows of indicies into vertices (|E| × 2).
315315
Eigen::MatrixXi m_edges;
316-
/// @brief Triangular faces as rows of indicies into vertices (#F × 3).
316+
/// @brief Triangular faces as rows of indicies into vertices (|F| × 3).
317317
Eigen::MatrixXi m_faces;
318-
/// @brief Map from faces edges to rows of edges (#F × 3).
318+
/// @brief Map from faces edges to rows of edges (|F| × 3).
319319
Eigen::MatrixXi m_faces_to_edges;
320320

321321
/// @brief Map from full vertices to collision vertices.

src/ipc/collisions/normal/normal_collisions.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class NormalCollisions {
2828
/// @param vertices Vertices of the collision mesh.
2929
/// @param dhat The activation distance of the barrier.
3030
/// @param dmin Minimum distance.
31-
/// @param broad_phase_method Broad-phase method to use.
31+
/// @param broad_phase Broad-phase method to use.
3232
void build(
3333
const CollisionMesh& mesh,
3434
Eigen::ConstRef<Eigen::MatrixXd> vertices,

src/ipc/distance/line_line.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace ipc {
99
/// @warning If the lines are parallel this function returns a distance of zero.
1010
/// @param ea0 The first vertex of the edge defining the first line.
1111
/// @param ea1 The second vertex of the edge defining the first line.
12-
/// @param ea0 The first vertex of the edge defining the second line.
13-
/// @param ea1 The second vertex of the edge defining the second line.
12+
/// @param eb0 The first vertex of the edge defining the second line.
13+
/// @param eb1 The second vertex of the edge defining the second line.
1414
/// @return The distance between the two lines.
1515
double line_line_distance(
1616
Eigen::ConstRef<Eigen::Vector3d> ea0,
@@ -23,8 +23,8 @@ double line_line_distance(
2323
/// @warning If the lines are parallel this function returns a distance of zero.
2424
/// @param ea0 The first vertex of the edge defining the first line.
2525
/// @param ea1 The second vertex of the edge defining the first line.
26-
/// @param ea0 The first vertex of the edge defining the second line.
27-
/// @param ea1 The second vertex of the edge defining the second line.
26+
/// @param eb0 The first vertex of the edge defining the second line.
27+
/// @param eb1 The second vertex of the edge defining the second line.
2828
/// @return The gradient of the distance wrt ea0, ea1, eb0, and eb1.
2929
Vector12d line_line_distance_gradient(
3030
Eigen::ConstRef<Eigen::Vector3d> ea0,
@@ -37,8 +37,8 @@ Vector12d line_line_distance_gradient(
3737
/// @warning If the lines are parallel this function returns a distance of zero.
3838
/// @param ea0 The first vertex of the edge defining the first line.
3939
/// @param ea1 The second vertex of the edge defining the first line.
40-
/// @param ea0 The first vertex of the edge defining the second line.
41-
/// @param ea1 The second vertex of the edge defining the second line.
40+
/// @param eb0 The first vertex of the edge defining the second line.
41+
/// @param eb1 The second vertex of the edge defining the second line.
4242
/// @return The hessian of the distance wrt ea0, ea1, eb0, and eb1.
4343
Matrix12d line_line_distance_hessian(
4444
Eigen::ConstRef<Eigen::Vector3d> ea0,

0 commit comments

Comments
 (0)