Broad Phase

class ipctk.BroadPhaseMethod

Bases: pybind11_object

Enumeration of implemented broad phase methods.

Members:

BRUTE_FORCE : Brute force

HASH_GRID : Hash grid

SPATIAL_HASH : Spatial hash

BOUNDING_VOLUME_HIERARCHY : Bounding volume hierarchy

SWEEP_AND_PRUNE : Sweep and prune

SWEEP_AND_TINIEST_QUEUE : Sweep and tiniest queue (GPU)

Public Methods:

__init__(self, value)

__repr__(self)

__str__(self)

__eq__(self, other)

__ne__(self, other)

__getstate__(self)

__hash__(self)

__int__(self)

__index__(self)

__setstate__(self, state)

Inherited from pybind11_object

Private Data Attributes:

__entries


BOUNDING_VOLUME_HIERARCHY = <BroadPhaseMethod.BOUNDING_VOLUME_HIERARCHY: 3>
BRUTE_FORCE = <BroadPhaseMethod.BRUTE_FORCE: 0>
HASH_GRID = <BroadPhaseMethod.HASH_GRID: 1>
SPATIAL_HASH = <BroadPhaseMethod.SPATIAL_HASH: 2>
SWEEP_AND_PRUNE = <BroadPhaseMethod.SWEEP_AND_PRUNE: 4>
SWEEP_AND_TINIEST_QUEUE = <BroadPhaseMethod.SWEEP_AND_TINIEST_QUEUE: 5>
__annotations__ = {}
__eq__(self, other: object) bool
__getstate__(self) int
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__members__ = {'BOUNDING_VOLUME_HIERARCHY': <BroadPhaseMethod.BOUNDING_VOLUME_HIERARCHY: 3>, 'BRUTE_FORCE': <BroadPhaseMethod.BRUTE_FORCE: 0>, 'HASH_GRID': <BroadPhaseMethod.HASH_GRID: 1>, 'SPATIAL_HASH': <BroadPhaseMethod.SPATIAL_HASH: 2>, 'SWEEP_AND_PRUNE': <BroadPhaseMethod.SWEEP_AND_PRUNE: 4>, 'SWEEP_AND_TINIEST_QUEUE': <BroadPhaseMethod.SWEEP_AND_TINIEST_QUEUE: 5>}
__module__ = 'ipctk'
__ne__(self, other: object) bool
__repr__(self) str
__setstate__(self, state: int) None
__str__(self) str
property name : str
property value : int

Broad Phase

class ipctk.BroadPhase

Bases: pybind11_object

Public Data Attributes:

can_vertices_collide

Function for determining if two vertices can collide.

Public Methods:

__init__(*args, **kwargs)

make_broad_phase(method)

Construct a registered broad phase object.

build(*args, **kwargs)

Overloaded function.

clear(self)

Clear any built data.

detect_vertex_vertex_candidates(self)

Find the candidate vertex-vertex collisions.

detect_edge_vertex_candidates(self)

Find the candidate edge-vertex collisions.

detect_edge_edge_candidates(self)

Find the candidate edge-edge collisions.

detect_face_vertex_candidates(self)

Find the candidate face-vertex collisions.

detect_edge_face_candidates(self)

Find the candidate edge-face intersections.

detect_face_face_candidates(self)

Find the candidate face-face collisions.

detect_collision_candidates(self, dim)

Detect all collision candidates needed for a given dimensional simulation.

Inherited from pybind11_object

__annotations__ = {}
__init__(*args, **kwargs)
__module__ = 'ipctk'
build(*args, **kwargs)

Overloaded function.

  1. build(self: ipctk.BroadPhase, vertices: numpy.ndarray[numpy.float64[m, n]], edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]], inflation_radius: float = 0) -> None

    Build the broad phase for static collision detection.

    Parameters:

    vertices: Vertex positions edges: Collision mesh edges faces: Collision mesh faces inflation_radius: Radius of inflation around all elements.

  2. build(self: ipctk.BroadPhase, 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]], inflation_radius: float = 0) -> None

    Build the broad phase for continuous collision detection.

    Parameters:

    vertices_t0: Starting vertices of the vertices. vertices_t1: Ending vertices of the vertices. edges: Collision mesh edges faces: Collision mesh faces inflation_radius: Radius of inflation around all elements.

property can_vertices_collide : collections.abc.Callable[[int, int], bool]

Function for determining if two vertices can collide.

clear(self) None

Clear any built data.

detect_collision_candidates(self, dim: int) ipc::Candidates

Detect all collision candidates needed for a given dimensional simulation.

Parameters:
dim: int

The dimension of the simulation (i.e., 2 or 3).

candidates

The detected collision candidates.

detect_edge_edge_candidates(self) list[ipc::EdgeEdgeCandidate]

Find the candidate edge-edge collisions.

Returns:

The candidate edge-edge collisions.

detect_edge_face_candidates(self) list[ipc::EdgeFaceCandidate]

Find the candidate edge-face intersections.

Returns:

The candidate edge-face intersections.

detect_edge_vertex_candidates(self) list[ipc::EdgeVertexCandidate]

Find the candidate edge-vertex collisions.

Returns:

The candidate edge-vertex collisions.

detect_face_face_candidates(self) list[ipc::FaceFaceCandidate]

Find the candidate face-face collisions.

Returns:

The candidate face-face collisions.

detect_face_vertex_candidates(self) list[ipc::FaceVertexCandidate]

Find the candidate face-vertex collisions.

Returns:

The candidate face-vertex collisions.

detect_vertex_vertex_candidates(self) list[ipc::VertexVertexCandidate]

Find the candidate vertex-vertex collisions.

Returns:

The candidate vertex-vertex collisions.

static make_broad_phase(method: ipctk.BroadPhaseMethod) ipctk.BroadPhase

Construct a registered broad phase object.

Parameters:
method: ipctk.BroadPhaseMethod

The broad phase method to use.

Returns:

The constructed broad phase object.

Brute Force

class ipctk.BruteForce

Bases: BroadPhase

Public Data Attributes:

Inherited from BroadPhase

can_vertices_collide

Function for determining if two vertices can collide.

Public Methods:

__init__(self)

Inherited from BroadPhase

__init__(*args, **kwargs)

make_broad_phase(method)

Construct a registered broad phase object.

build(*args, **kwargs)

Overloaded function.

clear(self)

Clear any built data.

detect_vertex_vertex_candidates(self)

Find the candidate vertex-vertex collisions.

detect_edge_vertex_candidates(self)

Find the candidate edge-vertex collisions.

detect_edge_edge_candidates(self)

Find the candidate edge-edge collisions.

detect_face_vertex_candidates(self)

Find the candidate face-vertex collisions.

detect_edge_face_candidates(self)

Find the candidate edge-face intersections.

detect_face_face_candidates(self)

Find the candidate face-face collisions.

detect_collision_candidates(self, dim)

Detect all collision candidates needed for a given dimensional simulation.

Inherited from pybind11_object

__annotations__ = {}
__init__(self)
__module__ = 'ipctk'

Hash Grid

class ipctk.HashGrid

Bases: BroadPhase

Public Data Attributes:

cell_size

grid_size

domain_min

domain_max

Inherited from BroadPhase

can_vertices_collide

Function for determining if two vertices can collide.

Public Methods:

__init__(self)

Inherited from BroadPhase

__init__(*args, **kwargs)

make_broad_phase(method)

Construct a registered broad phase object.

build(*args, **kwargs)

Overloaded function.

clear(self)

Clear any built data.

detect_vertex_vertex_candidates(self)

Find the candidate vertex-vertex collisions.

detect_edge_vertex_candidates(self)

Find the candidate edge-vertex collisions.

detect_edge_edge_candidates(self)

Find the candidate edge-edge collisions.

detect_face_vertex_candidates(self)

Find the candidate face-vertex collisions.

detect_edge_face_candidates(self)

Find the candidate edge-face intersections.

detect_face_face_candidates(self)

Find the candidate face-face collisions.

detect_collision_candidates(self, dim)

Detect all collision candidates needed for a given dimensional simulation.

Inherited from pybind11_object

__annotations__ = {}
__init__(self)
__module__ = 'ipctk'
property cell_size : float
property domain_max : numpy.ndarray[numpy.float64[m, 1]]
property domain_min : numpy.ndarray[numpy.float64[m, 1]]
property grid_size : numpy.ndarray[numpy.int32[m, 1]]

Spatial Hash

class ipctk.SpatialHash

Bases: BroadPhase

Public Data Attributes:

left_bottom_corner

The left bottom corner of the world bounding box.

right_top_corner

The right top corner of the world bounding box.

voxel_count

The number of voxels in each dimension.

one_div_voxelSize

1.0 / voxel_size

voxel_count_0x1

The number of voxels in the first two dimensions.

edge_start_ind

tri_start_ind

voxel_to_primitives

Map from voxel index to the primitive indices it contains.

point_to_voxels

Map from point index to the voxel indices it occupies.

edge_to_voxels

Map from edge index to the voxel indices it occupies.

face_to_voxels

Map from face index to the voxel indices it occupies.

Inherited from BroadPhase

can_vertices_collide

Function for determining if two vertices can collide.

Public Methods:

__init__(*args, **kwargs)

Overloaded function.

build(*args, **kwargs)

Overloaded function.

clear(self)

is_vertex_index(self, idx)

Check if primitive index refers to a vertex.

is_edge_index(self, idx)

Check if primitive index refers to an edge.

is_triangle_index(self, idx)

Check if primitive index refers to a triangle.

to_edge_index(self, idx)

Convert a primitive index to an edge index.

to_triangle_index(self, idx)

Convert a primitive index to a triangle index.

Inherited from BroadPhase

__init__(*args, **kwargs)

make_broad_phase(method)

Construct a registered broad phase object.

build(*args, **kwargs)

Overloaded function.

clear(self)

Clear any built data.

detect_vertex_vertex_candidates(self)

Find the candidate vertex-vertex collisions.

detect_edge_vertex_candidates(self)

Find the candidate edge-vertex collisions.

detect_edge_edge_candidates(self)

Find the candidate edge-edge collisions.

detect_face_vertex_candidates(self)

Find the candidate face-vertex collisions.

detect_edge_face_candidates(self)

Find the candidate edge-face intersections.

detect_face_face_candidates(self)

Find the candidate face-face collisions.

detect_collision_candidates(self, dim)

Detect all collision candidates needed for a given dimensional simulation.

Inherited from pybind11_object

__annotations__ = {}
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: ipctk.SpatialHash) -> None

  2. __init__(self: ipctk.SpatialHash, vertices: numpy.ndarray[numpy.float64[m, n]], edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]], inflation_radius: float = 0, voxel_size: float = -1) -> None

  3. __init__(self: ipctk.SpatialHash, 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]], inflation_radius: float = 0, voxel_size: float = -1) -> None

__module__ = 'ipctk'
build(*args, **kwargs)

Overloaded function.

  1. build(self: ipctk.SpatialHash, vertices: numpy.ndarray[numpy.float64[m, n]], edges: numpy.ndarray[numpy.int32[m, n]], faces: numpy.ndarray[numpy.int32[m, n]], inflation_radius: float = 0, voxel_size: float = -1) -> None

  2. build(self: ipctk.SpatialHash, 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]], inflation_radius: float = 0, voxel_size: float = -1) -> None

clear(self) None
property edge_start_ind : int
property edge_to_voxels : list[list[int]]

Map from edge index to the voxel indices it occupies.

property face_to_voxels : list[list[int]]

Map from face index to the voxel indices it occupies.

is_edge_index(self, idx: int) bool

Check if primitive index refers to an edge.

is_triangle_index(self, idx: int) bool

Check if primitive index refers to a triangle.

is_vertex_index(self, idx: int) bool

Check if primitive index refers to a vertex.

property left_bottom_corner : numpy.ndarray[numpy.float64[m, 1]]

The left bottom corner of the world bounding box.

property one_div_voxelSize : float

1.0 / voxel_size

property point_to_voxels : list[list[int]]

Map from point index to the voxel indices it occupies.

property right_top_corner : numpy.ndarray[numpy.float64[m, 1]]

The right top corner of the world bounding box.

to_edge_index(self, idx: int) int

Convert a primitive index to an edge index.

to_triangle_index(self, idx: int) int

Convert a primitive index to a triangle index.

property tri_start_ind : int
property voxel_count : numpy.ndarray[numpy.int32[m, 1]]

The number of voxels in each dimension.

property voxel_count_0x1 : int

The number of voxels in the first two dimensions.

property voxel_to_primitives : tsl::robin_map<int, std::vector<int, std::allocator<int> >, absl::lts_20230125::hash_internal::Hash<int>, std::equal_to<int>, std::allocator<std::pair<int, std::vector<int, std::allocator<int> > > >, false, tsl::rh::power_of_two_growth_policy<2ul> >

Map from voxel index to the primitive indices it contains.

BVH

class ipctk.BVH

Bases: BroadPhase

Public Data Attributes:

Inherited from BroadPhase

can_vertices_collide

Function for determining if two vertices can collide.

Public Methods:

__init__(self)

Inherited from BroadPhase

__init__(*args, **kwargs)

make_broad_phase(method)

Construct a registered broad phase object.

build(*args, **kwargs)

Overloaded function.

clear(self)

Clear any built data.

detect_vertex_vertex_candidates(self)

Find the candidate vertex-vertex collisions.

detect_edge_vertex_candidates(self)

Find the candidate edge-vertex collisions.

detect_edge_edge_candidates(self)

Find the candidate edge-edge collisions.

detect_face_vertex_candidates(self)

Find the candidate face-vertex collisions.

detect_edge_face_candidates(self)

Find the candidate edge-face intersections.

detect_face_face_candidates(self)

Find the candidate face-face collisions.

detect_collision_candidates(self, dim)

Detect all collision candidates needed for a given dimensional simulation.

Inherited from pybind11_object

__annotations__ = {}
__init__(self)
__module__ = 'ipctk'

Sweep and Prune

class ipctk.SweepAndPrune

Bases: BroadPhase

Public Data Attributes:

Inherited from BroadPhase

can_vertices_collide

Function for determining if two vertices can collide.

Public Methods:

__init__(self)

Inherited from BroadPhase

__init__(*args, **kwargs)

make_broad_phase(method)

Construct a registered broad phase object.

build(*args, **kwargs)

Overloaded function.

clear(self)

Clear any built data.

detect_vertex_vertex_candidates(self)

Find the candidate vertex-vertex collisions.

detect_edge_vertex_candidates(self)

Find the candidate edge-vertex collisions.

detect_edge_edge_candidates(self)

Find the candidate edge-edge collisions.

detect_face_vertex_candidates(self)

Find the candidate face-vertex collisions.

detect_edge_face_candidates(self)

Find the candidate edge-face intersections.

detect_face_face_candidates(self)

Find the candidate face-face collisions.

detect_collision_candidates(self, dim)

Detect all collision candidates needed for a given dimensional simulation.

Inherited from pybind11_object

__annotations__ = {}
__init__(self)
__module__ = 'ipctk'

Sweep and Tiniest Queue

AABB

class ipctk.AABB

Bases: pybind11_object

Public Data Attributes:

min

Minimum corner of the AABB.

max

Maximum corner of the AABB.

vertex_ids

Vertex IDs attached to the AABB.

Public Methods:

__init__(*args, **kwargs)

Overloaded function.

from_point(*args, **kwargs)

Overloaded function.

intersects(self, other)

Check if another AABB intersects with this one.

conservative_inflation(min, max, ...)

Compute a conservative inflation of the AABB.

Inherited from pybind11_object

__annotations__ = {}
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: ipctk.AABB) -> None

  2. __init__(self: ipctk.AABB, min: numpy.ndarray[numpy.float64[m, 1]], max: numpy.ndarray[numpy.float64[m, 1]]) -> None

  3. __init__(self: ipctk.AABB, aabb1: ipctk.AABB, aabb2: ipctk.AABB) -> None

  4. __init__(self: ipctk.AABB, aabb1: ipctk.AABB, aabb2: ipctk.AABB, aabb3: ipctk.AABB) -> None

__module__ = 'ipctk'
static conservative_inflation(min: numpy.ndarray[numpy.float64[m, 1]], max: numpy.ndarray[numpy.float64[m, 1]], inflation_radius: float) tuple[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]]]

Compute a conservative inflation of the AABB.

static from_point(*args, **kwargs)

Overloaded function.

  1. from_point(p: numpy.ndarray[numpy.float64[m, 1]], inflation_radius: float = 0) -> ipctk.AABB

    Construct an AABB for a static point.

    Parameters:

    p: The point’s position. inflation_radius: Radius of a sphere around the point which the AABB encloses.

    Returns:

    The constructed AABB.

  2. from_point(p_t0: numpy.ndarray[numpy.float64[m, 1]], p_t1: numpy.ndarray[numpy.float64[m, 1]], inflation_radius: float = 0) -> ipctk.AABB

    Construct an AABB for a moving point (i.e. temporal edge).

    Parameters:

    p_t0: The point’s position at time t=0. p_t1: The point’s position at time t=1. inflation_radius: Radius of a capsule around the temporal edge which the AABB encloses.

    Returns:

    The constructed AABB.

intersects(self, other: ipctk.AABB) bool

Check if another AABB intersects with this one.

Parameters:
other: ipctk.AABB

The other AABB.

Returns:

If the two AABBs intersect.

property max : numpy.ndarray[numpy.float64[m, 1]]

Maximum corner of the AABB.

property min : numpy.ndarray[numpy.float64[m, 1]]

Minimum corner of the AABB.

property vertex_ids : Annotated[list[int], FixedSize(3)]

Vertex IDs attached to the AABB.


Last update: Nov 16, 2024