Collision Constraints

struct Constraints

Public Functions

void build(const CollisionMesh &mesh, const Eigen::MatrixXd &V, const double dhat, const double dmin = 0, const BroadPhaseMethod method = BroadPhaseMethod::HASH_GRID)

Construct a set of constraints used to compute the barrier potential.

Parameters:
const CollisionMesh &mesh

The collision mesh.

const Eigen::MatrixXd &V

Vertices of the collision mesh.

const double dhat

The activation distance of the barrier.

const double dmin = 0

Minimum distance.

const BroadPhaseMethod method = BroadPhaseMethod::HASH_GRID

Broad-phase method to use.

void build(const Candidates &candidates, const CollisionMesh &mesh, const Eigen::MatrixXd &V, const double dhat, const double dmin = 0)

Construct a 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 &V

Vertices of the collision mesh.

const double dhat

The activation distance of the barrier.

const double dmin = 0

Minimum distance.

size_t size() const
bool empty() const
void clear()
CollisionConstraint &operator[](size_t idx)
const CollisionConstraint &operator[](size_t idx) 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
bool use_convergent_formulation = false
bool compute_shape_derivatives = false
struct Builder

Collaboration diagram for ipc::Constraints::Builder:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "4" [label="unordered_map< ipc::VertexVertexConstraint, long >" tooltip="unordered_map< ipc::VertexVertexConstraint, long >"] "2" [label="ipc::Constraints" tooltip="ipc::Constraints"] "1" [label="ipc::Constraints::Builder" tooltip="ipc::Constraints::Builder" fillcolor="#BFBFBF"] "3" [label="unordered_map< ipc::EdgeVertexConstraint, long >" tooltip="unordered_map< ipc::EdgeVertexConstraint, long >"] "1" -> "2" [dir=forward tooltip="usage"] "1" -> "3" [dir=forward tooltip="usage"] "1" -> "4" [dir=forward tooltip="usage"] }

Public Members

unordered_map<VertexVertexConstraint, long> vv_to_index
unordered_map<EdgeVertexConstraint, long> ev_to_index
Constraints constraint_set
struct CollisionConstraint

Inheritence diagram for ipc::CollisionConstraint:

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

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

Public Functions

inline virtual ~CollisionConstraint()
virtual int num_vertices() const = 0
virtual std::array<long, 4> vertex_indices(const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const = 0

Get the indices of the vertices.

Parameters:
const Eigen::MatrixXi &E

edge matrix of mesh

const Eigen::MatrixXi &F

face matrix of mesh

Returns:

List of vertex indices

virtual double compute_distance(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const = 0
virtual VectorMax12d compute_distance_gradient(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const = 0
virtual MatrixMax12d compute_distance_hessian(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const = 0
virtual double compute_potential(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F, const double dhat) const
virtual VectorMax12d compute_potential_gradient(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F, const double dhat) const
virtual MatrixMax12d compute_potential_hessian(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F, const double dhat, const bool project_hessian_to_psd) const

Public Members

double minimum_distance = 0
double weight = 1
Eigen::SparseVector<double> weight_gradient
struct VertexVertexConstraint : public ipc::VertexVertexCandidate, public ipc::CollisionConstraint

Inheritence diagram for ipc::VertexVertexConstraint:

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

Public Functions

inline VertexVertexConstraint(const VertexVertexCandidate &candidate)
inline virtual int num_vertices() const override
inline virtual std::array<long, 4> vertex_indices(const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override

Get the indices of the vertices.

Parameters:
const Eigen::MatrixXi &E

edge matrix of mesh

const Eigen::MatrixXi &F

face matrix of mesh

Returns:

List of vertex indices

inline virtual double compute_distance(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
inline virtual VectorMax12d compute_distance_gradient(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
inline virtual MatrixMax12d compute_distance_hessian(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
VertexVertexCandidate(long vertex0_index, long vertex1_index)

Friends

template<typename H>
inline friend H AbslHashValue(H h, const VertexVertexConstraint &vv)
struct EdgeVertexConstraint : public ipc::EdgeVertexCandidate, public ipc::CollisionConstraint

Inheritence diagram for ipc::EdgeVertexConstraint:

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

Public Functions

inline EdgeVertexConstraint(const EdgeVertexCandidate &candidate)
inline virtual int num_vertices() const override
inline virtual std::array<long, 4> vertex_indices(const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override

Get the indices of the vertices.

Parameters:
const Eigen::MatrixXi &E

edge matrix of mesh

const Eigen::MatrixXi &F

face matrix of mesh

Returns:

List of vertex indices

inline virtual double compute_distance(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
inline virtual VectorMax12d compute_distance_gradient(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
inline virtual MatrixMax12d compute_distance_hessian(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
EdgeVertexCandidate(long edge_index, long vertex_index)

Friends

template<typename H>
inline friend H AbslHashValue(H h, const EdgeVertexConstraint &ev)
struct EdgeEdgeConstraint : public ipc::EdgeEdgeCandidate, public ipc::CollisionConstraint

Inheritence diagram for ipc::EdgeEdgeConstraint:

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

Public Functions

EdgeEdgeConstraint(long edge0_index, long edge1_index, double eps_x)
EdgeEdgeConstraint(const EdgeEdgeCandidate &candidate, double eps_x)
inline virtual int num_vertices() const override
inline virtual std::array<long, 4> vertex_indices(const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override

Get the indices of the vertices.

Parameters:
const Eigen::MatrixXi &E

edge matrix of mesh

const Eigen::MatrixXi &F

face matrix of mesh

Returns:

List of vertex indices

inline virtual double compute_distance(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
inline virtual VectorMax12d compute_distance_gradient(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
inline virtual MatrixMax12d compute_distance_hessian(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
virtual double compute_potential(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F, const double dhat) const override
virtual VectorMax12d compute_potential_gradient(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F, const double dhat) const override
virtual MatrixMax12d compute_potential_hessian(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F, const double dhat, const bool project_hessian_to_psd) const override

Public Members

double eps_x

Friends

template<typename H>
inline friend H AbslHashValue(H h, const EdgeEdgeConstraint &ee)
struct FaceVertexConstraint : public ipc::FaceVertexCandidate, public ipc::CollisionConstraint

Inheritence diagram for ipc::FaceVertexConstraint:

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

Public Functions

inline FaceVertexConstraint(const FaceVertexCandidate &candidate)
inline virtual int num_vertices() const override
inline virtual std::array<long, 4> vertex_indices(const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override

Get the indices of the vertices.

Parameters:
const Eigen::MatrixXi &E

edge matrix of mesh

const Eigen::MatrixXi &F

face matrix of mesh

Returns:

List of vertex indices

inline virtual double compute_distance(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
inline virtual VectorMax12d compute_distance_gradient(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
inline virtual MatrixMax12d compute_distance_hessian(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
FaceVertexCandidate(long face_index, long vertex_index)

Friends

template<typename H>
inline friend H AbslHashValue(H h, const FaceVertexConstraint &fv)
struct PlaneVertexConstraint : public ipc::CollisionConstraint

Inheritence diagram for ipc::PlaneVertexConstraint:

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

Public Functions

PlaneVertexConstraint(const VectorMax3d &plane_origin, const VectorMax3d &plane_normal, const long vertex_index)
inline virtual int num_vertices() const override
inline virtual std::array<long, 4> vertex_indices(const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override

Get the indices of the vertices.

Parameters:
const Eigen::MatrixXi &E

edge matrix of mesh

const Eigen::MatrixXi &F

face matrix of mesh

Returns:

List of vertex indices

virtual double compute_distance(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
virtual VectorMax12d compute_distance_gradient(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override
virtual MatrixMax12d compute_distance_hessian(const Eigen::MatrixXd &V, const Eigen::MatrixXi &E, const Eigen::MatrixXi &F) const override

Public Members

VectorMax3d plane_origin
VectorMax3d plane_normal
long vertex_index

Last update: January 26, 2023