Candidates

Candidates

class ipctk.Candidates

Bases: pybind11_object

Public Data Attributes:

ev_candidates

ee_candidates

fv_candidates

Public Methods:

__init__(self)

build(*args, **kwargs)

Overloaded function.

__len__(self)

empty(self)

clear(self)

__getitem__(self, arg0)

is_step_collision_free(self, mesh, ...)

Determine if the step is collision free from the set of candidates.

compute_collision_free_stepsize(self, mesh, ...)

Computes a maximal step size that is collision free using the set of collision candidates.

compute_noncandidate_conservative_stepsize(...)

Computes a conservative bound on the largest-feasible step size for surface primitives not in contact.

compute_cfl_stepsize(self, mesh, ...)

Computes a CFL-inspired CCD maximum step step size.

save_obj(self, filename, vertices, edges, faces)

Inherited from pybind11_object

__annotations__ = {}
__getitem__(self, arg0: int) ipc::ContinuousCollisionCandidate
__init__(self)
__len__(self) int
__module__ = 'ipctk'
build(*args, **kwargs)

Overloaded function.

  1. build(self: ipctk.Candidates, mesh: ipc::CollisionMesh, vertices: numpy.ndarray[numpy.float64[m, n]], inflation_radius: float = 0, broad_phase_method: ipctk.BroadPhaseMethod = <BroadPhaseMethod.HASH_GRID: 1>) -> None

    Initialize the set of discrete collision detection candidates.

    Parameters:

    mesh: The surface of the contact mesh. vertices: Surface vertex positions (rowwise). inflation_radius: Amount to inflate the bounding boxes. broad_phase_method: Broad phase method to use.

  2. build(self: ipctk.Candidates, mesh: ipc::CollisionMesh, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], inflation_radius: float = 0, broad_phase_method: ipctk.BroadPhaseMethod = <BroadPhaseMethod.HASH_GRID: 1>) -> None

    Initialize the set of continuous collision detection candidates.

    Note:

    Assumes the trajectory is linear.

    Parameters:

    mesh: The surface of the contact mesh. vertices_t0: Surface vertex starting positions (rowwise). vertices_t1: Surface vertex ending positions (rowwise). inflation_radius: Amount to inflate the bounding boxes. broad_phase_method: Broad phase method to use.

clear(self) None
compute_cfl_stepsize(self: ipctk.Candidates, mesh: ipc::CollisionMesh, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], dhat: float, broad_phase_method: ipctk.BroadPhaseMethod = <BroadPhaseMethod.HASH_GRID: 1>, min_distance: float = 0.0, tolerance: float = 1e-06, max_iterations: int = 10000000) float

Computes a CFL-inspired CCD maximum step step size.

Parameters:
mesh

The collision mesh.

vertices_t0

Surface vertex starting positions (rowwise).

vertices_t1

Surface vertex ending positions (rowwise).

dhat

Barrier activation distance.

min_distance

The minimum distance allowable between any two elements.

tolerance

The tolerance for the CCD algorithm.

max_iterations

The maximum number of iterations for the CCD algorithm.

compute_collision_free_stepsize(self: ipctk.Candidates, mesh: ipc::CollisionMesh, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], min_distance: float = 0.0, tolerance: float = 1e-06, max_iterations: int = 10000000) float

Computes a maximal step size that is collision free using the set of collision candidates.

Note

Assumes the trajectory is linear.

Parameters:
mesh

The collision mesh.

vertices_t0

Surface vertex starting positions (rowwise). Assumed to be intersection free.

vertices_t1

Surface vertex ending positions (rowwise).

min_distance

The minimum distance allowable between any two elements.

tolerance

The tolerance for the CCD algorithm.

max_iterations

The maximum number of iterations for the CCD algorithm.

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.

compute_noncandidate_conservative_stepsize(self: ipctk.Candidates, mesh: ipc::CollisionMesh, displacements: numpy.ndarray[numpy.float64[m, n]], dhat: float) float

Computes a conservative bound on the largest-feasible step size for surface primitives not in contact.

Parameters:
mesh

The collision mesh.

displacements

Surface vertex displacements (rowwise).

dhat

Barrier activation distance.

property ee_candidates : list[ipc::EdgeEdgeCandidate]
empty(self) bool
property ev_candidates : list[ipc::EdgeVertexCandidate]
property fv_candidates : list[ipc::FaceVertexCandidate]
is_step_collision_free(self: ipctk.Candidates, mesh: ipc::CollisionMesh, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], min_distance: float = 0.0, tolerance: float = 1e-06, max_iterations: int = 10000000) bool

Determine if the step is collision free from the set of candidates.

Note

Assumes the trajectory is linear.

Parameters:
mesh

The collision mesh.

vertices_t0

Surface vertex starting positions (rowwise).

vertices_t1

Surface vertex ending positions (rowwise).

min_distance

The minimum distance allowable between any two elements.

tolerance

The tolerance for the CCD algorithm.

max_iterations

The maximum number of iterations for the CCD algorithm.

Returns:

True if <b>any</b> collisions occur.

save_obj(self, filename: str, vertices: numpy.ndarray[numpy.float64[m, n]], edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]]) bool

Collision Stencil

Error

This autoclass is not working. I don’t know why. I have to investigate.

Continuous Collision Candidate

class ipctk.ContinuousCollisionCandidate

Bases: pybind11_object

Public Methods:

__init__(*args, **kwargs)

ccd(self, vertices_t0, vertices_t1, edges, faces)

Perform narrow-phase CCD on the candidate.

print_ccd_query(self, vertices_t0, ...)

Inherited from pybind11_object

__annotations__ = {}
__init__(*args, **kwargs)
__module__ = 'ipctk'
ccd(self, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]], min_distance: float = 0.0, tmax: float = 1.0, tolerance: float = 1e-06, max_iterations: int = 10000000, conservative_rescaling: float = 0.8) tuple[bool, float]

Perform narrow-phase CCD on the candidate.

Parameters:
vertices_t0: numpy.ndarray[numpy.float64[m, n]]

Mesh vertices at the start of the time step.

vertices_t1: numpy.ndarray[numpy.float64[m, n]]

Mesh vertices at the end of the time step.

edges: numpy.ndarray[numpy.int32[m, n]]

Collision mesh edges as rows of indicies into vertices.

faces: numpy.ndarray[numpy.int32[m, n]]

Collision mesh triangular faces as rows of indicies into vertices.

min_distance: float = 0.0

Minimum separation distance between primitives.

tmax: float = 1.0

Maximum time (normalized) to look for collisions. Should be in [0, 1].

tolerance: float = 1e-06

CCD tolerance used by Tight-Inclusion CCD.

max_iterations: int = 10000000

Maximum iterations used by Tight-Inclusion CCD.

conservative_rescaling: float = 0.8

Conservative rescaling value used to avoid taking steps exactly to impact.

Returns:

If the candidate had a collision over the time interval. Computed time of impact (normalized).

Return type:

Tuple of

print_ccd_query(self, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]]) None

Vertex-Vertex Candidate

class ipctk.VertexVertexCandidate

Bases: CollisionStencil

Public Data Attributes:

vertex0_id

ID of the first vertex

vertex1_id

ID of the second vertex

Public Methods:

__init__(self, vertex0_id, vertex1_id)

__str__(self)

__repr__(self)

num_vertices(self)

vertex_ids(self, edges, faces)

Get the indices of the vertices

__eq__(self, other)

__ne__(self, other)

__lt__(self, other)

Compare EdgeVertexCandidates for sorting.

Inherited from CollisionStencil

__init__(*args, **kwargs)

num_vertices(self)

Get the number of vertices in the contact stencil.

vertex_ids(self, edges, faces)

Get the vertex IDs of the contact stencil.

vertices(self, vertices, edges, faces)

Get the vertex attributes of the contact stencil.

dof(self, X, edges, faces)

Select this stencil's DOF from the full matrix of DOF.

compute_distance(self, vertices, edges, faces)

Compute the distance of the stencil.

compute_distance_gradient(self, vertices, ...)

Compute the distance gradient of the stencil w.r.t.

compute_distance_hessian(self, vertices, ...)

Compute the distance Hessian of the stencil w.r.t.

Inherited from pybind11_object

__annotations__ = {}
__eq__(self, other: ipctk.VertexVertexCandidate) bool
__hash__ = None
__init__(self, vertex0_id: int, vertex1_id: int)
__lt__(self, other: ipctk.VertexVertexCandidate) bool

Compare EdgeVertexCandidates for sorting.

__module__ = 'ipctk'
__ne__(self, other: ipctk.VertexVertexCandidate) bool
__repr__(self) str
__str__(self) str
num_vertices(self) int
property vertex0_id : int

ID of the first vertex

property vertex1_id : int

ID of the second vertex

vertex_ids(self, edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]]) list[int[4]]

Get the indices of the vertices

Parameters:
edges: numpy.ndarray[numpy.int32[m, n]]

edge matrix of mesh

faces: numpy.ndarray[numpy.int32[m, n]]

face matrix of mesh

Returns:

List of vertex indices

Edge-Vertex Candidate

class ipctk.EdgeVertexCandidate

Bases: CollisionStencil, ContinuousCollisionCandidate

Public Data Attributes:

edge_id

ID of the edge

vertex_id

ID of the vertex

Public Methods:

__init__(self, edge_id, vertex_id)

__str__(self)

__repr__(self)

num_vertices(self)

vertex_ids(self, edges, faces)

ccd(self, vertices_t0, vertices_t1, edges, faces)

Perform narrow-phase CCD on the candidate.

print_ccd_query(self, vertices_t0, ...)

__eq__(self, other)

__ne__(self, other)

__lt__(self, other)

Compare EdgeVertexCandidates for sorting.

Inherited from CollisionStencil

__init__(*args, **kwargs)

num_vertices(self)

Get the number of vertices in the contact stencil.

vertex_ids(self, edges, faces)

Get the vertex IDs of the contact stencil.

vertices(self, vertices, edges, faces)

Get the vertex attributes of the contact stencil.

dof(self, X, edges, faces)

Select this stencil's DOF from the full matrix of DOF.

compute_distance(self, vertices, edges, faces)

Compute the distance of the stencil.

compute_distance_gradient(self, vertices, ...)

Compute the distance gradient of the stencil w.r.t.

compute_distance_hessian(self, vertices, ...)

Compute the distance Hessian of the stencil w.r.t.

Inherited from ContinuousCollisionCandidate

__init__(*args, **kwargs)

ccd(self, vertices_t0, vertices_t1, edges, faces)

Perform narrow-phase CCD on the candidate.

print_ccd_query(self, vertices_t0, ...)

Inherited from pybind11_object

__annotations__ = {}
__eq__(self, other: ipctk.EdgeVertexCandidate) bool
__hash__ = None
__init__(self, edge_id: int, vertex_id: int)
__lt__(self, other: ipctk.EdgeVertexCandidate) bool

Compare EdgeVertexCandidates for sorting.

__module__ = 'ipctk'
__ne__(self, other: ipctk.EdgeVertexCandidate) bool
__repr__(self) str
__str__(self) str
ccd(self, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]], min_distance: float = 0.0, tmax: float = 1.0, tolerance: float = 1e-06, max_iterations: int = 10000000, conservative_rescaling: float = 0.8) tuple[bool, float]

Perform narrow-phase CCD on the candidate.

Parameters:
vertices_t0: numpy.ndarray[numpy.float64[m, n]]

Mesh vertices at the start of the time step.

vertices_t1: numpy.ndarray[numpy.float64[m, n]]

Mesh vertices at the end of the time step.

edges: numpy.ndarray[numpy.int32[m, n]]

Collision mesh edges as rows of indicies into vertices.

faces: numpy.ndarray[numpy.int32[m, n]]

Collision mesh triangular faces as rows of indicies into vertices.

tmax: float = 1.0

Maximum time (normalized) to look for collisions. Should be in [0, 1].

tolerance: float = 1e-06

CCD tolerance used by Tight-Inclusion CCD.

max_iterations: int = 10000000

Maximum iterations used by Tight-Inclusion CCD.

conservative_rescaling: float = 0.8

Conservative rescaling value used to avoid taking steps exactly to impact.

Returns:

If the candidate had a collision over the time interval. Computed time of impact (normalized).

Return type:

Tuple of

property edge_id : int

ID of the edge

num_vertices(self) int
print_ccd_query(self, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]]) None
property vertex_id : int

ID of the vertex

vertex_ids(self, edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]]) list[int[4]]

Edge-Edge Candidate

class ipctk.EdgeEdgeCandidate

Bases: CollisionStencil, ContinuousCollisionCandidate

Public Data Attributes:

edge0_id

ID of the first edge

edge1_id

ID of the second edge

Public Methods:

__init__(self, edge0_id, edge1_id)

__str__(self)

__repr__(self)

num_vertices(self)

vertex_ids(self, edges, faces)

ccd(self, vertices_t0, vertices_t1, edges, faces)

Perform narrow-phase CCD on the candidate.

print_ccd_query(self, vertices_t0, ...)

__eq__(self, other)

__ne__(self, other)

__lt__(self, other)

Compare EdgeEdgeCandidates for sorting.

Inherited from CollisionStencil

__init__(*args, **kwargs)

num_vertices(self)

Get the number of vertices in the contact stencil.

vertex_ids(self, edges, faces)

Get the vertex IDs of the contact stencil.

vertices(self, vertices, edges, faces)

Get the vertex attributes of the contact stencil.

dof(self, X, edges, faces)

Select this stencil's DOF from the full matrix of DOF.

compute_distance(self, vertices, edges, faces)

Compute the distance of the stencil.

compute_distance_gradient(self, vertices, ...)

Compute the distance gradient of the stencil w.r.t.

compute_distance_hessian(self, vertices, ...)

Compute the distance Hessian of the stencil w.r.t.

Inherited from ContinuousCollisionCandidate

__init__(*args, **kwargs)

ccd(self, vertices_t0, vertices_t1, edges, faces)

Perform narrow-phase CCD on the candidate.

print_ccd_query(self, vertices_t0, ...)

Inherited from pybind11_object

__annotations__ = {}
__eq__(self, other: ipctk.EdgeEdgeCandidate) bool
__hash__ = None
__init__(self, edge0_id: int, edge1_id: int)
__lt__(self, other: ipctk.EdgeEdgeCandidate) bool

Compare EdgeEdgeCandidates for sorting.

__module__ = 'ipctk'
__ne__(self, other: ipctk.EdgeEdgeCandidate) bool
__repr__(self) str
__str__(self) str
ccd(self, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]], min_distance: float = 0.0, tmax: float = 1.0, tolerance: float = 1e-06, max_iterations: int = 10000000, conservative_rescaling: float = 0.8) tuple[bool, float]

Perform narrow-phase CCD on the candidate.

Parameters:
vertices_t0: numpy.ndarray[numpy.float64[m, n]]

Mesh vertices at the start of the time step.

vertices_t1: numpy.ndarray[numpy.float64[m, n]]

Mesh vertices at the end of the time step.

edges: numpy.ndarray[numpy.int32[m, n]]

Collision mesh edges as rows of indicies into vertices.

faces: numpy.ndarray[numpy.int32[m, n]]

Collision mesh triangular faces as rows of indicies into vertices.

tmax: float = 1.0

Maximum time (normalized) to look for collisions. Should be in [0, 1].

tolerance: float = 1e-06

CCD tolerance used by Tight-Inclusion CCD.

max_iterations: int = 10000000

Maximum iterations used by Tight-Inclusion CCD.

conservative_rescaling: float = 0.8

Conservative rescaling value used to avoid taking steps exactly to impact.

Returns:

If the candidate had a collision over the time interval. Computed time of impact (normalized).

Return type:

Tuple of

property edge0_id : int

ID of the first edge

property edge1_id : int

ID of the second edge

num_vertices(self) int
print_ccd_query(self, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]]) None
vertex_ids(self, edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]]) list[int[4]]

Edge-Face Candidate

class ipctk.EdgeFaceCandidate

Bases: pybind11_object

Public Data Attributes:

edge_id

ID of the edge

face_id

ID of the face

Public Methods:

__init__(self, edge_id, face_id)

__str__(self)

__repr__(self)

__eq__(self, other)

__ne__(self, other)

__lt__(self, other)

Compare EdgeFaceCandidate for sorting.

Inherited from pybind11_object

__annotations__ = {}
__eq__(self, other: ipctk.EdgeFaceCandidate) bool
__hash__ = None
__init__(self, edge_id: int, face_id: int)
__lt__(self, other: ipctk.EdgeFaceCandidate) bool

Compare EdgeFaceCandidate for sorting.

__module__ = 'ipctk'
__ne__(self, other: ipctk.EdgeFaceCandidate) bool
__repr__(self) str
__str__(self) str
property edge_id : int

ID of the edge

property face_id : int

ID of the face

Face-Vertex Candidate

class ipctk.FaceVertexCandidate

Bases: CollisionStencil, ContinuousCollisionCandidate

Public Data Attributes:

face_id

ID of the face

vertex_id

ID of the vertex

Public Methods:

__init__(self, face_id, vertex_id)

__str__(self)

__repr__(self)

num_vertices(self)

vertex_ids(self, edges, faces)

ccd(self, vertices_t0, vertices_t1, edges, faces)

print_ccd_query(self, vertices_t0, ...)

__eq__(self, other)

__ne__(self, other)

__lt__(self, other)

Compare FaceVertexCandidate for sorting.

Inherited from CollisionStencil

__init__(*args, **kwargs)

num_vertices(self)

Get the number of vertices in the contact stencil.

vertex_ids(self, edges, faces)

Get the vertex IDs of the contact stencil.

vertices(self, vertices, edges, faces)

Get the vertex attributes of the contact stencil.

dof(self, X, edges, faces)

Select this stencil's DOF from the full matrix of DOF.

compute_distance(self, vertices, edges, faces)

Compute the distance of the stencil.

compute_distance_gradient(self, vertices, ...)

Compute the distance gradient of the stencil w.r.t.

compute_distance_hessian(self, vertices, ...)

Compute the distance Hessian of the stencil w.r.t.

Inherited from ContinuousCollisionCandidate

__init__(*args, **kwargs)

ccd(self, vertices_t0, vertices_t1, edges, faces)

Perform narrow-phase CCD on the candidate.

print_ccd_query(self, vertices_t0, ...)

Inherited from pybind11_object

__annotations__ = {}
__eq__(self, other: ipctk.FaceVertexCandidate) bool
__hash__ = None
__init__(self, face_id: int, vertex_id: int)
__lt__(self, other: ipctk.FaceVertexCandidate) bool

Compare FaceVertexCandidate for sorting.

__module__ = 'ipctk'
__ne__(self, other: ipctk.FaceVertexCandidate) bool
__repr__(self) str
__str__(self) str
ccd(self, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]], min_distance: float = 0.0, tmax: float = 1.0, tolerance: float = 1e-06, max_iterations: int = 10000000, conservative_rescaling: float = 0.8) tuple[bool, float]
property face_id : int

ID of the face

num_vertices(self) int
print_ccd_query(self, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]]) None
property vertex_id : int

ID of the vertex

vertex_ids(self, edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]]) list[int[4]]