Tangential Collisions¶
- class TangentialCollisions;¶
Public Types¶
- using value_type = TangentialCollision;¶
The type of the collisions.
Public Functions¶
- TangentialCollisions() = default;¶
-
inline void build(const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> vertices,
const NormalCollisions& collisions,
const NormalPotential& normal_potential,
double normal_stiffness, double mu);¶ Build the tangential collisions.
- Parameters:¶
- const CollisionMesh &mesh¶
The collision mesh.
- Eigen::ConstRef<Eigen::MatrixXd> vertices¶
The vertices of the mesh.
- const NormalCollisions &collisions¶
The set of normal collisions.
- const NormalPotential &normal_potential¶
The normal potential.
- double normal_stiffness¶
Stiffness of the normal potential.
- double mu¶
The coefficient of friction.
-
inline void build(const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> vertices,
const NormalCollisions& collisions,
const NormalPotential& normal_potential,
double normal_stiffness, double mu_s, double mu_k);¶ Build the tangential collisions.
- Parameters:¶
- const CollisionMesh &mesh¶
The collision mesh.
- Eigen::ConstRef<Eigen::MatrixXd> vertices¶
The vertices of the mesh.
- const NormalCollisions &collisions¶
The set of normal collisions.
- const NormalPotential &normal_potential¶
The normal potential.
- double normal_stiffness¶
Stiffness of the normal potential.
- double mu_s¶
The static friction coefficient.
- double mu_k¶
The kinetic friction coefficient.
-
void build(const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> vertices,
const NormalCollisions& collisions,
const NormalPotential& normal_potential,
const double normal_stiffness,
Eigen::ConstRef<Eigen::VectorXd> mu_k,
Eigen::ConstRef<Eigen::VectorXd> mu_s,
const std::function<double(double, double)>& blend_mu
= default_blend_mu);¶ Build the tangential collisions.
- Parameters:¶
- const CollisionMesh &mesh¶
The collision mesh.
- Eigen::ConstRef<Eigen::MatrixXd> vertices¶
The vertices of the mesh.
- const NormalCollisions &collisions¶
The set of normal collisions.
- const NormalPotential &normal_potential¶
The normal potential.
- const double normal_stiffness¶
Stiffness of the normal potential.
- Eigen::ConstRef<Eigen::VectorXd> mu_k¶
The kinetic friction coefficient per vertex.
- Eigen::ConstRef<Eigen::VectorXd> mu_s¶
The static friction coefficient per vertex.
- const std::function<double(double, double)> &blend_mu = default_blend_mu¶
Function to blend vertex-based coefficients of friction.
- size_t size() const;¶
Get the number of friction collisions.
- bool empty() const;¶
Get if the friction collisions are empty.
- void clear();¶
Clear the friction collisions.
- TangentialCollision& operator[](const size_t i);¶
Get a reference to collision at index i.
Public Members¶
- std::vector<VertexVertexTangentialCollision> vv_collisions;¶
Vertex-vertex tangential collisions.
- std::vector<EdgeVertexTangentialCollision> ev_collisions;¶
Edge-vertex tangential collisions.
- std::vector<EdgeEdgeTangentialCollision> ee_collisions;¶
Edge-edge tangential collisions.
- std::vector<FaceVertexTangentialCollision> fv_collisions;¶
Face-vertex tangential collisions.
Tangential Collision¶
- class TangentialCollision : public virtual ipc::CollisionStencil;¶
Inheritance diagram for ipc::TangentialCollision:
Collaboration diagram for ipc::TangentialCollision:
Subclassed by ipc::EdgeEdgeTangentialCollision, ipc::EdgeVertexTangentialCollision, ipc::FaceVertexTangentialCollision, ipc::VertexVertexTangentialCollision
Public Functions¶
- virtual ~TangentialCollision() = default;¶
- inline int dim() const;¶
Get the dimension of the collision.
- inline int ndof() const;¶
Get the number of degrees of freedom for the collision.
-
virtual MatrixMax<double, 3, 2> compute_tangent_basis(
Eigen::ConstRef<VectorMax12d> positions) const
= 0;¶ Compute the tangent basis of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Tangent basis of the collision.
-
virtual MatrixMax<double, 36, 2> compute_tangent_basis_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const
= 0;¶ Compute the Jacobian of the tangent basis of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Jacobian of the tangent basis of the collision.
-
virtual VectorMax2d compute_closest_point(
Eigen::ConstRef<VectorMax12d> positions) const
= 0;¶ Compute the barycentric coordinates of the closest point.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Barycentric coordinates of the closest point.
-
virtual MatrixMax<double, 2, 12> compute_closest_point_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const
= 0;¶ Compute the Jacobian of the barycentric coordinates of the closest point.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Jacobian of the barycentric coordinates of the closest point.
-
virtual VectorMax3d relative_velocity(
Eigen::ConstRef<VectorMax12d> velocities) const
= 0;¶ Compute the relative velocity of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> velocities¶
Collision stencil’s vertex velocities.
- Returns:¶
Relative velocity of the collision.
-
inline virtual MatrixMax<double, 3, 12>
relative_velocity_matrix() const;¶ Construct the premultiplier matrix for the relative velocity.
Note
Uses the cached closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
virtual MatrixMax<double, 3, 12> relative_velocity_matrix(
Eigen::ConstRef<VectorMax2d> closest_point) const
= 0;¶ Construct the premultiplier matrix for the relative velocity.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
virtual MatrixMax<double, 6, 12> relative_velocity_matrix_jacobian(
Eigen::ConstRef<VectorMax2d> closest_point) const
= 0;¶ Construct the Jacobian of the relative velocity premultiplier wrt the closest points.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
Jacobian of the relative velocity premultiplier wrt the closest points.
Public Members¶
- double normal_force_magnitude;¶
Normal force magnitude.
- double mu_s;¶
Ratio between normal and static tangential forces (e.g., friction coefficient)
- double mu_k;¶
Ratio between normal and kinetic tangential forces (e.g., friction coefficient)
- double weight = 1;¶
Weight.
- Eigen::SparseVector<double> weight_gradient;¶
Gradient of weight with respect to all DOF.
- VectorMax2d closest_point;¶
Barycentric coordinates of the closest point(s)
Protected Functions¶
-
void init(const NormalCollision& collision,
Eigen::ConstRef<VectorMax12d> positions,
const NormalPotential& normal_potential,
const double normal_stiffness);¶ Initialize the collision.
- Parameters:¶
- const NormalCollision &collision¶
NormalCollision stencil.
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- const NormalPotential &normal_potential¶
Normal potential used for normal force.
- const double normal_stiffness¶
Normal potential stiffness.
Vertex-Vertex Tangential Collision¶
-
class VertexVertexTangentialCollision
: public ipc::VertexVertexCandidate,
public ipc::TangentialCollision;¶ Inheritance diagram for ipc::VertexVertexTangentialCollision:
Collaboration diagram for ipc::VertexVertexTangentialCollision:
Public Functions¶
-
VertexVertexTangentialCollision(
const VertexVertexNormalCollision& collision);¶
-
VertexVertexTangentialCollision(
const VertexVertexNormalCollision& collision,
Eigen::ConstRef<VectorMax12d> positions,
const NormalPotential& normal_potential,
const double normal_stiffness);¶
- VertexVertexCandidate(index_t vertex0_id, index_t vertex1_id);¶
Protected Functions¶
-
virtual MatrixMax<double, 3, 2> compute_tangent_basis(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the tangent basis of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Tangent basis of the collision.
-
virtual MatrixMax<double, 36, 2> compute_tangent_basis_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the Jacobian of the tangent basis of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Jacobian of the tangent basis of the collision.
-
virtual VectorMax2d compute_closest_point(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the barycentric coordinates of the closest point.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Barycentric coordinates of the closest point.
-
virtual MatrixMax<double, 2, 12> compute_closest_point_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the Jacobian of the barycentric coordinates of the closest point.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Jacobian of the barycentric coordinates of the closest point.
-
virtual VectorMax3d relative_velocity(
Eigen::ConstRef<VectorMax12d> velocities) const override;¶ Compute the relative velocity of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> velocities¶
Collision stencil’s vertex velocities.
- Returns:¶
Relative velocity of the collision.
-
virtual MatrixMax<double, 3, 12> relative_velocity_matrix(
Eigen::ConstRef<VectorMax2d> closest_point) const override;¶ Construct the premultiplier matrix for the relative velocity.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
virtual MatrixMax<double, 6, 12> relative_velocity_matrix_jacobian(
Eigen::ConstRef<VectorMax2d> closest_point) const override;¶ Construct the Jacobian of the relative velocity premultiplier wrt the closest points.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
Jacobian of the relative velocity premultiplier wrt the closest points.
-
inline virtual MatrixMax<double, 3, 12>
relative_velocity_matrix() const;¶ Construct the premultiplier matrix for the relative velocity.
Note
Uses the cached closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
virtual MatrixMax<double, 3, 12> relative_velocity_matrix(
Eigen::ConstRef<VectorMax2d> closest_point) const
= 0; Construct the premultiplier matrix for the relative velocity.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
VertexVertexTangentialCollision(
Edge-Vertex Tangential Collision¶
-
class EdgeVertexTangentialCollision
: public ipc::EdgeVertexCandidate,
public ipc::TangentialCollision;¶ Inheritance diagram for ipc::EdgeVertexTangentialCollision:
Collaboration diagram for ipc::EdgeVertexTangentialCollision:
Public Functions¶
-
EdgeVertexTangentialCollision(
const EdgeVertexNormalCollision& collision);¶
-
EdgeVertexTangentialCollision(
const EdgeVertexNormalCollision& collision,
Eigen::ConstRef<VectorMax12d> positions,
const NormalPotential& normal_potential,
const double normal_stiffness);¶
Protected Functions¶
-
virtual MatrixMax<double, 3, 2> compute_tangent_basis(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the tangent basis of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Tangent basis of the collision.
-
virtual MatrixMax<double, 36, 2> compute_tangent_basis_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the Jacobian of the tangent basis of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Jacobian of the tangent basis of the collision.
-
virtual VectorMax2d compute_closest_point(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the barycentric coordinates of the closest point.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Barycentric coordinates of the closest point.
-
virtual MatrixMax<double, 2, 12> compute_closest_point_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the Jacobian of the barycentric coordinates of the closest point.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Jacobian of the barycentric coordinates of the closest point.
-
virtual VectorMax3d relative_velocity(
Eigen::ConstRef<VectorMax12d> velocities) const override;¶ Compute the relative velocity of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> velocities¶
Collision stencil’s vertex velocities.
- Returns:¶
Relative velocity of the collision.
-
virtual MatrixMax<double, 3, 12> relative_velocity_matrix(
Eigen::ConstRef<VectorMax2d> closest_point) const override;¶ Construct the premultiplier matrix for the relative velocity.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
virtual MatrixMax<double, 6, 12> relative_velocity_matrix_jacobian(
Eigen::ConstRef<VectorMax2d> closest_point) const override;¶ Construct the Jacobian of the relative velocity premultiplier wrt the closest points.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
Jacobian of the relative velocity premultiplier wrt the closest points.
-
inline virtual MatrixMax<double, 3, 12>
relative_velocity_matrix() const;¶ Construct the premultiplier matrix for the relative velocity.
Note
Uses the cached closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
virtual MatrixMax<double, 3, 12> relative_velocity_matrix(
Eigen::ConstRef<VectorMax2d> closest_point) const
= 0; Construct the premultiplier matrix for the relative velocity.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
EdgeVertexTangentialCollision(
Edge-Edge Tangential Collision¶
-
class EdgeEdgeTangentialCollision : public ipc::EdgeEdgeCandidate,
public ipc::TangentialCollision;¶ Inheritance diagram for ipc::EdgeEdgeTangentialCollision:
Collaboration diagram for ipc::EdgeEdgeTangentialCollision:
Public Functions¶
-
EdgeEdgeTangentialCollision(
const EdgeEdgeNormalCollision& collision);¶
-
EdgeEdgeTangentialCollision(
const EdgeEdgeNormalCollision& collision,
Eigen::ConstRef<VectorMax12d> positions,
const NormalPotential& normal_potential,
const double normal_stiffness);¶
Protected Functions¶
- inline virtual EdgeEdgeDistanceType known_dtype() const override;¶
-
virtual MatrixMax<double, 3, 2> compute_tangent_basis(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the tangent basis of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Tangent basis of the collision.
-
virtual MatrixMax<double, 36, 2> compute_tangent_basis_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the Jacobian of the tangent basis of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Jacobian of the tangent basis of the collision.
-
virtual VectorMax2d compute_closest_point(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the barycentric coordinates of the closest point.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Barycentric coordinates of the closest point.
-
virtual MatrixMax<double, 2, 12> compute_closest_point_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the Jacobian of the barycentric coordinates of the closest point.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Jacobian of the barycentric coordinates of the closest point.
-
virtual VectorMax3d relative_velocity(
Eigen::ConstRef<VectorMax12d> velocities) const override;¶ Compute the relative velocity of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> velocities¶
Collision stencil’s vertex velocities.
- Returns:¶
Relative velocity of the collision.
-
virtual MatrixMax<double, 3, 12> relative_velocity_matrix(
Eigen::ConstRef<VectorMax2d> closest_point) const override;¶ Construct the premultiplier matrix for the relative velocity.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
virtual MatrixMax<double, 6, 12> relative_velocity_matrix_jacobian(
Eigen::ConstRef<VectorMax2d> closest_point) const override;¶ Construct the Jacobian of the relative velocity premultiplier wrt the closest points.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
Jacobian of the relative velocity premultiplier wrt the closest points.
-
inline virtual MatrixMax<double, 3, 12>
relative_velocity_matrix() const;¶ Construct the premultiplier matrix for the relative velocity.
Note
Uses the cached closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
virtual MatrixMax<double, 3, 12> relative_velocity_matrix(
Eigen::ConstRef<VectorMax2d> closest_point) const
= 0; Construct the premultiplier matrix for the relative velocity.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
EdgeEdgeTangentialCollision(
Face-Vertex Tangential Collision¶
-
class FaceVertexTangentialCollision
: public ipc::FaceVertexCandidate,
public ipc::TangentialCollision;¶ Inheritance diagram for ipc::FaceVertexTangentialCollision:
Collaboration diagram for ipc::FaceVertexTangentialCollision:
Public Functions¶
-
FaceVertexTangentialCollision(
const FaceVertexNormalCollision& collision);¶
-
FaceVertexTangentialCollision(
const FaceVertexNormalCollision& collision,
Eigen::ConstRef<VectorMax12d> positions,
const NormalPotential& normal_potential,
const double normal_stiffness);¶
Protected Functions¶
-
virtual MatrixMax<double, 3, 2> compute_tangent_basis(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the tangent basis of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Tangent basis of the collision.
-
virtual MatrixMax<double, 36, 2> compute_tangent_basis_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the Jacobian of the tangent basis of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Jacobian of the tangent basis of the collision.
-
virtual VectorMax2d compute_closest_point(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the barycentric coordinates of the closest point.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Barycentric coordinates of the closest point.
-
virtual MatrixMax<double, 2, 12> compute_closest_point_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const override;¶ Compute the Jacobian of the barycentric coordinates of the closest point.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Collision stencil’s vertex positions.
- Returns:¶
Jacobian of the barycentric coordinates of the closest point.
-
virtual VectorMax3d relative_velocity(
Eigen::ConstRef<VectorMax12d> velocities) const override;¶ Compute the relative velocity of the collision.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> velocities¶
Collision stencil’s vertex velocities.
- Returns:¶
Relative velocity of the collision.
-
virtual MatrixMax<double, 3, 12> relative_velocity_matrix(
Eigen::ConstRef<VectorMax2d> closest_point) const override;¶ Construct the premultiplier matrix for the relative velocity.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
virtual MatrixMax<double, 6, 12> relative_velocity_matrix_jacobian(
Eigen::ConstRef<VectorMax2d> closest_point) const override;¶ Construct the Jacobian of the relative velocity premultiplier wrt the closest points.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
Jacobian of the relative velocity premultiplier wrt the closest points.
-
inline virtual MatrixMax<double, 3, 12>
relative_velocity_matrix() const;¶ Construct the premultiplier matrix for the relative velocity.
Note
Uses the cached closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
virtual MatrixMax<double, 3, 12> relative_velocity_matrix(
Eigen::ConstRef<VectorMax2d> closest_point) const
= 0; Construct the premultiplier matrix for the relative velocity.
- Parameters:¶
- Eigen::ConstRef<VectorMax2d> closest_point¶
Barycentric coordinates of the closest point.
- Returns:¶
A matrix M such that
relative_velocity = M * velocities
.
-
FaceVertexTangentialCollision(