Normal Collisions

Normal Collisions

class ipctk.NormalCollisions

Bases: pybind11_object

Public Data Attributes:

use_area_weighting

If the NormalCollisions should use the convergent formulation.

use_improved_max_approximator

If the NormalCollisions should use the improved max approximator.

enable_shape_derivatives

If the NormalCollisions 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 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.

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'
__str__(self: ipctk.NormalCollisions, mesh: ipc::CollisionMesh, vertices: numpy.ndarray[numpy.float64[m, n]]) str
build(*args, **kwargs)

Overloaded function.

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

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

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::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]
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.

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::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]

Normal Collision

class ipctk.NormalCollision

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.

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.

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

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

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

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

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

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

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 Normal Collision

class ipctk.VertexVertexNormalCollision

Bases: VertexVertexCandidate, NormalCollision

Public Data Attributes:

Inherited from VertexVertexCandidate

vertex0_id

ID of the first vertex

vertex1_id

ID of the second vertex

Inherited from NormalCollision

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

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

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

__module__ = 'ipctk'

Edge-Vertex Normal Collision

class ipctk.EdgeVertexNormalCollision

Bases: EdgeVertexCandidate, NormalCollision

Public Data Attributes:

Inherited from EdgeVertexCandidate

edge_id

ID of the edge

vertex_id

ID of the vertex

Inherited from NormalCollision

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

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

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

__module__ = 'ipctk'

Edge-Edge Normal Collision

class ipctk.EdgeEdgeNormalCollision

Bases: EdgeEdgeCandidate, NormalCollision

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 NormalCollision

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

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

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

Face-Vertex Normal Collision

class ipctk.FaceVertexNormalCollision

Bases: FaceVertexCandidate, NormalCollision

Public Data Attributes:

Inherited from FaceVertexCandidate

face_id

ID of the face

vertex_id

ID of the vertex

Inherited from NormalCollision

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

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

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

__module__ = 'ipctk'

Plane-Vertex Normal Collision

class ipctk.PlaneVertexNormalCollision

Bases: NormalCollision

Public Data Attributes:

plane_origin

The plane's origin.

plane_normal

The plane's normal.

vertex_id

The vertex's id.

Inherited from NormalCollision

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


Last update: Dec 03, 2024