Candidates¶
Candidates¶
- class Candidates;¶
A class for storing and managing collision candidates.
Public Functions¶
- Candidates() = default;¶
-
void build(const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> vertices,
const double inflation_radius = 0,
BroadPhase* broad_phase = nullptr,
const bool all_types = false);¶ Initialize the set of discrete collision detection candidates.
- Parameters:¶
- const CollisionMesh &mesh¶
The surface of the collision mesh.
- Eigen::ConstRef<Eigen::MatrixXd> vertices¶
Surface vertex positions (rowwise).
- const double inflation_radius = 0¶
Amount to inflate the bounding boxes. With a mesh thickness (CollisionMesh::set_thickness()), each box is inflated by its primitive’s thickness on top of this.
- BroadPhase *broad_phase = nullptr¶
Broad phase method to use.
- const bool all_types = false¶
Also detect the candidate types only ESP needs (see BroadPhase::detect_collision_candidates). Recorded in has_all_types.
-
void build(const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> vertices_t0,
Eigen::ConstRef<Eigen::MatrixXd> vertices_t1,
const double inflation_radius = 0,
BroadPhase* broad_phase = nullptr);¶ Initialize the set of continuous collision detection candidates.
Note
Assumes the trajectory is linear.
Note
These candidates never include the ESP-only types, so has_all_types is false afterwards.
- Parameters:¶
- const CollisionMesh &mesh¶
The surface of the collision mesh.
- Eigen::ConstRef<Eigen::MatrixXd> vertices_t0¶
Surface vertex starting positions (rowwise).
- Eigen::ConstRef<Eigen::MatrixXd> vertices_t1¶
Surface vertex ending positions (rowwise).
- const double inflation_radius = 0¶
Amount to inflate the bounding boxes. With a mesh thickness, each box is inflated by its primitive’s thickness on top of this.
- BroadPhase *broad_phase = nullptr¶
Broad phase method to use.
- size_t size() const;¶
Get the number of collision candidates.
- Returns:¶
The number of collision candidates.
- bool empty() const;¶
Check if there are no collision candidates.
- Returns:¶
True if there are no collision candidates, false otherwise.
- void clear();¶
Clear all collision candidates.
-
template <typename Visitor>
inline decltype(auto) visit(size_t i, Visitor&& f);¶ Apply a visitor to the candidate at index i.
The candidate types are not polymorphic, so they cannot be handed out through a common base reference. The visitor is called with the concrete candidate type instead, which also means the stencil operations it calls are resolved statically.
-
template <typename Visitor>
inline decltype(auto) visit(size_t i, Visitor&& f) const;¶ Apply a visitor to the candidate at index i.
See also
-
bool is_step_collision_free(const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> vertices_t0,
Eigen::ConstRef<Eigen::MatrixXd> vertices_t1,
const std::optional<double> min_distance = std::nullopt,
const NarrowPhaseCCD& narrow_phase_ccd
= DEFAULT_NARROW_PHASE_CCD) const;¶ Determine if the step is collision free from the set of candidates.
Note
Assumes the trajectory is linear.
- Parameters:¶
- const CollisionMesh &mesh¶
The collision mesh.
- Eigen::ConstRef<Eigen::MatrixXd> vertices_t0¶
Surface vertex starting positions (rowwise).
- Eigen::ConstRef<Eigen::MatrixXd> vertices_t1¶
Surface vertex ending positions (rowwise).
- const std::optional<double> min_distance = std::nullopt¶
Deprecated: give the mesh a thickness (CollisionMesh::set_thickness()) instead. If given, every pair keeps this distance and the mesh’s thickness is ignored; otherwise each pair keeps its two primitives’ thicknesses (zero without a thickness).
- const NarrowPhaseCCD &narrow_phase_ccd = DEFAULT_NARROW_PHASE_CCD¶
The narrow phase CCD algorithm to use.
- Returns:¶
True if any collisions occur.
-
double compute_collision_free_stepsize(const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> vertices_t0,
Eigen::ConstRef<Eigen::MatrixXd> vertices_t1,
const std::optional<double> min_distance = std::nullopt,
const NarrowPhaseCCD& narrow_phase_ccd
= DEFAULT_NARROW_PHASE_CCD) const;¶ Computes a maximal step size that is collision free using the set of collision candidates.
Note
Assumes the trajectory is linear.
- Parameters:¶
- const CollisionMesh &mesh¶
The collision mesh.
- Eigen::ConstRef<Eigen::MatrixXd> vertices_t0¶
Surface vertex starting positions (rowwise). Assumed to be intersection free.
- Eigen::ConstRef<Eigen::MatrixXd> vertices_t1¶
Surface vertex ending positions (rowwise).
- const std::optional<double> min_distance = std::nullopt¶
Deprecated: give the mesh a thickness (CollisionMesh::set_thickness()) instead. If given, every pair keeps this distance and the mesh’s thickness is ignored; otherwise each pair keeps its two primitives’ thicknesses (zero without a thickness).
- const NarrowPhaseCCD &narrow_phase_ccd = DEFAULT_NARROW_PHASE_CCD¶
The narrow phase CCD algorithm to use.
- Returns:¶
A step-size \(\in [0, 1]\) that is collision free. A value of 1.0 if a full step and 0.0 is no step.
-
double compute_noncandidate_conservative_stepsize(
const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> displacements,
const double dhat) const;¶ Computes a conservative bound on the largest-feasible step size for surface primitives not in collision.
-
double compute_cfl_stepsize(const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> vertices_t0,
Eigen::ConstRef<Eigen::MatrixXd> vertices_t1, const double dhat,
const std::optional<double> min_distance = std::nullopt,
BroadPhase* broad_phase = nullptr,
const NarrowPhaseCCD& narrow_phase_ccd
= DEFAULT_NARROW_PHASE_CCD) const;¶ Computes a CFL-inspired CCD maximum step step size.
- Parameters:¶
- const CollisionMesh &mesh¶
The collision mesh.
- Eigen::ConstRef<Eigen::MatrixXd> vertices_t0¶
Surface vertex starting positions (rowwise).
- Eigen::ConstRef<Eigen::MatrixXd> vertices_t1¶
Surface vertex ending positions (rowwise).
- const double dhat¶
Barrier activation distance.
- const std::optional<double> min_distance = std::nullopt¶
Deprecated: give the mesh a thickness (CollisionMesh::set_thickness()) instead. If given, every pair keeps this distance and the mesh’s thickness is ignored; otherwise each pair keeps its two primitives’ thicknesses (zero without a thickness).
- BroadPhase *broad_phase = nullptr¶
The broad phase algorithm to use.
- const NarrowPhaseCCD &narrow_phase_ccd = DEFAULT_NARROW_PHASE_CCD¶
The narrow phase CCD algorithm to use.
- Returns:¶
A step-size \(\in [0, 1]\) that is collision free.
-
Eigen::VectorXd compute_per_vertex_safe_distances(
const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> vertices,
const double inflation_radius,
const std::optional<double> min_distance = std::nullopt) const;¶ Compute the maximum distance every vertex can move (independently) without colliding with any other element.
Note
Cap the value at the inflation radius used to build the candidates.
- Parameters:¶
- const CollisionMesh &mesh¶
The collision mesh.
- Eigen::ConstRef<Eigen::MatrixXd> vertices¶
Collision mesh vertex positions (rowwise).
- const double inflation_radius¶
The inflation radius used to build the candidates.
- const std::optional<double> min_distance = std::nullopt¶
Deprecated: give the mesh a thickness (CollisionMesh::set_thickness()) instead. If given, every pair keeps this distance and the mesh’s thickness is ignored; otherwise each pair keeps its two primitives’ thicknesses (zero without a thickness).
- Returns:¶
A vector of minimum distances, one for each vertex.
-
CandidateVector<VertexVertexCandidate> edge_vertex_to_vertex_vertex(
const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> vertices,
const std::function<bool(double)>& is_active
= default_is_active) const;¶ Convert edge-vertex candidates to vertex-vertex candidates.
- Parameters:¶
- const CollisionMesh &mesh¶
The collision mesh.
- Eigen::ConstRef<Eigen::MatrixXd> vertices¶
Collision mesh vertex positions (rowwise).
- const std::function<bool(double)> &is_active = default_is_active¶
(Optional) Function to determine if a candidate is active.
- Returns:¶
Vertex-vertex candidates derived from edge-vertex candidates.
-
CandidateVector<VertexVertexCandidate> face_vertex_to_vertex_vertex(
const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> vertices,
const std::function<bool(double)>& is_active
= default_is_active) const;¶ Convert face-vertex candidates to vertex-vertex candidates.
- Parameters:¶
- const CollisionMesh &mesh¶
The collision mesh.
- Eigen::ConstRef<Eigen::MatrixXd> vertices¶
Collision mesh vertex positions (rowwise).
- const std::function<bool(double)> &is_active = default_is_active¶
(Optional) Function to determine if a candidate is active.
- Returns:¶
Vertex-vertex candidates derived from face-vertex candidates.
-
CandidateVector<EdgeVertexCandidate> face_vertex_to_edge_vertex(
const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> vertices,
const std::function<bool(double)>& is_active
= default_is_active) const;¶ Convert face-vertex candidates to edge-vertex candidates.
- Parameters:¶
- const CollisionMesh &mesh¶
The collision mesh.
- Eigen::ConstRef<Eigen::MatrixXd> vertices¶
Collision mesh vertex positions (rowwise).
- const std::function<bool(double)> &is_active = default_is_active¶
(Optional) Function to determine if a candidate is active.
- Returns:¶
Edge-vertex candidates derived from face-vertex candidates.
-
CandidateVector<EdgeVertexCandidate> edge_edge_to_edge_vertex(
const CollisionMesh& mesh,
Eigen::ConstRef<Eigen::MatrixXd> vertices,
const std::function<bool(double)>& is_active
= default_is_active) const;¶ Convert edge-edge candidates to edge-vertex candidates.
- Parameters:¶
- const CollisionMesh &mesh¶
The collision mesh.
- Eigen::ConstRef<Eigen::MatrixXd> vertices¶
Collision mesh vertex positions (rowwise).
- const std::function<bool(double)> &is_active = default_is_active¶
(Optional) Function to determine if a candidate is active.
- Returns:¶
Edge-vertex candidates derived from edge-edge candidates.
-
bool write_obj(const std::string& filename,
Eigen::ConstRef<Eigen::MatrixXd> vertices,
Eigen::ConstRef<Eigen::MatrixXi> edges,
Eigen::ConstRef<Eigen::MatrixXi> faces) const;¶ Write the collision candidates to an OBJ file.
- Parameters:¶
- const std::string &filename¶
The name of the file to write the candidates to.
- Eigen::ConstRef<Eigen::MatrixXd> vertices¶
Collision mesh vertex positions (rowwise).
- Eigen::ConstRef<Eigen::MatrixXi> edges¶
Collision mesh edge indices (rowwise).
- Eigen::ConstRef<Eigen::MatrixXi> faces¶
Collision mesh face indices (rowwise).
- Returns:¶
True if the file was written successfully.
-
inline bool save_obj(const std::string& filename,
Eigen::ConstRef<Eigen::MatrixXd> vertices,
Eigen::ConstRef<Eigen::MatrixXi> edges,
Eigen::ConstRef<Eigen::MatrixXi> faces) const;¶ Write the collision candidates to an OBJ file.
- Deprecated :;
Use write_obj instead.
- void convert_candidates_to_sets();¶
Build per-primitive adjacency lists from the candidates.
Note
Required before calling any of the *_set() queries below, which return empty lists until then.
- AdjacencyList vv_set(const CollisionMesh& mesh, index_t id) const;¶
Vertices near vertex id (2D: also the endpoints of nearby edges).
- AdjacencyList ev_set(const CollisionMesh& mesh, index_t id) const;¶
Vertices near edge id, including its endpoints.
- AdjacencyList ee_set(const CollisionMesh& mesh, index_t id) const;¶
Edges near or adjacent to edge id, excluding id.
- AdjacencyList ef_set(const CollisionMesh& mesh, index_t id) const;¶
Faces near or adjacent to edge id, excluding faces containing id.
- AdjacencyList fv_set(const CollisionMesh& mesh, index_t id) const;¶
Vertices near face id, including its corners.
- AdjacencyList fe_set(const CollisionMesh& mesh, index_t id) const;¶
Edges near or adjacent to face id.
- AdjacencyList ff_set(const CollisionMesh& mesh, index_t id) const;¶
Faces near or adjacent to face id, excluding id.
Public Members¶
- CandidateVector<VertexVertexCandidate> vv_candidates;¶
- CandidateVector<EdgeVertexCandidate> ev_candidates;¶
- CandidateVector<EdgeEdgeCandidate> ee_candidates;¶
- CandidateVector<FaceVertexCandidate> fv_candidates;¶
- CandidateVector<PlaneVertexCandidate> pv_candidates;¶
- CandidateVector<EdgeFaceCandidate> ef_candidates;¶
- CandidateVector<FaceFaceCandidate> ff_candidates;¶
- bool has_all_types = false;¶
Whether these candidates include the types only ESP needs.
In 3D, all_types adds whole-mesh vertex-vertex, edge-vertex, edge-face, and face-face candidates. ESPCollisions needs them and NormalCollisions would double count them, so both check this flag in 3D and throw on a mismatch. build() and clear() set it; if you fill the candidate lists by hand, set it to match what you filled.
Private Members¶
- std::shared_ptr<AdjacencySets> m_sets;¶
Private Static Functions¶
- static void throw_out_of_range(size_t i, size_t size);¶
Throw the std::out_of_range for a bad visit() index.
- struct AdjacencySets;¶
Public Functions¶
- explicit AdjacencySets(const Candidates& candidates);¶
-
AdjacencyList query(
Relation relation, const CollisionMesh* mesh, index_t id) const;¶ The neighbors of a primitive.
The neighbors of a vertex among edges (VE) and faces (VF) are exactly the stored candidates, so we return a view of them. Every other relation also merges in the neighbors that come from the mesh topology, which builds a new list. The mesh is only needed for those, so it may be null for VE and VF.
-
std::vector<index_t> merged(
Relation relation, const CollisionMesh& mesh, index_t id) const;¶ The sorted neighbors of a primitive, merged with mesh topology.
Collision Stencil¶
- class CollisionStencil : public ipc::StencilMixin<CollisionStencil>;¶
Inheritance diagram for ipc::CollisionStencil:
A stencil representing a collision between at most four vertices.
The runtime-polymorphic stencil, used where the stencil type is not known statically. The operations built on top of the primitives below live in StencilMixin, which this shares with the non-polymorphic candidate types.
Subclassed by ipc::DTypeStencilAdapter< EdgeEdgeCandidate, EdgeEdgeDistanceType >, ipc::DTypeStencilAdapter< EdgeVertexCandidate, PointEdgeDistanceType >, ipc::DTypeStencilAdapter< FaceVertexCandidate, PointTriangleDistanceType >, ipc::StencilAdapter< PlaneVertexCandidate >, ipc::StencilAdapter< VertexVertexCandidate >, ipc::DTypeStencilAdapter< Candidate, DType >, ipc::NormalCollision, ipc::StencilAdapter< Candidate >, ipc::TangentialCollision
Public Functions¶
- virtual ~CollisionStencil() = default;¶
-
template <typename CollisionStencilType>
inline CollisionStencilType& as();¶ Get this as a child collision type.
-
template <typename CollisionStencilType>
inline const CollisionStencilType& as() const;¶ Get this as a child collision type.
- virtual int num_vertices() const = 0;¶
Get the number of vertices in the collision stencil.
- inline virtual std::string name() const;¶
A short name for the stencil type, for debug output.
-
virtual std::array<index_t, STENCIL_SIZE> vertex_ids(
Eigen::ConstRef<Eigen::MatrixXi> edges,
Eigen::ConstRef<Eigen::MatrixXi> faces) const
= 0;¶ Get the vertex IDs of the collision stencil.
- Parameters:¶
- Returns:¶
The vertex IDs of the collision stencil. Elements i > num_vertices() are -1.
-
virtual double compute_distance(
Eigen::ConstRef<VectorMax12d> positions) const
= 0;¶ Compute the distance of the stencil.
Note
positions can be computed as stencil.dof(vertices, edges, faces)
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Stencil’s vertex positions.
- Returns:¶
Distance of the stencil.
-
virtual VectorMax12d compute_distance_gradient(
Eigen::ConstRef<VectorMax12d> positions) const
= 0;¶ Compute the distance gradient of the stencil w.r.t.
the stencil’s vertex positions.
Note
positions can be computed as stencil.dof(vertices, edges, faces)
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Stencil’s vertex positions.
- Returns:¶
Distance gradient of the stencil w.r.t. the stencil’s vertex positions.
-
virtual MatrixMax12d compute_distance_hessian(
Eigen::ConstRef<VectorMax12d> positions) const
= 0;¶ Compute the distance Hessian of the stencil w.r.t.
the stencil’s vertex positions.
Note
positions can be computed as stencil.dof(vertices, edges, faces)
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Stencil’s vertex positions.
- Returns:¶
Distance Hessian of the stencil w.r.t. the stencil’s vertex positions.
-
virtual VectorMax4d compute_coefficients(
Eigen::ConstRef<VectorMax12d> positions) const
= 0;¶ Compute the coefficients of the stencil s.t.
d(x) = ‖∑ cᵢ xᵢ‖².
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Stencil’s vertex positions.
- Returns:¶
Coefficients of the stencil.
-
virtual bool ccd(Eigen::ConstRef<VectorMax12d> vertices_t0,
Eigen::ConstRef<VectorMax12d> vertices_t1, double& toi,
const double min_distance = 0.0, const double tmax = 1.0,
const NarrowPhaseCCD& narrow_phase_ccd
= DEFAULT_NARROW_PHASE_CCD) const
= 0;¶ Perform narrow-phase CCD on the candidate.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> vertices_t0¶
[in] Stencil vertices at the start of the time step.
- Eigen::ConstRef<VectorMax12d> vertices_t1¶
[in] Stencil vertices at the end of the time step.
- double &toi¶
[out] Computed time of impact (normalized).
- const double min_distance = 0.0¶
[in] Minimum separation distance between primitives.
- const double tmax = 1.0¶
[in] Maximum time (normalized) to look for collisions.
- const NarrowPhaseCCD &narrow_phase_ccd = DEFAULT_NARROW_PHASE_CCD¶
[in] The narrow phase CCD algorithm to use.
- Returns:¶
If the candidate had a collision over the time interval.
Protected Functions¶
-
virtual VectorMax3d compute_unnormalized_normal(
Eigen::ConstRef<VectorMax12d> positions) const
= 0;¶ Compute the unnormalized normal of the stencil.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Stencil’s vertex positions.
- Returns:¶
Unnormalized normal of the stencil.
-
virtual MatrixMax<double, 3, 12>
compute_unnormalized_normal_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const
= 0;¶ Compute the Jacobian of the unnormalized normal of the stencil.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Stencil’s vertex positions.
- Returns:¶
Jacobian of the unnormalized normal of the stencil.
Friends¶
- friend class StencilMixin<CollisionStencil>;
Vertex-Vertex Candidate¶
-
class VertexVertexCandidate
: public ipc::StencilMixin<VertexVertexCandidate>;¶ Inheritance diagram for ipc::VertexVertexCandidate:
A candidate for vertex-vertex collision detection.
Subclassed by ipc::StencilAdapter< VertexVertexCandidate >
Public Functions¶
- VertexVertexCandidate() = default;¶
Construct a candidate with indeterminate edge IDs.
Note
Keeping this trivial is what makes the type trivially copyable.
- VertexVertexCandidate(index_t vertex0_id, index_t vertex1_id);¶
-
inline std::array<index_t, 4> vertex_ids(
Eigen::ConstRef<Eigen::MatrixXi> edges,
Eigen::ConstRef<Eigen::MatrixXi> faces) const;¶ Get the indices of the vertices.
-
double compute_distance(
Eigen::ConstRef<VectorMax12d> positions) const;¶
-
VectorMax12d compute_distance_gradient(
Eigen::ConstRef<VectorMax12d> positions) const;¶
-
MatrixMax12d compute_distance_hessian(
Eigen::ConstRef<VectorMax12d> positions) const;¶
-
VectorMax4d compute_coefficients(
Eigen::ConstRef<VectorMax12d> positions) const;¶
-
bool ccd(Eigen::ConstRef<VectorMax12d> vertices_t0,
Eigen::ConstRef<VectorMax12d> vertices_t1, double& toi,
const double min_distance = 0.0, const double tmax = 1.0,
const NarrowPhaseCCD& narrow_phase_ccd
= DEFAULT_NARROW_PHASE_CCD) const;¶
-
inline double thickness(
Eigen::ConstRef<Eigen::VectorXd> vertex_thickness,
Eigen::ConstRef<Eigen::VectorXd> edge_thickness,
Eigen::ConstRef<Eigen::VectorXd> face_thickness) const;¶ Get the sum of the two primitives’ thicknesses.
See also
- bool operator==(const VertexVertexCandidate& other) const;¶
- bool operator!=(const VertexVertexCandidate& other) const;¶
- bool operator<(const VertexVertexCandidate& other) const;¶
Compare EdgeVertexCandidates for sorting.
Public Members¶
- index_t vertex0_id;¶
ID of the first vertex.
- index_t vertex1_id;¶
ID of the second vertex.
Public Static Functions¶
- static inline constexpr int num_vertices();¶
- static inline std::string name();¶
Protected Functions¶
-
VectorMax3d compute_unnormalized_normal(
Eigen::ConstRef<VectorMax12d> positions) const;¶
-
MatrixMax<double, 3, 12> compute_unnormalized_normal_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const;¶
Edge-Vertex Candidate¶
-
class EdgeVertexCandidate
: public ipc::StencilMixin<EdgeVertexCandidate>;¶ Inheritance diagram for ipc::EdgeVertexCandidate:
A candidate for edge-vertex collision detection.
Subclassed by ipc::DTypeStencilAdapter< EdgeVertexCandidate, PointEdgeDistanceType >
Public Functions¶
- EdgeVertexCandidate() = default;¶
Construct a candidate with indeterminate edge IDs.
Note
Keeping this trivial is what makes the type trivially copyable.
-
inline std::array<index_t, 4> vertex_ids(
Eigen::ConstRef<Eigen::MatrixXi> edges,
Eigen::ConstRef<Eigen::MatrixXi> faces) const;¶ Get the vertex IDs for the edge-vertex pair.
-
double compute_distance(Eigen::ConstRef<VectorMax12d> positions,
const PointEdgeDistanceType dtype
= PointEdgeDistanceType::AUTO) const;¶
-
VectorMax12d compute_distance_gradient(
Eigen::ConstRef<VectorMax12d> positions,
const PointEdgeDistanceType dtype
= PointEdgeDistanceType::AUTO) const;¶
-
MatrixMax12d compute_distance_hessian(
Eigen::ConstRef<VectorMax12d> positions,
const PointEdgeDistanceType dtype
= PointEdgeDistanceType::AUTO) const;¶
-
VectorMax4d compute_coefficients(
Eigen::ConstRef<VectorMax12d> positions,
const PointEdgeDistanceType dtype
= PointEdgeDistanceType::AUTO) const;¶
-
bool ccd(Eigen::ConstRef<VectorMax12d> vertices_t0,
Eigen::ConstRef<VectorMax12d> vertices_t1, double& toi,
const double min_distance = 0.0, const double tmax = 1.0,
const NarrowPhaseCCD& narrow_phase_ccd
= DEFAULT_NARROW_PHASE_CCD) const;¶
-
inline double thickness(
Eigen::ConstRef<Eigen::VectorXd> vertex_thickness,
Eigen::ConstRef<Eigen::VectorXd> edge_thickness,
Eigen::ConstRef<Eigen::VectorXd> face_thickness) const;¶ Get the sum of the two primitives’ thicknesses.
See also
- bool operator==(const EdgeVertexCandidate& other) const;¶
- bool operator!=(const EdgeVertexCandidate& other) const;¶
- bool operator<(const EdgeVertexCandidate& other) const;¶
Compare EdgeVertexCandidates for sorting.
Public Static Functions¶
- static inline constexpr int num_vertices();¶
- static inline std::string name();¶
- static inline constexpr PointEdgeDistanceType known_dtype();¶
Protected Functions¶
-
VectorMax3d compute_unnormalized_normal(
Eigen::ConstRef<VectorMax12d> positions) const;¶
-
MatrixMax<double, 3, 12> compute_unnormalized_normal_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const;¶
Edge-Edge Candidate¶
-
class EdgeEdgeCandidate
: public ipc::StencilMixin<EdgeEdgeCandidate>;¶ Inheritance diagram for ipc::EdgeEdgeCandidate:
A candidate for edge-edge collision detection.
Subclassed by ipc::DTypeStencilAdapter< EdgeEdgeCandidate, EdgeEdgeDistanceType >
Public Functions¶
- EdgeEdgeCandidate() = default;¶
Construct a candidate with indeterminate edge IDs.
Note
Keeping this trivial is what makes the type trivially copyable.
-
inline std::array<index_t, 4> vertex_ids(
Eigen::ConstRef<Eigen::MatrixXi> edges,
Eigen::ConstRef<Eigen::MatrixXi> faces) const;¶ Get the vertex IDs for the edge-edge pair.
-
double compute_distance(Eigen::ConstRef<VectorMax12d> positions,
const EdgeEdgeDistanceType dtype
= EdgeEdgeDistanceType::AUTO) const;¶ Compute the distance of the stencil.
- Parameters:¶
- Eigen::ConstRef<VectorMax12d> positions¶
Positions of the stencil’s four vertices, stacked.
- const EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO¶
The distance type, when it is known a priori. Defaults to AUTO, which classifies the pair from the positions.
- Returns:¶
Distance of the stencil.
-
VectorMax12d compute_distance_gradient(
Eigen::ConstRef<VectorMax12d> positions,
const EdgeEdgeDistanceType dtype
= EdgeEdgeDistanceType::AUTO) const;¶
-
MatrixMax12d compute_distance_hessian(
Eigen::ConstRef<VectorMax12d> positions,
const EdgeEdgeDistanceType dtype
= EdgeEdgeDistanceType::AUTO) const;¶
-
VectorMax4d compute_coefficients(
Eigen::ConstRef<VectorMax12d> positions,
const EdgeEdgeDistanceType dtype
= EdgeEdgeDistanceType::AUTO) const;¶
-
bool ccd(Eigen::ConstRef<VectorMax12d> vertices_t0,
Eigen::ConstRef<VectorMax12d> vertices_t1, double& toi,
const double min_distance = 0.0, const double tmax = 1.0,
const NarrowPhaseCCD& narrow_phase_ccd
= DEFAULT_NARROW_PHASE_CCD) const;¶
-
inline double thickness(
Eigen::ConstRef<Eigen::VectorXd> vertex_thickness,
Eigen::ConstRef<Eigen::VectorXd> edge_thickness,
Eigen::ConstRef<Eigen::VectorXd> face_thickness) const;¶ Get the sum of the two primitives’ thicknesses.
See also
- bool operator==(const EdgeEdgeCandidate& other) const;¶
- bool operator!=(const EdgeEdgeCandidate& other) const;¶
- bool operator<(const EdgeEdgeCandidate& other) const;¶
Compare EdgeEdgeCandidates for sorting.
Public Static Functions¶
- static inline constexpr int num_vertices();¶
- static inline std::string name();¶
- static inline constexpr EdgeEdgeDistanceType known_dtype();¶
The distance type known a priori; AUTO for a plain candidate.
Protected Functions¶
-
VectorMax3d compute_unnormalized_normal(
Eigen::ConstRef<VectorMax12d> positions) const;¶
-
MatrixMax<double, 3, 12> compute_unnormalized_normal_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const;¶
Edge-Face Candidate¶
- class EdgeFaceCandidate;¶
Candidate for intersection between edge and face.
Not included in Candidates because it is not a collision candidate.
Public Functions¶
- EdgeFaceCandidate() = default;¶
Construct a candidate with indeterminate IDs.
Leaves the members uninitialized so a container can size itself without writing them; keeping this trivial is what makes the type trivially copyable.
- bool operator==(const EdgeFaceCandidate& other) const;¶
- bool operator!=(const EdgeFaceCandidate& other) const;¶
- bool operator<(const EdgeFaceCandidate& other) const;¶
Compare EdgeFaceCandidate for sorting.
Face-Vertex Candidate¶
-
class FaceVertexCandidate
: public ipc::StencilMixin<FaceVertexCandidate>;¶ Inheritance diagram for ipc::FaceVertexCandidate:
A candidate for face-vertex collision detection.
Subclassed by ipc::DTypeStencilAdapter< FaceVertexCandidate, PointTriangleDistanceType >
Public Functions¶
- FaceVertexCandidate() = default;¶
Construct a candidate with indeterminate edge IDs.
Note
Keeping this trivial is what makes the type trivially copyable.
-
inline std::array<index_t, 4> vertex_ids(
Eigen::ConstRef<Eigen::MatrixXi> edges,
Eigen::ConstRef<Eigen::MatrixXi> faces) const;¶ Get the vertex IDs for the face-vertex pair.
-
double compute_distance(Eigen::ConstRef<VectorMax12d> positions,
const PointTriangleDistanceType dtype
= PointTriangleDistanceType::AUTO) const;¶
-
VectorMax12d compute_distance_gradient(
Eigen::ConstRef<VectorMax12d> positions,
const PointTriangleDistanceType dtype
= PointTriangleDistanceType::AUTO) const;¶
-
MatrixMax12d compute_distance_hessian(
Eigen::ConstRef<VectorMax12d> positions,
const PointTriangleDistanceType dtype
= PointTriangleDistanceType::AUTO) const;¶
-
VectorMax4d compute_coefficients(
Eigen::ConstRef<VectorMax12d> positions,
const PointTriangleDistanceType dtype
= PointTriangleDistanceType::AUTO) const;¶
-
bool ccd(Eigen::ConstRef<VectorMax12d> vertices_t0,
Eigen::ConstRef<VectorMax12d> vertices_t1, double& toi,
const double min_distance = 0.0, const double tmax = 1.0,
const NarrowPhaseCCD& narrow_phase_ccd
= DEFAULT_NARROW_PHASE_CCD) const;¶
-
inline double thickness(
Eigen::ConstRef<Eigen::VectorXd> vertex_thickness,
Eigen::ConstRef<Eigen::VectorXd> edge_thickness,
Eigen::ConstRef<Eigen::VectorXd> face_thickness) const;¶ Get the sum of the two primitives’ thicknesses.
See also
- bool operator==(const FaceVertexCandidate& other) const;¶
- bool operator!=(const FaceVertexCandidate& other) const;¶
- bool operator<(const FaceVertexCandidate& other) const;¶
Compare FaceVertexCandidate for sorting.
Public Static Functions¶
- static inline constexpr int num_vertices();¶
- static inline std::string name();¶
- static inline constexpr PointTriangleDistanceType known_dtype();¶
Protected Functions¶
-
VectorMax3d compute_unnormalized_normal(
Eigen::ConstRef<VectorMax12d> positions) const;¶
-
MatrixMax<double, 3, 12> compute_unnormalized_normal_jacobian(
Eigen::ConstRef<VectorMax12d> positions) const;¶