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
13 changes: 2 additions & 11 deletions src/ipc/collision_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,10 @@ void CollisionMesh::init_edges_to_faces()
return;
}

m_edges_to_faces.setConstant(num_edges(), 2, -1);
m_edges_to_faces.resize(num_edges());
for (int f = 0; f < m_faces_to_edges.rows(); f++) {
for (int le = 0; le < 3; le++) {
if (m_edges_to_faces(m_faces_to_edges(f, le), 0) < 0) {
m_edges_to_faces(m_faces_to_edges(f, le), 0) = f;
} else if (m_edges_to_faces(m_faces_to_edges(f, le), 1) < 0) {
m_edges_to_faces(m_faces_to_edges(f, le), 1) = f;
} else {
logger().warn(
"Edge {} of face {} is shared by more than 2 faces. "
"This may cause issues with the Geometric Contact Potential (smooth contact).",
m_faces_to_edges(f, le), f);
}
m_edges_to_faces[m_faces_to_edges(f, le)].push_back(f);
}
}
}
Expand Down
15 changes: 10 additions & 5 deletions src/ipc/collision_mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,13 @@ class CollisionMesh {
return m_vertices_to_faces;
}

/// @brief Get the mapping from edges to faces of the collision mesh (|E| × 2).
const Eigen::MatrixXi& edges_to_faces() const { return m_edges_to_faces; }
/// @brief Get the mapping from edges to faces of the collision mesh.
/// @return A vector of size |E|, where each entry is a vector of face
/// indices adjacent to that edge.
const std::vector<std::vector<index_t>>& edges_to_faces() const
{
return m_edges_to_faces;
}

// -----------------------------------------------------------------------

Expand Down Expand Up @@ -340,7 +345,7 @@ class CollisionMesh {
// -----------------------------------------------------------------------
// Helper initialization functions

/// @brief Initialize map from edges to adjacent faces (|E| × 2).
/// @brief Initialize map from edges to adjacent faces.
void init_edges_to_faces();

/// @brief Initialize the codimensional vertices.
Expand Down Expand Up @@ -377,8 +382,8 @@ class CollisionMesh {
Eigen::MatrixXi m_faces;
/// @brief Map from faces edges to rows of edges (|F| × 3).
Eigen::MatrixXi m_faces_to_edges;
/// @brief Map from edges to adjacent faces (|E| × 2).
Eigen::MatrixXi m_edges_to_faces;
/// @brief Map from edges to adjacent faces (|E| entries, variable length).
std::vector<std::vector<index_t>> m_edges_to_faces;

/// @brief Map from full vertices to collision vertices.
/// @note Negative values indicate full vertex is dropped.
Expand Down
2 changes: 1 addition & 1 deletion src/ipc/smooth_contact/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static constexpr int N_EDGE_NEIGHBORS_2D = 2;
static constexpr int MAX_VERT_2D =
2 * std::max(N_VERT_NEIGHBORS_2D, N_EDGE_NEIGHBORS_2D);
static constexpr int N_VERT_NEIGHBORS_3D = 20; // increase me if needed
static constexpr int N_EDGE_NEIGHBORS_3D = 4;
static constexpr int N_EDGE_NEIGHBORS_3D = 6; // increase me if needed
static constexpr int N_FACE_NEIGHBORS_3D = 3;
static constexpr int MAX_VERT_3D = N_VERT_NEIGHBORS_3D * 2;

Expand Down
3 changes: 3 additions & 0 deletions src/ipc/smooth_contact/distance/point_edge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ template class PointEdgeDistance<ADGrad<18>, 3>;
template class PointEdgeDistance<ADHessian<18>, 3>;
#endif

template class PointEdgeDistance<ADGrad<Eigen::Dynamic>, 3>;
template class PointEdgeDistance<ADHessian<Eigen::Dynamic>, 3>;

template class PointEdgeDistanceDerivatives<2>;
template class PointEdgeDistanceDerivatives<3>;
} // namespace ipc
2 changes: 0 additions & 2 deletions src/ipc/smooth_contact/primitives/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
set(SOURCES
autogen.cpp
autogen.hpp
edge2.cpp
edge2.hpp
edge3.cpp
Expand Down
Loading
Loading