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 Data Attributes:
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¶
-
BOUNDING_VOLUME_HIERARCHY =
Broad Phase¶
- class ipctk.BroadPhase¶
Bases:
pybind11_object
Public Data Attributes:
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.
Find the candidate vertex-vertex collisions.
Find the candidate edge-vertex collisions.
Find the candidate edge-edge collisions.
Find the candidate face-vertex collisions.
Find the candidate edge-face intersections.
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.
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.
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.
- 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.
-
__annotations__ =
Brute Force¶
- class ipctk.BruteForce¶
Bases:
BroadPhase
Public Data Attributes:
Inherited from
BroadPhase
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.
Find the candidate vertex-vertex collisions.
Find the candidate edge-vertex collisions.
Find the candidate edge-edge collisions.
Find the candidate face-vertex collisions.
Find the candidate edge-face intersections.
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'
¶
-
__annotations__ =
Hash Grid¶
- class ipctk.HashGrid¶
Bases:
BroadPhase
Public Data Attributes:
Inherited from
BroadPhase
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.
Find the candidate vertex-vertex collisions.
Find the candidate edge-vertex collisions.
Find the candidate edge-edge collisions.
Find the candidate face-vertex collisions.
Find the candidate edge-face intersections.
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]]¶
-
__annotations__ =
Spatial Hash¶
- class ipctk.SpatialHash¶
Bases:
BroadPhase
Public Data Attributes:
The left bottom corner of the world bounding box.
The right top corner of the world bounding box.
The number of voxels in each dimension.
1.0 / voxel_size
The number of voxels in the first two dimensions.
Map from voxel index to the primitive indices it contains.
Map from point index to the voxel indices it occupies.
Map from edge index to the voxel indices it occupies.
Map from face index to the voxel indices it occupies.
Inherited from
BroadPhase
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.
Find the candidate vertex-vertex collisions.
Find the candidate edge-vertex collisions.
Find the candidate edge-edge collisions.
Find the candidate face-vertex collisions.
Find the candidate edge-face intersections.
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.
__init__(self: ipctk.SpatialHash) -> None
__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
__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.
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
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.
-
__annotations__ =
BVH¶
- class ipctk.BVH¶
Bases:
BroadPhase
Public Data Attributes:
Inherited from
BroadPhase
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.
Find the candidate vertex-vertex collisions.
Find the candidate edge-vertex collisions.
Find the candidate edge-edge collisions.
Find the candidate face-vertex collisions.
Find the candidate edge-face intersections.
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'
¶
-
__annotations__ =
Sweep and Prune¶
- class ipctk.SweepAndPrune¶
Bases:
BroadPhase
Public Data Attributes:
Inherited from
BroadPhase
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.
Find the candidate vertex-vertex collisions.
Find the candidate edge-vertex collisions.
Find the candidate edge-edge collisions.
Find the candidate face-vertex collisions.
Find the candidate edge-face intersections.
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'
¶
-
__annotations__ =
Sweep and Tiniest Queue¶
AABB¶
- class ipctk.AABB¶
Bases:
pybind11_object
Public Data Attributes:
Minimum corner of the AABB.
Maximum corner of the AABB.
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.
__init__(self: ipctk.AABB) -> None
__init__(self: ipctk.AABB, min: numpy.ndarray[numpy.float64[m, 1]], max: numpy.ndarray[numpy.float64[m, 1]]) -> None
__init__(self: ipctk.AABB, aabb1: ipctk.AABB, aabb2: ipctk.AABB) -> None
__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.
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.
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.
-
__annotations__ =