Collision Constraints

Collision Constraints

class CollisionConstraints;

Public Functions

inline CollisionConstraints();
void build(const CollisionMeshmesh,
    
const Eigen::MatrixXdverticesconst double dhat,
    
const double dmin = 0,
    
const BroadPhaseMethod broad_phase_method
    
= DEFAULT_BROAD_PHASE_METHOD
);

Initialize the set of constraints used to compute the barrier potential.

Parameters:
const CollisionMesh &mesh

The collision mesh.

const Eigen::MatrixXd &vertices

Vertices of the collision mesh.

const double dhat

The activation distance of the barrier.

const double dmin = 0

Minimum distance.

const BroadPhaseMethod broad_phase_method = DEFAULT_BROAD_PHASE_METHOD

Broad-phase method to use.

void build(const Candidatescandidatesconst CollisionMeshmesh,
    
const Eigen::MatrixXdverticesconst double dhat,
    
const double dmin = 0);

Initialize the set of constraints used to compute the barrier potential.

Parameters:
const Candidates &candidates

Distance candidates from which the constraint set is built.

const CollisionMesh &mesh

The collision mesh.

const Eigen::MatrixXd &vertices

Vertices of the collision mesh.

const double dhat

The activation distance of the barrier.

const double dmin = 0

Minimum distance.

double compute_potential(const CollisionMeshmesh,
    
const Eigen::MatrixXdverticesconst double dhat) const;

Compute the barrier potential for a given constraint set.

Parameters:
const CollisionMesh &mesh

The collision mesh.

const Eigen::MatrixXd &vertices

Vertices of the collision mesh.

const double dhat

The activation distance of the barrier.

Returns:

The sum of all barrier potentials (not scaled by the barrier stiffness).

Eigen::VectorXd compute_potential_gradient(
    
const CollisionMeshmeshconst Eigen::MatrixXdvertices,
    
const double dhat) const;

Compute the gradient of the barrier potential.

Parameters:
const CollisionMesh &mesh

The collision mesh.

const Eigen::MatrixXd &vertices

Vertices of the collision mesh.

const double dhat

The activation distance of the barrier.

Returns:

The gradient of all barrier potentials (not scaled by the barrier stiffness). This will have a size of |vertices|.

Eigen::SparseMatrix<double> compute_potential_hessian(
    
const CollisionMeshmeshconst Eigen::MatrixXdvertices,
    
const double dhat,
    
const bool project_hessian_to_psd = false) const;

Compute the hessian of the barrier potential.

Parameters:
const CollisionMesh &mesh

The collision mesh.

const Eigen::MatrixXd &vertices

Vertices of the collision mesh.

const double dhat

The activation distance of the barrier.

const bool project_hessian_to_psd = false

Make sure the hessian is positive semi-definite.

Returns:

The hessian of all barrier potentials (not scaled by the barrier stiffness). This will have a size of |vertices|x|vertices|.

Eigen::SparseMatrix<double> compute_shape_derivative(
    
const CollisionMeshmeshconst Eigen::MatrixXdvertices,
    
const double dhat) const;

Compute the barrier shape derivative.

Parameters:
const CollisionMesh &mesh

The collision mesh.

const Eigen::MatrixXd &vertices

Vertices of the collision mesh.

const double dhat

The activation distance of the barrier.

Throws:

std::runtime_error – If the collision constraints were not built with shape derivatives enabled.

Returns:

The derivative of the force with respect to X, the rest vertices.

double compute_minimum_distance(const CollisionMeshmesh,
    
const Eigen::MatrixXdvertices) const;

Computes the minimum distance between any non-adjacent elements.

Parameters:
const CollisionMesh &mesh

The collision mesh.

const Eigen::MatrixXd &vertices

Vertices of the collision mesh.

Returns:

The minimum distance between any non-adjacent elements.

size_t size() const;

Get the number of collision constraints.

bool empty() const;

Get if the collision constraints are empty.

void clear();

Clear the collision constraints.

CollisionConstraintoperator[](size_t idx);

Get a reference to constriant idx.

Parameters:
size_t idx

The index of the constraint.

Returns:

A reference to the constraint.

const CollisionConstraintoperator[](size_t idx) const;

Get a const reference to constriant idx.

Parameters:
size_t idx

The index of the constraint.

Returns:

A const reference to the constraint.

bool is_vertex_vertex(size_t idx) const;

Get if the constraint at idx is a vertex-vertex constraint.

Parameters:
size_t idx

The index of the constraint.

Returns:

If the constraint at idx is a vertex-vertex constraint.

bool is_edge_vertex(size_t idx) const;

Get if the constraint at idx is an edge-vertex constraint.

Parameters:
size_t idx

The index of the constraint.

Returns:

If the constraint at idx is an edge-vertex constraint.

bool is_edge_edge(size_t idx) const;

Get if the constraint at idx is an edge-edge constraint.

Parameters:
size_t idx

The index of the constraint.

Returns:

If the constraint at idx is an edge-edge constraint.

bool is_face_vertex(size_t idx) const;

Get if the constraint at idx is an face-vertex constraint.

Parameters:
size_t idx

The index of the constraint.

Returns:

If the constraint at idx is an face-vertex constraint.

bool is_plane_vertex(size_t idx) const;

Get if the constraint at idx is an plane-vertex constraint.

Parameters:
size_t idx

The index of the constraint.

Returns:

If the constraint at idx is an plane-vertex constraint.

inline bool use_convergent_formulation() const;

Get if the collision constraints should use the convergent formulation.

Note

If not empty, this is the current value not necessarily the value used to build the constraints.

Returns:

If the collision constraints should use the convergent formulation.

void set_use_convergent_formulation(
    
const bool use_convergent_formulation);

Set if the collision constraints should use the convergent formulation.

Warning

This must be set before the constraints are built.

Parameters:
const bool use_convergent_formulation

If the collision constraints should use the convergent formulation.

inline bool are_shape_derivatives_enabled() const;

Get if the collision constraints are using the convergent formulation.

Note

If not empty, this is the current value not necessarily the value used to build the constraints.

Returns:

If the collision constraints are using the convergent formulation.

void set_are_shape_derivatives_enabled(
    
const bool are_shape_derivatives_enabled);

Set if the collision constraints should enable shape derivative computation.

Warning

This must be set before the constraints are built.

Parameters:
const bool are_shape_derivatives_enabled

If the collision constraints should enable shape derivative computation.

std::string to_string(const CollisionMeshmesh,
    
const Eigen::MatrixXdvertices) const;

Public Members

std::vector<VertexVertexConstraint> vv_constraints;
std::vector<EdgeVertexConstraint> ev_constraints;
std::vector<EdgeEdgeConstraint> ee_constraints;
std::vector<FaceVertexConstraint> fv_constraints;
std::vector<PlaneVertexConstraint> pv_constraints;

Protected Attributes

bool m_use_convergent_formulation = false;
bool m_are_shape_derivatives_enabled = false;

Collision Constraint

class CollisionConstraint : public virtual ipc::CollisionStencil;

Inheritance diagram for ipc::CollisionConstraint:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "1" [label="ipc::CollisionConstraint" tooltip="ipc::CollisionConstraint" fillcolor="#BFBFBF"] "2" [label="ipc::CollisionStencil" tooltip="ipc::CollisionStencil"] "3" [label="ipc::EdgeEdgeConstraint" tooltip="ipc::EdgeEdgeConstraint"] "4" [label="ipc::EdgeVertexConstraint" tooltip="ipc::EdgeVertexConstraint"] "5" [label="ipc::FaceVertexConstraint" tooltip="ipc::FaceVertexConstraint"] "6" [label="ipc::PlaneVertexConstraint" tooltip="ipc::PlaneVertexConstraint"] "7" [label="ipc::VertexVertexConstraint" tooltip="ipc::VertexVertexConstraint"] "1" -> "2" [dir=forward tooltip="public-inheritance"] "3" -> "1" [dir=forward tooltip="public-inheritance"] "4" -> "1" [dir=forward tooltip="public-inheritance"] "5" -> "1" [dir=forward tooltip="public-inheritance"] "6" -> "1" [dir=forward tooltip="public-inheritance"] "7" -> "1" [dir=forward tooltip="public-inheritance"] }

Collaboration diagram for ipc::CollisionConstraint:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "1" [label="ipc::CollisionConstraint" tooltip="ipc::CollisionConstraint" fillcolor="#BFBFBF"] "2" [label="ipc::CollisionStencil" tooltip="ipc::CollisionStencil"] "1" -> "2" [dir=forward tooltip="public-inheritance"] }

Subclassed by ipc::EdgeEdgeConstraint, ipc::EdgeVertexConstraint, ipc::FaceVertexConstraint, ipc::PlaneVertexConstraint, ipc::VertexVertexConstraint

Public Functions

CollisionConstraint() = default;
CollisionConstraint(const double weight,
    
const Eigen::SparseVector<double>& weight_gradient);
inline virtual ~CollisionConstraint();
virtual double compute_potential(const Eigen::MatrixXdvertices,
    
const Eigen::MatrixXiedgesconst Eigen::MatrixXifaces,
    
const double dhat) const;
virtual VectorMax12d compute_potential_gradient(
    
const Eigen::MatrixXdverticesconst Eigen::MatrixXiedges,
    
const Eigen::MatrixXifacesconst double dhat) const;
virtual MatrixMax12d compute_potential_hessian(
    
const Eigen::MatrixXdverticesconst Eigen::MatrixXiedges,
    
const Eigen::MatrixXifacesconst double dhat,
    
const bool project_hessian_to_psd) const;
virtual void compute_shape_derivative(
    
const Eigen::MatrixXdrest_positions,
    
const Eigen::MatrixXdverticesconst Eigen::MatrixXiedges,
    
const Eigen::MatrixXifacesconst double dhat,
    
std::vector<Eigen::Triplet<double>>& triplets) const;

Compute the derivative of the potential gradient wrt the shape.

Public Members

double dmin = 0;
double weight = 1;
Eigen::SparseVector<double> weight_gradient;

Protected Functions

virtual void compute_shape_derivative_first_term(
    
const Eigen::MatrixXdrest_positions,
    
const Eigen::MatrixXdverticesconst Eigen::MatrixXiedges,
    
const Eigen::MatrixXifacesconst double dhat,
    
std::vector<Eigen::Triplet<double>>& triplets) const;

Compute (∇ₓw)(∇ᵤb)ᵀ

virtual MatrixMax12d compute_shape_derivative_second_term(
    
const Eigen::MatrixXdrest_positions,
    
const Eigen::MatrixXdverticesconst Eigen::MatrixXiedges,
    
const Eigen::MatrixXifacesconst double dhat) const;

Compute w ∇ₓ∇ᵤb.

Vertex-Vertex Collision Constraint

class VertexVertexConstraint : public ipc::VertexVertexCandidate,
                               public ipc::CollisionConstraint;

Inheritance diagram for ipc::VertexVertexConstraint:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "5" [label="ipc::CollisionConstraint" tooltip="ipc::CollisionConstraint"] "4" [label="ipc::CollisionStencil" tooltip="ipc::CollisionStencil"] "3" [label="ipc::ContinuousCollisionCandidate" tooltip="ipc::ContinuousCollisionCandidate"] "2" [label="ipc::VertexVertexCandidate" tooltip="ipc::VertexVertexCandidate"] "1" [label="ipc::VertexVertexConstraint" tooltip="ipc::VertexVertexConstraint" fillcolor="#BFBFBF"] "5" -> "4" [dir=forward tooltip="public-inheritance"] "3" -> "4" [dir=forward tooltip="public-inheritance"] "2" -> "3" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] "1" -> "5" [dir=forward tooltip="public-inheritance"] }

Collaboration diagram for ipc::VertexVertexConstraint:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "5" [label="ipc::CollisionConstraint" tooltip="ipc::CollisionConstraint"] "4" [label="ipc::CollisionStencil" tooltip="ipc::CollisionStencil"] "3" [label="ipc::ContinuousCollisionCandidate" tooltip="ipc::ContinuousCollisionCandidate"] "2" [label="ipc::VertexVertexCandidate" tooltip="ipc::VertexVertexCandidate"] "1" [label="ipc::VertexVertexConstraint" tooltip="ipc::VertexVertexConstraint" fillcolor="#BFBFBF"] "5" -> "4" [dir=forward tooltip="public-inheritance"] "3" -> "4" [dir=forward tooltip="public-inheritance"] "2" -> "3" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] "1" -> "5" [dir=forward tooltip="public-inheritance"] }

Public Functions

inline VertexVertexConstraint(
    
const VertexVertexCandidatecandidate);
inline VertexVertexConstraint(const long _vertex0_id,
    
const long _vertex1_idconst double _weight,
    
const Eigen::SparseVector<double>& _weight_gradient);
VertexVertexCandidate(long vertex0_idlong vertex1_id);

Friends

template <typename H>
inline friend H AbslHashValue(
    
H hconst VertexVertexConstraintvv);

Edge-Vertex Collision Constraint

class EdgeVertexConstraint : public ipc::EdgeVertexCandidate,
                             public ipc::CollisionConstraint;

Inheritance diagram for ipc::EdgeVertexConstraint:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "5" [label="ipc::CollisionConstraint" tooltip="ipc::CollisionConstraint"] "4" [label="ipc::CollisionStencil" tooltip="ipc::CollisionStencil"] "3" [label="ipc::ContinuousCollisionCandidate" tooltip="ipc::ContinuousCollisionCandidate"] "2" [label="ipc::EdgeVertexCandidate" tooltip="ipc::EdgeVertexCandidate"] "1" [label="ipc::EdgeVertexConstraint" tooltip="ipc::EdgeVertexConstraint" fillcolor="#BFBFBF"] "5" -> "4" [dir=forward tooltip="public-inheritance"] "3" -> "4" [dir=forward tooltip="public-inheritance"] "2" -> "3" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] "1" -> "5" [dir=forward tooltip="public-inheritance"] }

Collaboration diagram for ipc::EdgeVertexConstraint:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "5" [label="ipc::CollisionConstraint" tooltip="ipc::CollisionConstraint"] "4" [label="ipc::CollisionStencil" tooltip="ipc::CollisionStencil"] "3" [label="ipc::ContinuousCollisionCandidate" tooltip="ipc::ContinuousCollisionCandidate"] "2" [label="ipc::EdgeVertexCandidate" tooltip="ipc::EdgeVertexCandidate"] "1" [label="ipc::EdgeVertexConstraint" tooltip="ipc::EdgeVertexConstraint" fillcolor="#BFBFBF"] "5" -> "4" [dir=forward tooltip="public-inheritance"] "3" -> "4" [dir=forward tooltip="public-inheritance"] "2" -> "3" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] "1" -> "5" [dir=forward tooltip="public-inheritance"] }

Public Functions

inline EdgeVertexConstraint(const EdgeVertexCandidatecandidate);
inline EdgeVertexConstraint(const long _edge_id,
    
const long _vertex_idconst double _weight,
    
const Eigen::SparseVector<double>& _weight_gradient);
EdgeVertexCandidate(long edge_idlong vertex_id);

Protected Functions

inline virtual PointEdgeDistanceType known_dtype() const override;

Friends

template <typename H>
inline friend H AbslHashValue(H hconst EdgeVertexConstraintev);

Edge-Edge Collision Constraint

class EdgeEdgeConstraint : public ipc::EdgeEdgeCandidate,
                           public ipc::CollisionConstraint;

Inheritance diagram for ipc::EdgeEdgeConstraint:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "5" [label="ipc::CollisionConstraint" tooltip="ipc::CollisionConstraint"] "4" [label="ipc::CollisionStencil" tooltip="ipc::CollisionStencil"] "3" [label="ipc::ContinuousCollisionCandidate" tooltip="ipc::ContinuousCollisionCandidate"] "2" [label="ipc::EdgeEdgeCandidate" tooltip="ipc::EdgeEdgeCandidate"] "1" [label="ipc::EdgeEdgeConstraint" tooltip="ipc::EdgeEdgeConstraint" fillcolor="#BFBFBF"] "5" -> "4" [dir=forward tooltip="public-inheritance"] "3" -> "4" [dir=forward tooltip="public-inheritance"] "2" -> "3" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] "1" -> "5" [dir=forward tooltip="public-inheritance"] }

Collaboration diagram for ipc::EdgeEdgeConstraint:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "5" [label="ipc::CollisionConstraint" tooltip="ipc::CollisionConstraint"] "4" [label="ipc::CollisionStencil" tooltip="ipc::CollisionStencil"] "3" [label="ipc::ContinuousCollisionCandidate" tooltip="ipc::ContinuousCollisionCandidate"] "2" [label="ipc::EdgeEdgeCandidate" tooltip="ipc::EdgeEdgeCandidate"] "1" [label="ipc::EdgeEdgeConstraint" tooltip="ipc::EdgeEdgeConstraint" fillcolor="#BFBFBF"] "5" -> "4" [dir=forward tooltip="public-inheritance"] "3" -> "4" [dir=forward tooltip="public-inheritance"] "2" -> "3" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] "1" -> "5" [dir=forward tooltip="public-inheritance"] }

Public Functions

EdgeEdgeConstraint(const long edge0_idconst long edge1_id,
    
const double eps_x,
    
const EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO);
EdgeEdgeConstraint(const EdgeEdgeCandidatecandidate,
    
const double eps_x,
    
const EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO);
EdgeEdgeConstraint(const long edge0_idconst long edge1_id,
    
const double eps_xconst double weight,
    
const Eigen::SparseVector<double>& weight_gradient,
    
const EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO);
virtual double compute_potential(const Eigen::MatrixXdvertices,
    
const Eigen::MatrixXiedgesconst Eigen::MatrixXifaces,
    
const double dhat) const override;
virtual VectorMax12d compute_potential_gradient(
    
const Eigen::MatrixXdverticesconst Eigen::MatrixXiedges,
    
const Eigen::MatrixXifacesconst double dhat) const override;
virtual MatrixMax12d compute_potential_hessian(
    
const Eigen::MatrixXdverticesconst Eigen::MatrixXiedges,
    
const Eigen::MatrixXifacesconst double dhat,
    
const bool project_hessian_to_psd) const override;
bool operator==(const EdgeEdgeConstraintother) const;
bool operator!=(const EdgeEdgeConstraintother) const;
bool operator<(const EdgeEdgeConstraintother) const;

Public Members

double eps_x;

Mollifier activation threshold.

EdgeEdgeDistanceType dtype;

Cached distance type.

Some EE constraints are mollified EV or VV constraints.

Protected Functions

inline virtual EdgeEdgeDistanceType known_dtype() const override;
virtual MatrixMax12d compute_shape_derivative_second_term(
    
const Eigen::MatrixXdrest_positions,
    
const Eigen::MatrixXdverticesconst Eigen::MatrixXiedges,
    
const Eigen::MatrixXifacesconst double dhat) const override;

Compute w ∇ₓ∇ᵤb.

Friends

template <typename H>
inline friend H AbslHashValue(H hconst EdgeEdgeConstraintee);

Face-Vertex Collision Constraint

class FaceVertexConstraint : public ipc::FaceVertexCandidate,
                             public ipc::CollisionConstraint;

Inheritance diagram for ipc::FaceVertexConstraint:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "5" [label="ipc::CollisionConstraint" tooltip="ipc::CollisionConstraint"] "4" [label="ipc::CollisionStencil" tooltip="ipc::CollisionStencil"] "3" [label="ipc::ContinuousCollisionCandidate" tooltip="ipc::ContinuousCollisionCandidate"] "2" [label="ipc::FaceVertexCandidate" tooltip="ipc::FaceVertexCandidate"] "1" [label="ipc::FaceVertexConstraint" tooltip="ipc::FaceVertexConstraint" fillcolor="#BFBFBF"] "5" -> "4" [dir=forward tooltip="public-inheritance"] "3" -> "4" [dir=forward tooltip="public-inheritance"] "2" -> "3" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] "1" -> "5" [dir=forward tooltip="public-inheritance"] }

Collaboration diagram for ipc::FaceVertexConstraint:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "5" [label="ipc::CollisionConstraint" tooltip="ipc::CollisionConstraint"] "4" [label="ipc::CollisionStencil" tooltip="ipc::CollisionStencil"] "3" [label="ipc::ContinuousCollisionCandidate" tooltip="ipc::ContinuousCollisionCandidate"] "2" [label="ipc::FaceVertexCandidate" tooltip="ipc::FaceVertexCandidate"] "1" [label="ipc::FaceVertexConstraint" tooltip="ipc::FaceVertexConstraint" fillcolor="#BFBFBF"] "5" -> "4" [dir=forward tooltip="public-inheritance"] "3" -> "4" [dir=forward tooltip="public-inheritance"] "2" -> "3" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] "1" -> "5" [dir=forward tooltip="public-inheritance"] }

Public Functions

inline FaceVertexConstraint(const FaceVertexCandidatecandidate);
inline FaceVertexConstraint(const long _face_id,
    
const long _vertex_idconst double _weight,
    
const Eigen::SparseVector<double>& _weight_gradient);
FaceVertexCandidate(long face_idlong vertex_id);

Protected Functions

inline virtual PointTriangleDistanceType
known_dtype() const override;

Friends

template <typename H>
inline friend H AbslHashValue(H hconst FaceVertexConstraintfv);

Plane-Vertex Collision Constraint

class PlaneVertexConstraint : public ipc::CollisionConstraint;

Inheritance diagram for ipc::PlaneVertexConstraint:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="ipc::CollisionConstraint" tooltip="ipc::CollisionConstraint"] "3" [label="ipc::CollisionStencil" tooltip="ipc::CollisionStencil"] "1" [label="ipc::PlaneVertexConstraint" tooltip="ipc::PlaneVertexConstraint" fillcolor="#BFBFBF"] "2" -> "3" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] }

Collaboration diagram for ipc::PlaneVertexConstraint:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="ipc::CollisionConstraint" tooltip="ipc::CollisionConstraint"] "3" [label="ipc::CollisionStencil" tooltip="ipc::CollisionStencil"] "1" [label="ipc::PlaneVertexConstraint" tooltip="ipc::PlaneVertexConstraint" fillcolor="#BFBFBF"] "2" -> "3" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] }

Public Functions

PlaneVertexConstraint(const VectorMax3dplane_origin,
    
const VectorMax3dplane_normalconst long vertex_id);
inline virtual int num_vertices() const override;

Get the number of vertices in the contact stencil.

inline virtual std::array<long, 4> vertex_ids(
    
const Eigen::MatrixXiedges,
    
const Eigen::MatrixXifaces) const override;

Get the vertex IDs of the contact stencil.

Parameters:
const Eigen::MatrixXi &edges

Collision mesh edges

const Eigen::MatrixXi &faces

Collision mesh faces

Returns:

The vertex IDs of the contact stencil. Size is always 4, but elements i > num_vertices() are -1.

Public Members

VectorMax3d plane_origin;
VectorMax3d plane_normal;
long vertex_id;

Protected Functions

virtual double compute_distance(
    
const VectorMax12dpoint) const override;

Compute the distance between the point and plane.

Parameters:
const VectorMax12d &point

Point’s position.

Returns:

Distance of the stencil.

virtual VectorMax12d compute_distance_gradient(
    
const VectorMax12dpoint) const override;

Compute the gradient of the distance w.r.t.

the point’s positions.

Parameters:
const VectorMax12d &point

Point’s position.

Returns:

Distance gradient w.r.t. the point’s positions.

virtual MatrixMax12d compute_distance_hessian(
    
const VectorMax12dpoint) const override;

Compute the distance Hessian of the stencil w.r.t.

the stencil’s vertex positions.

Parameters:
const VectorMax12d &point

Point’s position.

Returns:

Distance Hessian w.r.t. the point’s positions.