Collisions¶
Collisions¶
- class Collisions;¶
Public Types¶
- using value_type = Collision;¶
The type of the collisions.
Public Functions¶
- Collisions() = default;¶
-
void build(const CollisionMesh& mesh,
const Eigen::MatrixXd& vertices, const double dhat,
const double dmin = 0,
const BroadPhaseMethod broad_phase_method
= DEFAULT_BROAD_PHASE_METHOD);¶ Initialize the set of collisions 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 Candidates& candidates, const CollisionMesh& mesh,
const Eigen::MatrixXd& vertices, const double dhat,
const double dmin = 0);¶ Initialize the set of collisions used to compute the barrier potential.
- Parameters:¶
- const Candidates &candidates¶
Distance candidates from which the collision 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_minimum_distance(const CollisionMesh& mesh,
const Eigen::MatrixXd& vertices) 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 collisions.
- bool empty() const;¶
Get if the collision set are empty.
- void clear();¶
Clear the collision set.
- inline bool use_area_weighting() const;¶
Get if the collision set should use area weighting.
Note
If not empty, this is the current value not necessarily the value used to build the collisions.
- Returns:¶
If the collision set should use area weighting.
- void set_use_area_weighting(const bool use_area_weighting);¶
Set if the collision set should use area weighting.
Warning
This must be set before the collisions are built.
- inline bool use_improved_max_approximator() const;¶
Get if the collision set should use the improved max approximator.
Note
If not empty, this is the current value not necessarily the value used to build the collisions.
- Returns:¶
If the collision set should use the improved max approximator.
-
void set_use_improved_max_approximator(
const bool use_improved_max_approximator);¶ Set if the collision set should use the improved max approximator.
Warning
This must be set before the collisions are built.
- inline bool enable_shape_derivatives() const;¶
Get if the collision set are using the convergent formulation.
Note
If not empty, this is the current value not necessarily the value used to build the collisions.
- Returns:¶
If the collision set are using the convergent formulation.
-
void set_enable_shape_derivatives(
const bool enable_shape_derivatives);¶ Set if the collision set should enable shape derivative computation.
Warning
This must be set before the collisions are built.
-
std::string to_string(const CollisionMesh& mesh,
const Eigen::MatrixXd& vertices) const;¶
Public Members¶
- std::vector<VertexVertexCollision> vv_collisions;¶
- std::vector<EdgeVertexCollision> ev_collisions;¶
- std::vector<EdgeEdgeCollision> ee_collisions;¶
- std::vector<FaceVertexCollision> fv_collisions;¶
- std::vector<PlaneVertexCollision> pv_collisions;¶
Collision¶
- class Collision : public virtual ipc::CollisionStencil;¶
Inheritance diagram for ipc::Collision:
Collaboration diagram for ipc::Collision:
Subclassed by ipc::EdgeEdgeCollision, ipc::EdgeVertexCollision, ipc::FaceVertexCollision, ipc::PlaneVertexCollision, ipc::VertexVertexCollision
Public Functions¶
- Collision() = default;¶
-
Collision(const double weight,
const Eigen::SparseVector<double>& weight_gradient);¶
- virtual ~Collision() = default;¶
- inline virtual bool is_mollified() const;¶
Does the distance potentially have to be mollified?
-
inline virtual double mollifier_threshold(
const VectorMax12d& rest_positions) const;¶ Compute the mollifier threshold for the distance.
- virtual double mollifier(const VectorMax12d& positions) const;¶
Compute the mollifier for the distance.
-
virtual double mollifier(
const VectorMax12d& positions, double eps_x) const;¶ Compute the mollifier for the distance.
-
virtual VectorMax12d mollifier_gradient(
const VectorMax12d& positions) const;¶ Compute the gradient of the mollifier for the distance wrt the positions.
-
virtual VectorMax12d mollifier_gradient(
const VectorMax12d& positions, double eps_x) const;¶ Compute the gradient of the mollifier for the distance wrt the positions.
-
virtual MatrixMax12d mollifier_hessian(
const VectorMax12d& positions) const;¶ Compute the Hessian of the mollifier for the distance wrt the positions.
-
virtual MatrixMax12d mollifier_hessian(
const VectorMax12d& positions, double eps_x) const;¶ Compute the Hessian of the mollifier for the distance wrt the positions.
-
virtual Vector12d mollifier_gradient_wrt_x(
const VectorMax12d& rest_positions,
const VectorMax12d& positions) const;¶ Compute the gradient of the mollifier for the distance w.r.t.
rest positions.
-
virtual Matrix12d mollifier_gradient_jacobian_wrt_x(
const VectorMax12d& rest_positions,
const VectorMax12d& positions) const;¶ Compute the jacobian of the distance mollifier’s gradient w.r.t.
rest positions.
Vertex-Vertex Collision¶
-
class VertexVertexCollision : public ipc::VertexVertexCandidate,
public ipc::Collision;¶ Inheritance diagram for ipc::VertexVertexCollision:
Collaboration diagram for ipc::VertexVertexCollision:
Public Functions¶
-
inline VertexVertexCollision(
const VertexVertexCandidate& candidate);¶
-
inline VertexVertexCollision(const long _vertex0_id,
const long _vertex1_id, const double _weight,
const Eigen::SparseVector<double>& _weight_gradient);¶
- VertexVertexCandidate(long vertex0_id, long vertex1_id);¶
-
inline VertexVertexCollision(
Edge-Vertex Collision¶
-
class EdgeVertexCollision : public ipc::EdgeVertexCandidate,
public ipc::Collision;¶ Inheritance diagram for ipc::EdgeVertexCollision:
Collaboration diagram for ipc::EdgeVertexCollision:
Public Functions¶
- inline EdgeVertexCollision(const EdgeVertexCandidate& candidate);¶
-
inline EdgeVertexCollision(const long _edge_id,
const long _vertex_id, const double _weight,
const Eigen::SparseVector<double>& _weight_gradient);¶
- inline virtual PointEdgeDistanceType known_dtype() const override;¶
Edge-Edge Collision¶
-
class EdgeEdgeCollision : public ipc::EdgeEdgeCandidate,
public ipc::Collision;¶ Inheritance diagram for ipc::EdgeEdgeCollision:
Collaboration diagram for ipc::EdgeEdgeCollision:
Public Functions¶
-
EdgeEdgeCollision(const long edge0_id, const long edge1_id,
const double eps_x,
const EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO);¶
-
EdgeEdgeCollision(const EdgeEdgeCandidate& candidate,
const double eps_x,
const EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO);¶
-
EdgeEdgeCollision(const long edge0_id, const long edge1_id,
const double eps_x, const double weight,
const Eigen::SparseVector<double>& weight_gradient,
const EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO);¶
- inline virtual bool is_mollified() const override;¶
Does the distance potentially have to be mollified?
-
virtual double mollifier_threshold(
const VectorMax12d& rest_positions) const override;¶ Compute the mollifier threshold for the distance.
-
virtual double mollifier(
const VectorMax12d& positions) const override;¶ Compute the mollifier for the distance.
-
virtual double mollifier(
const VectorMax12d& positions, double eps_x) const override;¶ Compute the mollifier for the distance.
-
virtual VectorMax12d mollifier_gradient(
const VectorMax12d& positions) const override;¶ Compute the gradient of the mollifier for the distance w.r.t.
positions.
-
virtual VectorMax12d mollifier_gradient(
const VectorMax12d& positions, double eps_x) const override;¶ Compute the gradient of the mollifier for the distance wrt the positions.
-
virtual MatrixMax12d mollifier_hessian(
const VectorMax12d& positions) const override;¶ Compute the Hessian of the mollifier for the distance w.r.t.
positions.
-
virtual MatrixMax12d mollifier_hessian(
const VectorMax12d& positions, double eps_x) const override;¶ Compute the Hessian of the mollifier for the distance wrt the positions.
-
virtual Vector12d mollifier_gradient_wrt_x(
const VectorMax12d& rest_positions,
const VectorMax12d& positions) const override;¶ Compute the gradient of the mollifier for the distance w.r.t.
rest positions.
-
virtual Matrix12d mollifier_gradient_jacobian_wrt_x(
const VectorMax12d& rest_positions,
const VectorMax12d& positions) const override;¶ Compute the jacobian of the distance mollifier’s gradient w.r.t.
rest positions.
- inline virtual EdgeEdgeDistanceType known_dtype() const override;¶
- bool operator==(const EdgeEdgeCollision& other) const;¶
- bool operator!=(const EdgeEdgeCollision& other) const;¶
- bool operator<(const EdgeEdgeCollision& other) const;¶
Public Members¶
- double eps_x;¶
Mollifier activation threshold.
See also
- EdgeEdgeDistanceType dtype;¶
Cached distance type.
Some EE collisions are mollified EV or VV collisions.
-
EdgeEdgeCollision(const long edge0_id, const long edge1_id,
Face-Vertex Collision¶
-
class FaceVertexCollision : public ipc::FaceVertexCandidate,
public ipc::Collision;¶ Inheritance diagram for ipc::FaceVertexCollision:
Collaboration diagram for ipc::FaceVertexCollision:
Public Functions¶
- inline FaceVertexCollision(const FaceVertexCandidate& candidate);¶
-
inline FaceVertexCollision(const long _face_id,
const long _vertex_id, const double _weight,
const Eigen::SparseVector<double>& _weight_gradient);¶
-
inline virtual PointTriangleDistanceType
known_dtype() const override;¶
Plane-Vertex Collision¶
- class PlaneVertexCollision : public ipc::Collision;¶
Inheritance diagram for ipc::PlaneVertexCollision:
Collaboration diagram for ipc::PlaneVertexCollision:
Public Functions¶
-
PlaneVertexCollision(const VectorMax3d& plane_origin,
const VectorMax3d& plane_normal, const long vertex_id);¶
- inline virtual int num_vertices() const override;¶
Get the number of vertices in the collision stencil.
-
inline virtual std::array<long, 4> vertex_ids(
const Eigen::MatrixXi& edges,
const Eigen::MatrixXi& faces) const override;¶ Get the vertex IDs of the collision stencil.
-
virtual double compute_distance(
const VectorMax12d& point) const override;¶ Compute the distance between the point and plane.
-
PlaneVertexCollision(const VectorMax3d& plane_origin,