Extremum-Sum Potential

ESP Parameters

class ipctk.ESPParameters

Bases: pybind11_object

Public Methods:

__init__(self, dhat, dbar_factor, ...)

Construct parameter set for ESP contact.

Inherited from pybind11_object

Private Methods:

_pybind11_conduit_v1_


class IntegrationType

Bases: pybind11_object

Members:

BRUTE_FORCE : Integrate all pairs with no obstacle filtering

NORMAL : Filter obstacle-obstacle pairs; skip primitives with only obstacle candidates

NO_OBST : Skip obstacle sources entirely, may miss collisions!

BRUTE_FORCE = <IntegrationType.BRUTE_FORCE: 0>
NORMAL = <IntegrationType.NORMAL: 1>
NO_OBST = <IntegrationType.NO_OBST: 2>
__annotations__ = {}
__eq__(self, other: object, /) → bool
__getstate__(self, /) → int
__hash__(self, /) → int
__index__(self, /) → int
__init__(self, value: SupportsInt)
__int__(self, /) → int
__members__ = {'BRUTE_FORCE': <IntegrationType.BRUTE_FORCE: 0>, 'NORMAL': <IntegrationType.NORMAL: 1>, 'NO_OBST': <IntegrationType.NO_OBST: 2>}
__module__ = 'ipctk'
__ne__(self, other: object, /) → bool
__repr__(self, /) → str
__setstate__(self, state: SupportsInt, /) → None
__str__(self, /) → str
_pybind11_conduit_v1_()
property name : str
property value : int
__annotations__ = {}
__init__(self: ipctk.ESPParameters, dhat: typing.SupportsFloat, dbar_factor: typing.SupportsFloat = 0.2, quad_order: typing.SupportsInt = 1, area_weights: bool = True, integration_type: ipctk.ESPParameters.IntegrationType = <IntegrationType.NORMAL: 1>)

Construct parameter set for ESP contact.

Parameters:
dhat

Activation distance of the barrier.

dbar_factor

Near/far split parameter dbar / dhat, in [0, 2]. The far part vanishes identically at 2; the edge-edge weights use the support min(dbar, dhat); 0 disables edge-edge contact.

quad_order

Gauss-Lobatto edge quadrature order (2D).

area_weights

Whether to weight the quadrature by area.

integration_type

Which obstacle primitives to integrate.

Raises:

ValueError – If dhat is not positive and finite, dbar_factor is not in [0, 2], or quad_order is negative.

__module__ = 'ipctk'
_pybind11_conduit_v1_()
property area_weights : bool
property dbar : float
property dhat : float
property integration_type : ipctk.ESPParameters.IntegrationType
property quad_order : int

ESP Collisions

class ipctk.ESPCollisions

Bases: pybind11_object

Public Methods:

__init__(self)

build(self, mesh, vertices, , ], param, ...)

Initialize the set of collisions used to compute the potential.

compute_minimum_distance(self, mesh, ...)

Computes the minimum squared distance over the collision candidates found by build().

__len__(self)

Get the number of collisions.

empty(self)

Get if the collision set is empty.

clear(self)

Clear the collision set.

to_string(self, mesh, vertices, , ], param)

n_candidates(self)

Get the number of candidates.

Inherited from pybind11_object

Private Methods:

_pybind11_conduit_v1_


__annotations__ = {}
__init__(self)
__len__(self) → int

Get the number of collisions.

__module__ = 'ipctk'
_pybind11_conduit_v1_()
build(self: ipctk.ESPCollisions, mesh: ipc::CollisionMesh, vertices: typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, n]", "flags.f_contiguous"], param: ipc::ESPParameters, broad_phase: ipctk.BroadPhase = None) → None

Initialize the set of collisions used to compute the potential.

Parameters:
mesh

The collision mesh.

vertices

Vertices of the collision mesh.

param

ESPParameters.

broad_phase

Broad phase method.

clear(self) → None

Clear the collision set.

compute_minimum_distance(self: ipctk.ESPCollisions, mesh: ipc::CollisionMesh, vertices: typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, n]", "flags.f_contiguous"]) → float

Computes the minimum squared distance over the collision candidates found by build().

Parameters:
mesh

The collision mesh.

vertices

Vertices of the collision mesh.

Returns:

The minimum squared distance, or inf if there are no candidates.

empty(self) → bool

Get if the collision set is empty.

n_candidates(self) → int

Get the number of candidates.

to_string(self: ipctk.ESPCollisions, mesh: ipc::CollisionMesh, vertices: typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, n]", "flags.f_contiguous"], param: ipc::ESPParameters) → str

ESP Potential

class ipctk.ESPPotential

Bases: pybind11_object

Public Methods:

__init__(self, param[, use_near_far])

Construct an Extremum Sum Potential (ESP).

__call__(self, collisions, mesh, vertices, , ])

Compute the barrier potential for a set of collisions.

gradient(self, collisions, mesh, vertices, , ])

Compute the gradient of the barrier potential.

hessian(self, collisions, mesh, vertices, , ...)

Compute the hessian of the barrier potential.

Inherited from pybind11_object

Private Methods:

_pybind11_conduit_v1_


__annotations__ = {}
__call__(self: ipctk.ESPPotential, collisions: ipctk.ESPCollisions, mesh: ipc::CollisionMesh, vertices: typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, n]", "flags.f_contiguous"]) → float

Compute the barrier potential for a set of collisions.

Parameters:
collisions

The set of collisions.

mesh

The collision mesh.

vertices

Vertices of the collision mesh.

Returns:

The sum of all barrier potentials (not scaled by the barrier stiffness).

__init__(self, param: ipctk.ESPParameters, use_near_far: bool = True)

Construct an Extremum Sum Potential (ESP).

Parameters:
param: ipctk.ESPParameters

A set of parameters.

use_near_far: bool = True

Whether to normalize the quadrature weights so they sum to 1, splitting near and far contributions when 0 < dbar_factor <= 2 (the far part vanishes at 2).

__module__ = 'ipctk'
_pybind11_conduit_v1_()
gradient(self: ipctk.ESPPotential, collisions: ipctk.ESPCollisions, mesh: ipc::CollisionMesh, vertices: typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, n]", "flags.f_contiguous"]) → Annotated[numpy.typing.NDArray[numpy.float64], '[m, 1]']

Compute the gradient of the barrier potential.

Parameters:
collisions

The set of collisions.

mesh

The collision mesh.

vertices

Vertices of the collision mesh.

Returns:

The gradient of all barrier potentials (not scaled by the barrier stiffness). This will have a size of |vertices|.

hessian(self: ipctk.ESPPotential, collisions: ipctk.ESPCollisions, mesh: ipc::CollisionMesh, vertices: typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, n]", "flags.f_contiguous"], project_hessian_to_psd: ipctk.PSDProjectionMethod = <PSDProjectionMethod.NONE: 0>) → scipy.sparse.csc_matrix[numpy.float64]

Compute the hessian of the barrier potential.

Parameters:
collisions

The set of collisions.

mesh

The collision mesh.

vertices

Vertices of the collision mesh.

project_hessian_to_psd

Make sure the hessian is positive semi-definite. With normalized weights and edge-edge terms, each face’s block is projected as a whole.

Returns:

The hessian of all barrier potentials (not scaled by the barrier stiffness). This will have a size of |vertices|x|vertices|.