Collisions

Collisions

class ipctk.Collisions

Bases: pybind11_object

Public Data Attributes:

use_convergent_formulation

If the collisions should use the convergent formulation.

are_shape_derivatives_enabled

If the collisions are using the convergent formulation.

vv_collisions

ev_collisions

ee_collisions

fv_collisions

pv_collisions

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 is 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.

to_string(*args, **kwargs)

Overloaded function.

Inherited from pybind11_object

__annotations__ = {}
__getitem__(self, i: int) ipctk.Collision

Get a reference to collision at index i.

Parameters:
i: int

The index of the collision.

Returns:

A reference to the collision.

__init__(self)
__len__(self) int

Get the number of collisions.

__module__ = 'ipctk'
property are_shape_derivatives_enabled : bool

If the collisions are using the convergent formulation.

build(*args, **kwargs)

Overloaded function.

  1. build(self: ipctk.Collisions, 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.

  2. build(self: ipctk.Collisions, 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.Collisions, mesh: ipc::CollisionMesh, vertices: numpy.ndarray[numpy.float64[m, n]]) float

Computes the minimum distance between any non-adjacent elements.

Parameters:
mesh

The collision mesh.

vertices

Vertices of the collision mesh.

Returns:

The minimum distance between any non-adjacent elements.

property ee_collisions : list[ipc::EdgeEdgeCollision]
empty(self) bool

Get if the collision set is empty.

property ev_collisions : list[ipc::EdgeVertexCollision]
property fv_collisions : list[ipc::FaceVertexCollision]
is_edge_edge(self, i: int) bool

Get if the collision at i is an edge-edge collision.

Parameters:
i: int

The index of the collision.nose

Returns:

If the collision at i is an edge-edge collision.

is_edge_vertex(self, i: int) bool

Get if the collision at i is an edge-vertex collision.

Parameters:
i: int

The index of the collision.

Returns:

If the collision at i is an edge-vertex collision.

is_face_vertex(self, i: int) bool

Get if the collision at i is an face-vertex collision.

Parameters:
i: int

The index of the collision.

Returns:

If the collision at i is an face-vertex collision.

is_plane_vertex(self, i: int) bool

Get if the collision at i is an plane-vertex collision.

Parameters:
i: int

The index of the collision.

Returns:

If the collision at i is an plane-vertex collision.

is_vertex_vertex(self, i: int) bool

Get if the collision at i is a vertex-vertex collision.

Parameters:
i: int

The index of the collision.

Returns:

If the collision at i is a vertex-vertex collision.

property pv_collisions : list[ipc::PlaneVertexCollision]
to_string(*args, **kwargs)

Overloaded function.

  1. to_string(self: ipctk.Collisions, mesh: ipc::CollisionMesh, vertices: numpy.ndarray[numpy.float64[m, n]]) -> str

  2. to_string(self: ipctk.Collisions, mesh: ipc::CollisionMesh, vertices: numpy.ndarray[numpy.float64[m, n]]) -> str

property use_convergent_formulation : bool

If the collisions should use the convergent formulation.

property vv_collisions : list[ipc::VertexVertexCollision]

Collision

class ipctk.Collision

Bases: CollisionStencil

Public Data Attributes:

dmin

The minimum separation distance.

weight

The term's weight (e.g., collision area)

weight_gradient

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.

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.

  1. mollifier(self: ipctk.Collision, 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.

  2. mollifier(self: ipctk.Collision, 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.

  1. mollifier_gradient(self: ipctk.Collision, 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.

  2. mollifier_gradient(self: ipctk.Collision, 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.

Parameters:
rest_positions: numpy.ndarray[numpy.float64[m, 1]]

The stencil’s rest vertex positions.

positions: numpy.ndarray[numpy.float64[m, 1]]

The stencil’s vertex positions.

Returns:

The jacobian of the 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.

Parameters:
rest_positions: numpy.ndarray[numpy.float64[m, 1]]

The stencil’s rest vertex positions.

positions: numpy.ndarray[numpy.float64[m, 1]]

The stencil’s vertex positions.

Returns:

The mollifier gradient w.r.t. rest positions.

mollifier_hessian(*args, **kwargs)

Overloaded function.

  1. mollifier_hessian(self: ipctk.Collision, 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.

  2. mollifier_hessian(self: ipctk.Collision, 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.

Parameters:
rest_positions: numpy.ndarray[numpy.float64[m, 1]]

The stencil’s rest vertex positions.

Returns:

The mollifier threshold.

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.

Vertex-Vertex Collision

class ipctk.VertexVertexCollision

Bases: VertexVertexCandidate, Collision

Public Data Attributes:

Inherited from VertexVertexCandidate

vertex0_id

ID of the first vertex

vertex1_id

ID of the second vertex

Inherited from Collision

dmin

The minimum separation distance.

weight

The term's weight (e.g., collision area)

weight_gradient

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 Collision

__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.

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, 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.

  1. __init__(self: ipctk.VertexVertexCollision, vertex0_id: int, vertex1_id: int) -> None

  2. __init__(self: ipctk.VertexVertexCollision, vv_candidate: ipctk.VertexVertexCandidate) -> None

__module__ = 'ipctk'

Edge-Vertex Collision

class ipctk.EdgeVertexCollision

Bases: EdgeVertexCandidate, Collision

Public Data Attributes:

Inherited from EdgeVertexCandidate

edge_id

ID of the edge

vertex_id

ID of the vertex

Inherited from Collision

dmin

The minimum separation distance.

weight

The term's weight (e.g., collision area)

weight_gradient

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 Collision

__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.

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, 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.

  1. __init__(self: ipctk.EdgeVertexCollision, edge_id: int, vertex_id: int) -> None

  2. __init__(self: ipctk.EdgeVertexCollision, candidate: ipctk.EdgeVertexCandidate) -> None

__module__ = 'ipctk'

Edge-Edge Collision

class ipctk.EdgeEdgeCollision

Bases: EdgeEdgeCandidate, Collision

Public Data Attributes:

eps_x

Mollifier activation threshold.

dtype

Cached distance type.

Inherited from EdgeEdgeCandidate

edge0_id

ID of the first edge.

edge1_id

ID of the second edge.

Inherited from Collision

dmin

The minimum separation distance.

weight

The term's weight (e.g., collision area)

weight_gradient

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 Collision

__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.

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, 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.EdgeEdgeCollision) bool
__hash__ = None
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: ipctk.EdgeEdgeCollision, edge0_id: int, edge1_id: int, eps_x: float, dtype: ipctk.EdgeEdgeDistanceType = <EdgeEdgeDistanceType.AUTO: 9>) -> None

  2. __init__(self: ipctk.EdgeEdgeCollision, candidate: ipctk.EdgeEdgeCandidate, eps_x: float, dtype: ipctk.EdgeEdgeDistanceType = <EdgeEdgeDistanceType.AUTO: 9>) -> None

__lt__(self, other: ipctk.EdgeEdgeCollision) bool
__module__ = 'ipctk'
__ne__(self, other: ipctk.EdgeEdgeCollision) bool
property dtype : ipctk.EdgeEdgeDistanceType

Cached distance type.

Some EE collisions are mollified EV or VV collisions.

property eps_x : float

Mollifier activation threshold.

Face-Vertex Collision

class ipctk.FaceVertexCollision

Bases: FaceVertexCandidate, Collision

Public Data Attributes:

Inherited from FaceVertexCandidate

face_id

ID of the face

vertex_id

ID of the vertex

Inherited from Collision

dmin

The minimum separation distance.

weight

The term's weight (e.g., collision area)

weight_gradient

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 Collision

__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.

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, 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.

  1. __init__(self: ipctk.FaceVertexCollision, face_id: int, vertex_id: int) -> None

  2. __init__(self: ipctk.FaceVertexCollision, candidate: ipctk.FaceVertexCandidate) -> None

__module__ = 'ipctk'

Plane-Vertex Collision

class ipctk.PlaneVertexCollision

Bases: Collision

Public Data Attributes:

plane_origin

plane_normal

vertex_id

Inherited from Collision

dmin

The minimum separation distance.

weight

The term's weight (e.g., collision area)

weight_gradient

The gradient of the term's weight wrt the rest positions.

Public Methods:

__init__(self, plane_origin, plane_normal, ...)

Inherited from Collision

__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.

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]]
property plane_origin : numpy.ndarray[numpy.float64[m, 1]]
property vertex_id : int

Last update: Feb 23, 2024