Normal Collisions¶
Normal Collisions¶
- class ipctk.NormalCollisions¶
Bases:
pybind11_object
Public Data Attributes:
If the NormalCollisions should use the convergent formulation.
If the NormalCollisions should use the improved max approximator.
If the NormalCollisions are using the convergent formulation.
Public Methods:
__init__
(self)build
(*args, **kwargs)Overloaded function.
compute_minimum_distance
(self, mesh, ...)Computes the minimum distance between any non-adjacent elements.
__len__
(self)Get the number of collisions.
empty
(self)Get if the collision set are empty.
clear
(self)Clear the collision set.
__getitem__
(self, i)Get a reference to collision at index i.
is_vertex_vertex
(self, i)Get if the collision at i is a vertex-vertex collision.
is_edge_vertex
(self, i)Get if the collision at i is an edge-vertex collision.
is_edge_edge
(self, i)Get if the collision at i is an edge-edge collision.
is_face_vertex
(self, i)Get if the collision at i is an face-vertex collision.
is_plane_vertex
(self, i)Get if the collision at i is an plane-vertex collision.
__str__
(self, mesh, vertices, n]])Inherited from
pybind11_object
-
__annotations__ =
{}
¶
- __getitem__(self, i: int) ipctk.NormalCollision ¶
Get a reference to collision at index i.
- __init__(self)¶
- __len__(self) int ¶
Get the number of collisions.
-
__module__ =
'ipctk'
¶
- __str__(self: ipctk.NormalCollisions, mesh: ipc::CollisionMesh, vertices: numpy.ndarray[numpy.float64[m, n]]) str ¶
- build(*args, **kwargs)¶
Overloaded function.
build(self: ipctk.NormalCollisions, mesh: ipc::CollisionMesh, vertices: numpy.ndarray[numpy.float64[m, n]], dhat: float, dmin: float = 0, broad_phase_method: ipctk.BroadPhaseMethod = <BroadPhaseMethod.HASH_GRID: 1>) -> None
Initialize the set of collisions used to compute the barrier potential.
- Parameters:
mesh: The collision mesh. vertices: Vertices of the collision mesh. dhat: The activation distance of the barrier. dmin: Minimum distance. broad_phase_method: Broad-phase method to use.
build(self: ipctk.NormalCollisions, candidates: ipctk.Candidates, mesh: ipc::CollisionMesh, vertices: numpy.ndarray[numpy.float64[m, n]], dhat: float, dmin: float = 0) -> None
Initialize the set of collisions used to compute the barrier potential.
- Parameters:
candidates: Distance candidates from which the collision set is built. mesh: The collision mesh. vertices: Vertices of the collision mesh. dhat: The activation distance of the barrier. dmin: Minimum distance.
- clear(self) None ¶
Clear the collision set.
- compute_minimum_distance(self: ipctk.NormalCollisions, mesh: ipc::CollisionMesh, vertices: numpy.ndarray[numpy.float64[m, n]]) float ¶
Computes the minimum distance between any non-adjacent elements.
- property ee_collisions : list[ipc::EdgeEdgeNormalCollision]¶
- empty(self) bool ¶
Get if the collision set are empty.
- property enable_shape_derivatives : bool¶
If the NormalCollisions are using the convergent formulation.
- property ev_collisions : list[ipc::EdgeVertexNormalCollision]¶
- property fv_collisions : list[ipc::FaceVertexNormalCollision]¶
- property pv_collisions : list[ipc::PlaneVertexNormalCollision]¶
- property use_area_weighting : bool¶
If the NormalCollisions should use the convergent formulation.
- property use_improved_max_approximator : bool¶
If the NormalCollisions should use the improved max approximator.
- property vv_collisions : list[ipc::VertexVertexNormalCollision]¶
-
__annotations__ =
Normal Collision¶
- class ipctk.NormalCollision¶
Bases:
CollisionStencil
Public Data Attributes:
The minimum separation distance.
The term's weight (e.g., collision area)
The gradient of the term's weight wrt the rest positions.
Public Methods:
__init__
(*args, **kwargs)is_mollified
(self)Does the distance potentially have to be mollified?
mollifier_threshold
(self, rest_positions)Compute the mollifier threshold for the distance.
mollifier
(*args, **kwargs)Overloaded function.
mollifier_gradient
(*args, **kwargs)Overloaded function.
mollifier_hessian
(*args, **kwargs)Overloaded function.
mollifier_gradient_wrt_x
(self, ...)Compute the gradient of the mollifier for the distance w.r.t.
mollifier_gradient_jacobian_wrt_x
(self, ...)Compute the jacobian of the distance mollifier's gradient w.r.t.
Inherited from
CollisionStencil
__init__
(*args, **kwargs)num_vertices
(self)Get the number of vertices in the collision stencil.
dim
(self, ndof)Get the dimension of the collision stencil.
vertex_ids
(self, edges, faces)Get the vertex IDs of the collision stencil.
vertices
(self, vertices, edges, faces)Get the vertex attributes of the collision stencil.
dof
(self, X, edges, faces)Select this stencil's DOF from the full matrix of DOF.
compute_distance
(self, positions)Compute the distance of the stencil.
compute_distance_gradient
(self, positions)Compute the distance gradient of the stencil w.r.t.
compute_distance_hessian
(self, positions)Compute the distance Hessian of the stencil w.r.t.
Inherited from
pybind11_object
-
__annotations__ =
{}
¶
- __init__(*args, **kwargs)¶
-
__module__ =
'ipctk'
¶
- property dmin : float¶
The minimum separation distance.
- is_mollified(self) bool ¶
Does the distance potentially have to be mollified?
- mollifier(*args, **kwargs)¶
Overloaded function.
mollifier(self: ipctk.NormalCollision, positions: numpy.ndarray[numpy.float64[m, 1]]) -> float
Compute the mollifier for the distance.
- Parameters:
positions: The stencil’s vertex positions.
- Returns:
The mollifier value.
mollifier(self: ipctk.NormalCollision, positions: numpy.ndarray[numpy.float64[m, 1]], eps_x: float) -> float
Compute the mollifier for the distance.
- Parameters:
positions: The stencil’s vertex positions. eps_x: The mollifier’s threshold.
- Returns:
The mollifier value.
- mollifier_gradient(*args, **kwargs)¶
Overloaded function.
mollifier_gradient(self: ipctk.NormalCollision, positions: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]
Compute the gradient of the mollifier for the distance wrt the positions.
- Parameters:
positions: The stencil’s vertex positions.
- Returns:
The mollifier gradient.
mollifier_gradient(self: ipctk.NormalCollision, positions: numpy.ndarray[numpy.float64[m, 1]], eps_x: float) -> numpy.ndarray[numpy.float64[m, 1]]
Compute the gradient of the mollifier for the distance wrt the positions.
- Parameters:
positions: The stencil’s vertex positions. eps_x: The mollifier’s threshold.
- Returns:
The mollifier gradient.
- mollifier_gradient_jacobian_wrt_x(self, rest_positions: numpy.ndarray[numpy.float64[m, 1]], positions: numpy.ndarray[numpy.float64[m, 1]]) numpy.ndarray[numpy.float64[12, 12]] ¶
Compute the jacobian of the distance mollifier’s gradient w.r.t. rest positions.
- mollifier_gradient_wrt_x(self, rest_positions: numpy.ndarray[numpy.float64[m, 1]], positions: numpy.ndarray[numpy.float64[m, 1]]) numpy.ndarray[numpy.float64[12, 1]] ¶
Compute the gradient of the mollifier for the distance w.r.t. rest positions.
- mollifier_hessian(*args, **kwargs)¶
Overloaded function.
mollifier_hessian(self: ipctk.NormalCollision, positions: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, n]]
Compute the Hessian of the mollifier for the distance wrt the positions.
- Parameters:
positions: The stencil’s vertex positions.
- Returns:
The mollifier Hessian.
mollifier_hessian(self: ipctk.NormalCollision, positions: numpy.ndarray[numpy.float64[m, 1]], eps_x: float) -> numpy.ndarray[numpy.float64[m, n]]
Compute the Hessian of the mollifier for the distance wrt the positions.
- Parameters:
positions: The stencil’s vertex positions. eps_x: The mollifier’s threshold.
- Returns:
The mollifier Hessian.
- mollifier_threshold(self, rest_positions: numpy.ndarray[numpy.float64[m, 1]]) float ¶
Compute the mollifier threshold for the distance.
- property weight : float¶
The term’s weight (e.g., collision area)
- property weight_gradient : scipy.sparse.csc_matrix[numpy.float64]¶
The gradient of the term’s weight wrt the rest positions.
-
__annotations__ =
Vertex-Vertex Normal Collision¶
- class ipctk.VertexVertexNormalCollision¶
Bases:
VertexVertexCandidate
,NormalCollision
Public Data Attributes:
Inherited from
VertexVertexCandidate
ID of the first vertex
ID of the second vertex
Inherited from
NormalCollision
The minimum separation distance.
The term's weight (e.g., collision area)
The gradient of the term's weight wrt the rest positions.
Public Methods:
__init__
(*args, **kwargs)Overloaded function.
Inherited from
VertexVertexCandidate
__init__
(self, vertex0_id, vertex1_id)__str__
(self)__repr__
(self)__eq__
(self, other)__ne__
(self, other)__lt__
(self, other)Compare EdgeVertexCandidates for sorting.
Inherited from
NormalCollision
__init__
(*args, **kwargs)is_mollified
(self)Does the distance potentially have to be mollified?
mollifier_threshold
(self, rest_positions)Compute the mollifier threshold for the distance.
mollifier
(*args, **kwargs)Overloaded function.
mollifier_gradient
(*args, **kwargs)Overloaded function.
mollifier_hessian
(*args, **kwargs)Overloaded function.
mollifier_gradient_wrt_x
(self, ...)Compute the gradient of the mollifier for the distance w.r.t.
mollifier_gradient_jacobian_wrt_x
(self, ...)Compute the jacobian of the distance mollifier's gradient w.r.t.
Inherited from
CollisionStencil
__init__
(*args, **kwargs)num_vertices
(self)Get the number of vertices in the collision stencil.
dim
(self, ndof)Get the dimension of the collision stencil.
vertex_ids
(self, edges, faces)Get the vertex IDs of the collision stencil.
vertices
(self, vertices, edges, faces)Get the vertex attributes of the collision stencil.
dof
(self, X, edges, faces)Select this stencil's DOF from the full matrix of DOF.
compute_distance
(self, positions)Compute the distance of the stencil.
compute_distance_gradient
(self, positions)Compute the distance gradient of the stencil w.r.t.
compute_distance_hessian
(self, positions)Compute the distance Hessian of the stencil w.r.t.
Inherited from
ContinuousCollisionCandidate
__init__
(*args, **kwargs)ccd
(self, vertices_t0, 1]], vertices_t1, ...)Perform narrow-phase CCD on the candidate.
print_ccd_query
(self, vertices_t0, vertices_t1)Print the CCD query to cout.
Inherited from
pybind11_object
-
__annotations__ =
{}
¶
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: ipctk.VertexVertexNormalCollision, vertex0_id: int, vertex1_id: int) -> None
__init__(self: ipctk.VertexVertexNormalCollision, vv_candidate: ipctk.VertexVertexCandidate) -> None
-
__module__ =
'ipctk'
¶
-
__annotations__ =
Edge-Vertex Normal Collision¶
- class ipctk.EdgeVertexNormalCollision¶
Bases:
EdgeVertexCandidate
,NormalCollision
Public Data Attributes:
Inherited from
EdgeVertexCandidate
ID of the edge
ID of the vertex
Inherited from
NormalCollision
The minimum separation distance.
The term's weight (e.g., collision area)
The gradient of the term's weight wrt the rest positions.
Public Methods:
__init__
(*args, **kwargs)Overloaded function.
Inherited from
EdgeVertexCandidate
__init__
(self, edge_id, vertex_id)known_dtype
(self)__str__
(self)__repr__
(self)__eq__
(self, other)__ne__
(self, other)__lt__
(self, other)Compare EdgeVertexCandidates for sorting.
Inherited from
NormalCollision
__init__
(*args, **kwargs)is_mollified
(self)Does the distance potentially have to be mollified?
mollifier_threshold
(self, rest_positions)Compute the mollifier threshold for the distance.
mollifier
(*args, **kwargs)Overloaded function.
mollifier_gradient
(*args, **kwargs)Overloaded function.
mollifier_hessian
(*args, **kwargs)Overloaded function.
mollifier_gradient_wrt_x
(self, ...)Compute the gradient of the mollifier for the distance w.r.t.
mollifier_gradient_jacobian_wrt_x
(self, ...)Compute the jacobian of the distance mollifier's gradient w.r.t.
Inherited from
CollisionStencil
__init__
(*args, **kwargs)num_vertices
(self)Get the number of vertices in the collision stencil.
dim
(self, ndof)Get the dimension of the collision stencil.
vertex_ids
(self, edges, faces)Get the vertex IDs of the collision stencil.
vertices
(self, vertices, edges, faces)Get the vertex attributes of the collision stencil.
dof
(self, X, edges, faces)Select this stencil's DOF from the full matrix of DOF.
compute_distance
(self, positions)Compute the distance of the stencil.
compute_distance_gradient
(self, positions)Compute the distance gradient of the stencil w.r.t.
compute_distance_hessian
(self, positions)Compute the distance Hessian of the stencil w.r.t.
Inherited from
ContinuousCollisionCandidate
__init__
(*args, **kwargs)ccd
(self, vertices_t0, 1]], vertices_t1, ...)Perform narrow-phase CCD on the candidate.
print_ccd_query
(self, vertices_t0, vertices_t1)Print the CCD query to cout.
Inherited from
pybind11_object
-
__annotations__ =
{}
¶
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: ipctk.EdgeVertexNormalCollision, edge_id: int, vertex_id: int) -> None
__init__(self: ipctk.EdgeVertexNormalCollision, candidate: ipctk.EdgeVertexCandidate) -> None
-
__module__ =
'ipctk'
¶
-
__annotations__ =
Edge-Edge Normal Collision¶
- class ipctk.EdgeEdgeNormalCollision¶
Bases:
EdgeEdgeCandidate
,NormalCollision
Public Data Attributes:
Mollifier activation threshold.
Cached distance type.
Inherited from
EdgeEdgeCandidate
ID of the first edge.
ID of the second edge.
Inherited from
NormalCollision
The minimum separation distance.
The term's weight (e.g., collision area)
The gradient of the term's weight wrt the rest positions.
Public Methods:
__init__
(*args, **kwargs)Overloaded function.
__eq__
(self, other)__ne__
(self, other)__lt__
(self, other)Inherited from
EdgeEdgeCandidate
__init__
(self, edge0_id, edge1_id)known_dtype
(self)__str__
(self)__repr__
(self)__eq__
(self, other)__ne__
(self, other)__lt__
(self, other)Compare EdgeEdgeCandidates for sorting.
Inherited from
NormalCollision
__init__
(*args, **kwargs)is_mollified
(self)Does the distance potentially have to be mollified?
mollifier_threshold
(self, rest_positions)Compute the mollifier threshold for the distance.
mollifier
(*args, **kwargs)Overloaded function.
mollifier_gradient
(*args, **kwargs)Overloaded function.
mollifier_hessian
(*args, **kwargs)Overloaded function.
mollifier_gradient_wrt_x
(self, ...)Compute the gradient of the mollifier for the distance w.r.t.
mollifier_gradient_jacobian_wrt_x
(self, ...)Compute the jacobian of the distance mollifier's gradient w.r.t.
Inherited from
CollisionStencil
__init__
(*args, **kwargs)num_vertices
(self)Get the number of vertices in the collision stencil.
dim
(self, ndof)Get the dimension of the collision stencil.
vertex_ids
(self, edges, faces)Get the vertex IDs of the collision stencil.
vertices
(self, vertices, edges, faces)Get the vertex attributes of the collision stencil.
dof
(self, X, edges, faces)Select this stencil's DOF from the full matrix of DOF.
compute_distance
(self, positions)Compute the distance of the stencil.
compute_distance_gradient
(self, positions)Compute the distance gradient of the stencil w.r.t.
compute_distance_hessian
(self, positions)Compute the distance Hessian of the stencil w.r.t.
Inherited from
ContinuousCollisionCandidate
__init__
(*args, **kwargs)ccd
(self, vertices_t0, 1]], vertices_t1, ...)Perform narrow-phase CCD on the candidate.
print_ccd_query
(self, vertices_t0, vertices_t1)Print the CCD query to cout.
Inherited from
pybind11_object
-
__annotations__ =
{}
¶
- __eq__(self, other: ipctk.EdgeEdgeNormalCollision) bool ¶
-
__hash__ =
None
¶
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: ipctk.EdgeEdgeNormalCollision, edge0_id: int, edge1_id: int, eps_x: float, dtype: ipctk.EdgeEdgeDistanceType = <EdgeEdgeDistanceType.AUTO: 9>) -> None
__init__(self: ipctk.EdgeEdgeNormalCollision, candidate: ipctk.EdgeEdgeCandidate, eps_x: float, dtype: ipctk.EdgeEdgeDistanceType = <EdgeEdgeDistanceType.AUTO: 9>) -> None
- __lt__(self, other: ipctk.EdgeEdgeNormalCollision) bool ¶
-
__module__ =
'ipctk'
¶
- __ne__(self, other: ipctk.EdgeEdgeNormalCollision) bool ¶
- property dtype : ipctk.EdgeEdgeDistanceType¶
Cached distance type.
Some EE collisions are mollified EV or VV collisions.
- property eps_x : float¶
Mollifier activation threshold.
-
__annotations__ =
Face-Vertex Normal Collision¶
- class ipctk.FaceVertexNormalCollision¶
Bases:
FaceVertexCandidate
,NormalCollision
Public Data Attributes:
Inherited from
FaceVertexCandidate
ID of the face
ID of the vertex
Inherited from
NormalCollision
The minimum separation distance.
The term's weight (e.g., collision area)
The gradient of the term's weight wrt the rest positions.
Public Methods:
__init__
(*args, **kwargs)Overloaded function.
Inherited from
FaceVertexCandidate
__init__
(self, face_id, vertex_id)known_dtype
(self)__str__
(self)__repr__
(self)__eq__
(self, other)__ne__
(self, other)__lt__
(self, other)Compare FaceVertexCandidate for sorting.
Inherited from
NormalCollision
__init__
(*args, **kwargs)is_mollified
(self)Does the distance potentially have to be mollified?
mollifier_threshold
(self, rest_positions)Compute the mollifier threshold for the distance.
mollifier
(*args, **kwargs)Overloaded function.
mollifier_gradient
(*args, **kwargs)Overloaded function.
mollifier_hessian
(*args, **kwargs)Overloaded function.
mollifier_gradient_wrt_x
(self, ...)Compute the gradient of the mollifier for the distance w.r.t.
mollifier_gradient_jacobian_wrt_x
(self, ...)Compute the jacobian of the distance mollifier's gradient w.r.t.
Inherited from
CollisionStencil
__init__
(*args, **kwargs)num_vertices
(self)Get the number of vertices in the collision stencil.
dim
(self, ndof)Get the dimension of the collision stencil.
vertex_ids
(self, edges, faces)Get the vertex IDs of the collision stencil.
vertices
(self, vertices, edges, faces)Get the vertex attributes of the collision stencil.
dof
(self, X, edges, faces)Select this stencil's DOF from the full matrix of DOF.
compute_distance
(self, positions)Compute the distance of the stencil.
compute_distance_gradient
(self, positions)Compute the distance gradient of the stencil w.r.t.
compute_distance_hessian
(self, positions)Compute the distance Hessian of the stencil w.r.t.
Inherited from
ContinuousCollisionCandidate
__init__
(*args, **kwargs)ccd
(self, vertices_t0, 1]], vertices_t1, ...)Perform narrow-phase CCD on the candidate.
print_ccd_query
(self, vertices_t0, vertices_t1)Print the CCD query to cout.
Inherited from
pybind11_object
-
__annotations__ =
{}
¶
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: ipctk.FaceVertexNormalCollision, face_id: int, vertex_id: int) -> None
__init__(self: ipctk.FaceVertexNormalCollision, candidate: ipctk.FaceVertexCandidate) -> None
-
__module__ =
'ipctk'
¶
-
__annotations__ =
Plane-Vertex Normal Collision¶
- class ipctk.PlaneVertexNormalCollision¶
Bases:
NormalCollision
Public Data Attributes:
The plane's origin.
The plane's normal.
The vertex's id.
Inherited from
NormalCollision
The minimum separation distance.
The term's weight (e.g., collision area)
The gradient of the term's weight wrt the rest positions.
Public Methods:
__init__
(self, plane_origin, plane_normal, ...)Inherited from
NormalCollision
__init__
(*args, **kwargs)is_mollified
(self)Does the distance potentially have to be mollified?
mollifier_threshold
(self, rest_positions)Compute the mollifier threshold for the distance.
mollifier
(*args, **kwargs)Overloaded function.
mollifier_gradient
(*args, **kwargs)Overloaded function.
mollifier_hessian
(*args, **kwargs)Overloaded function.
mollifier_gradient_wrt_x
(self, ...)Compute the gradient of the mollifier for the distance w.r.t.
mollifier_gradient_jacobian_wrt_x
(self, ...)Compute the jacobian of the distance mollifier's gradient w.r.t.
Inherited from
CollisionStencil
__init__
(*args, **kwargs)num_vertices
(self)Get the number of vertices in the collision stencil.
dim
(self, ndof)Get the dimension of the collision stencil.
vertex_ids
(self, edges, faces)Get the vertex IDs of the collision stencil.
vertices
(self, vertices, edges, faces)Get the vertex attributes of the collision stencil.
dof
(self, X, edges, faces)Select this stencil's DOF from the full matrix of DOF.
compute_distance
(self, positions)Compute the distance of the stencil.
compute_distance_gradient
(self, positions)Compute the distance gradient of the stencil w.r.t.
compute_distance_hessian
(self, positions)Compute the distance Hessian of the stencil w.r.t.
Inherited from
pybind11_object
-
__annotations__ =
{}
¶
- __init__(self, plane_origin: numpy.ndarray[numpy.float64[m, 1]], plane_normal: numpy.ndarray[numpy.float64[m, 1]], vertex_id: int)¶
-
__module__ =
'ipctk'
¶
- property plane_normal : numpy.ndarray[numpy.float64[m, 1]]¶
The plane’s normal.
- property plane_origin : numpy.ndarray[numpy.float64[m, 1]]¶
The plane’s origin.
- property vertex_id : int¶
The vertex’s id.
-
__annotations__ =