Continuous Collision Detection

ipctk.is_step_collision_free(mesh: ipctk.CollisionMesh, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], broad_phase_method: ipctk.BroadPhaseMethod = <BroadPhaseMethod.HASH_GRID: 1>, min_distance: float = 0.0, tolerance: float = 1e-06, max_iterations: int = 10000000) bool

Determine if the step is collision free.

Note

Assumes the trajectory is linear.

Parameters:
mesh

The collision mesh.

vertices_t0

Surface vertex vertices at start as rows of a matrix.

vertices_t1

Surface vertex vertices at end as rows of a matrix.

broad_phase_method

The broad phase method to use.

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.

ipctk.compute_collision_free_stepsize(mesh: ipctk.CollisionMesh, vertices_t0: numpy.ndarray[numpy.float64[m, n]], vertices_t1: numpy.ndarray[numpy.float64[m, n]], 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 maximal step size that is collision free.

Note

Assumes the trajectory is linear.

Parameters:
mesh

The collision mesh.

vertices_t0

Vertex vertices at start as rows of a matrix. Assumes vertices_t0 is intersection free.

vertices_t1

Surface vertex vertices at end as rows of a matrix.

broad_phase_method

The broad phase method to use.

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.

Individual CCD Functions

ipctk.point_point_ccd(p0_t0: numpy.ndarray[numpy.float64[m, 1]], p1_t0: numpy.ndarray[numpy.float64[m, 1]], p0_t1: numpy.ndarray[numpy.float64[m, 1]], p1_t1: numpy.ndarray[numpy.float64[m, 1]], 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]

Computes the time of impact between two points using continuous collision detection.

Parameters:
p0_t0: numpy.ndarray[numpy.float64[m, 1]]

The initial position of the first point.

p1_t0: numpy.ndarray[numpy.float64[m, 1]]

The initial position of the second point.

p0_t1: numpy.ndarray[numpy.float64[m, 1]]

The final position of the first point.

p1_t1: numpy.ndarray[numpy.float64[m, 1]]

The final position of the second point.

min_distance: float = 0.0

The minimum distance between the points.

tmax: float = 1.0

The maximum time to check for collisions.

tolerance: float = 1e-06

The error tolerance for the time of impact.

max_iterations: int = 10000000

The maximum number of iterations to perform.

conservative_rescaling: float = 0.8

The conservative rescaling of the time of impact.

Returns:

True if a collision was detected, false otherwise. The time of impact between the two points.

Return type:

Tuple of

ipctk.point_edge_ccd(p_t0: numpy.ndarray[numpy.float64[m, 1]], e0_t0: numpy.ndarray[numpy.float64[m, 1]], e1_t0: numpy.ndarray[numpy.float64[m, 1]], p_t1: numpy.ndarray[numpy.float64[m, 1]], e0_t1: numpy.ndarray[numpy.float64[m, 1]], e1_t1: numpy.ndarray[numpy.float64[m, 1]], 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]

Computes the time of impact between a point and an edge using continuous collision detection.

Parameters:
p_t0: numpy.ndarray[numpy.float64[m, 1]]

The initial position of the point.

e0_t0: numpy.ndarray[numpy.float64[m, 1]]

The initial position of the first endpoint of the edge.

e1_t0: numpy.ndarray[numpy.float64[m, 1]]

The initial position of the second endpoint of the edge.

p_t1: numpy.ndarray[numpy.float64[m, 1]]

The final position of the point.

e0_t1: numpy.ndarray[numpy.float64[m, 1]]

The final position of the first endpoint of the edge.

e1_t1: numpy.ndarray[numpy.float64[m, 1]]

The final position of the second endpoint of the edge.

min_distance: float = 0.0

The minimum distance between the objects.

tmax: float = 1.0

The maximum time to check for collisions.

tolerance: float = 1e-06

The error tolerance for the time of impact.

max_iterations: int = 10000000

The maximum number of iterations to perform.

conservative_rescaling: float = 0.8

The conservative rescaling of the time of impact.

Returns:

True if a collision was detected, false otherwise. The time of impact between the point and the edge.

Return type:

Tuple of

ipctk.edge_edge_ccd(ea0_t0: numpy.ndarray[numpy.float64[3, 1]], ea1_t0: numpy.ndarray[numpy.float64[3, 1]], eb0_t0: numpy.ndarray[numpy.float64[3, 1]], eb1_t0: numpy.ndarray[numpy.float64[3, 1]], ea0_t1: numpy.ndarray[numpy.float64[3, 1]], ea1_t1: numpy.ndarray[numpy.float64[3, 1]], eb0_t1: numpy.ndarray[numpy.float64[3, 1]], eb1_t1: numpy.ndarray[numpy.float64[3, 1]], 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]

Computes the time of impact between two edges in 3D using continuous collision detection.

Parameters:
ea0_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the first endpoint of the first edge.

ea1_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the second endpoint of the first edge.

eb0_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the first endpoint of the second edge.

eb1_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the second endpoint of the second edge.

ea0_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the first endpoint of the first edge.

ea1_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the second endpoint of the first edge.

eb0_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the first endpoint of the second edge.

eb1_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the second endpoint of the second edge.

min_distance: float = 0.0

The minimum distance between the objects.

tmax: float = 1.0

The maximum time to check for collisions.

tolerance: float = 1e-06

The error tolerance for the time of impact.

max_iterations: int = 10000000

The maximum number of iterations to perform.

conservative_rescaling: float = 0.8

The conservative rescaling of the time of impact.

Returns:

True if a collision was detected, false otherwise. The time of impact between the two edges.

Return type:

Tuple of

ipctk.point_triangle_ccd(p_t0: numpy.ndarray[numpy.float64[3, 1]], t0_t0: numpy.ndarray[numpy.float64[3, 1]], t1_t0: numpy.ndarray[numpy.float64[3, 1]], t2_t0: numpy.ndarray[numpy.float64[3, 1]], p_t1: numpy.ndarray[numpy.float64[3, 1]], t0_t1: numpy.ndarray[numpy.float64[3, 1]], t1_t1: numpy.ndarray[numpy.float64[3, 1]], t2_t1: numpy.ndarray[numpy.float64[3, 1]], 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]

Computes the time of impact between a point and a triangle in 3D using continuous collision detection.

Parameters:
p_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the point.

t0_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the first vertex of the triangle.

t1_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the second vertex of the triangle.

t2_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the third vertex of the triangle.

p_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the point.

t0_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the first vertex of the triangle.

t1_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the second vertex of the triangle.

t2_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the third vertex of the triangle.

min_distance: float = 0.0

The minimum distance between the objects.

tmax: float = 1.0

The maximum time to check for collisions.

tolerance: float = 1e-06

The error tolerance for the time of impact.

max_iterations: int = 10000000

The maximum number of iterations to perform.

conservative_rescaling: float = 0.8

The conservative rescaling of the time of impact.

Returns:

True if a collision was detected, false otherwise. The time of impact between the point and the triangle.

Return type:

Tuple of

Generic Interface

ipctk.ccd_strategy(ccd: collections.abc.Callable[[int, float, bool, float], bool], max_iterations: int, min_distance: float, initial_distance: float, conservative_rescaling: float) tuple[bool, float]

Perform the CCD strategy outlined by Li et al. [2020].

Parameters:
ccd: collections.abc.Callable[[int, float, bool, float], bool]

The continuous collision detection function.

max_iterations: int

The maximum number of iterations to perform.

min_distance: float

The minimum distance between the objects.

initial_distance: float

The initial distance between the objects.

conservative_rescaling: float

The conservative rescaling of the time of impact.

Returns:

True if a collision was detected, false otherwise. Output time of impact.

Return type:

Tuple of

Tight Inclusion CCD

ipctk.tight_inclusion.edge_edge_ccd(ea0_t0: numpy.ndarray[numpy.float64[3, 1]], ea1_t0: numpy.ndarray[numpy.float64[3, 1]], eb0_t0: numpy.ndarray[numpy.float64[3, 1]], eb1_t0: numpy.ndarray[numpy.float64[3, 1]], ea0_t1: numpy.ndarray[numpy.float64[3, 1]], ea1_t1: numpy.ndarray[numpy.float64[3, 1]], eb0_t1: numpy.ndarray[numpy.float64[3, 1]], eb1_t1: numpy.ndarray[numpy.float64[3, 1]], min_distance: float = 0, tmax: float = 1, tolerance: float = 1e-06, max_iterations: int = 10000000, filter: numpy.ndarray[numpy.float64[3, 1]] = array([-1., -1., -1.]), no_zero_toi: bool = False, ccd_method: ipctk.tight_inclusion.CCDRootFindingMethod = <CCDRootFindingMethod.BREADTH_FIRST_SEARCH: 1>) tuple[bool, float, float]

Determine the earliest time of impact between two edges (optionally with a minimum separation).

Parameters:
ea0_t0

Starting position of the first vertex of the first edge.

ea1_t0

Start position of the second vertex of the first edge.

eb0_t0

Start position of the first vertex of the second edge.

eb1_t0

Start position of the second vertex of the second edge.

ea0_t1

End position of the first vertex of the first edge.

ea1_t1

End position of the second vertex of the first edge.

eb0_t1

End position of the first vertex of the second edge.

eb1_t1

End position of the second vertex of the second edge.

min_distance

Minimum separation distance (default: 0).

tmax

Upper bound of the time interval [0,tmax] to be checked (0<=tmax<=1).

tolerance

Solver tolerance (default: 1e-6).

max_iterations

Maximum number of solver iterations (default: 1e7). If negative, solver will run until convergence.

filter

Filters calculated using get_numerical_error (default: (-1,-1,-1)). Use (-1,-1,-1) if checking a single query.

no_zero_toi

Refine further if a zero TOI is produced (assuming not initially in contact).

ccd_method

Root finding method (default: BREADTH_FIRST_SEARCH).

Returns:

True if there is a collision, false otherwise, the earliest time of collision if collision happens (infinity if no collision occurs), and if max_iterations < 0, the solver precision otherwise the input tolerance.

Return type:

Tuple of

ipctk.tight_inclusion.point_triangle_ccd(v_t0: numpy.ndarray[numpy.float64[3, 1]], f0_t0: numpy.ndarray[numpy.float64[3, 1]], f1_t0: numpy.ndarray[numpy.float64[3, 1]], f2_t0: numpy.ndarray[numpy.float64[3, 1]], v_t1: numpy.ndarray[numpy.float64[3, 1]], f0_t1: numpy.ndarray[numpy.float64[3, 1]], f1_t1: numpy.ndarray[numpy.float64[3, 1]], f2_t1: numpy.ndarray[numpy.float64[3, 1]], min_distance: float = 0, tmax: float = 1, tolerance: float = 1e-06, max_iterations: int = 10000000, filter: numpy.ndarray[numpy.float64[3, 1]] = array([-1., -1., -1.]), no_zero_toi: bool = False, ccd_method: ipctk.tight_inclusion.CCDRootFindingMethod = <CCDRootFindingMethod.BREADTH_FIRST_SEARCH: 1>) tuple[bool, float, float]

Determine the earliest time of impact between a point and triangle (optionally with a minimum separation).

Parameters:
v_t0

Starting position of the vertex.

f0_t0

Starting position of the first vertex of the face.

f1_t0

Starting position of the second vertex of the face.

f2_t0

Starting position of the third vertex of the face.

v_t1

Ending position of the vertex.

f0_t1

Ending position of the first vertex of the face.

f1_t1

Ending position of the second vertex of the face.

f2_t1

Ending position of the third vertex of the face.

min_distance

Minimum separation distance (default: 0).

tmax

Upper bound of the time interval [0,tmax] to be checked (0<=tmax<=1).

tolerance

Solver tolerance (default: 1e-6).

max_iterations

Maximum number of solver iterations (default: 1e7). If negative, solver will run until convergence.

filter

Filters calculated using get_numerical_error (default: (-1,-1,-1)). Use (-1,-1,-1) if checking a single query.

no_zero_toi

Refine further if a zero TOI is produced (assuming not initially in contact).

ccd_method

Root finding method (default: BREADTH_FIRST_SEARCH).

Returns:

True if there is a collision, false otherwise, the earliest time of collision if collision happens (infinity if no collision occurs), and if max_iterations < 0, the solver precision otherwise the input tolerance.

Return type:

Tuple of

ipctk.tight_inclusion.compute_ccd_filters(min_corner: numpy.ndarray[numpy.float64[3, 1]], max_corner: numpy.ndarray[numpy.float64[3, 1]], is_vertex_face: bool, using_minimum_separation: bool) numpy.ndarray[numpy.float64[3, 1]]

Compute the numerical error filters for the input to the CCD solver.

Before you run the simulation, you need to conservatively estimate the axis-aligned bounding box in which the meshes will be located during the whole simulation process.

Parameters:
min_corner: numpy.ndarray[numpy.float64[3, 1]]

Minimum corner of the axis-aligned bounding box of the simulation scene.

max_corner: numpy.ndarray[numpy.float64[3, 1]]

Maximum corner of the axis-aligned bounding box of the simulation scene.

is_vertex_face: bool

True if checking vertex-face collision, false if checking edge-edge collision.

using_minimum_separation: bool

True if using minimum separation CCD, false otherwise.

Returns:

The numerical error filters for the input parameters.

Additive CCD

ipctk.additive_ccd.point_point_ccd(p0_t0: numpy.ndarray[numpy.float64[m, 1]], p1_t0: numpy.ndarray[numpy.float64[m, 1]], p0_t1: numpy.ndarray[numpy.float64[m, 1]], p1_t1: numpy.ndarray[numpy.float64[m, 1]], min_distance: float = 0.0, tmax: float = 1.0, conservative_rescaling: float = 0.9) tuple[bool, float]

Computes the time of impact between two points using continuous collision detection.

Parameters:
p0_t0: numpy.ndarray[numpy.float64[m, 1]]

The initial position of the first point.

p1_t0: numpy.ndarray[numpy.float64[m, 1]]

The initial position of the second point.

p0_t1: numpy.ndarray[numpy.float64[m, 1]]

The final position of the first point.

p1_t1: numpy.ndarray[numpy.float64[m, 1]]

The final position of the second point.

min_distance: float = 0.0

The minimum distance between two objects.

tmax: float = 1.0

The maximum time to check for collisions.

conservative_rescaling: float = 0.9

The conservative rescaling of the time of impact.

Returns:

True if a collision was detected, false otherwise. The time of impact between the two points.

Return type:

Tuple of

ipctk.additive_ccd.point_edge_ccd(p_t0: numpy.ndarray[numpy.float64[m, 1]], e0_t0: numpy.ndarray[numpy.float64[m, 1]], e1_t0: numpy.ndarray[numpy.float64[m, 1]], p_t1: numpy.ndarray[numpy.float64[m, 1]], e0_t1: numpy.ndarray[numpy.float64[m, 1]], e1_t1: numpy.ndarray[numpy.float64[m, 1]], min_distance: float = 0.0, tmax: float = 1.0, conservative_rescaling: float = 0.9) tuple[bool, float]

Computes the time of impact between a point and an edge using continuous collision detection.

Parameters:
p_t0: numpy.ndarray[numpy.float64[m, 1]]

The initial position of the point.

e0_t0: numpy.ndarray[numpy.float64[m, 1]]

The initial position of the first endpoint of the edge.

e1_t0: numpy.ndarray[numpy.float64[m, 1]]

The initial position of the second endpoint of the edge.

p_t1: numpy.ndarray[numpy.float64[m, 1]]

The final position of the point.

e0_t1: numpy.ndarray[numpy.float64[m, 1]]

The final position of the first endpoint of the edge.

e1_t1: numpy.ndarray[numpy.float64[m, 1]]

The final position of the second endpoint of the edge.

min_distance: float = 0.0

The minimum distance between two objects.

tmax: float = 1.0

The maximum time to check for collisions.

conservative_rescaling: float = 0.9

The conservative rescaling of the time of impact.

Returns:

True if a collision was detected, false otherwise. The time of impact between the point and the edge.

Return type:

Tuple of

ipctk.additive_ccd.edge_edge_ccd(ea0_t0: numpy.ndarray[numpy.float64[3, 1]], ea1_t0: numpy.ndarray[numpy.float64[3, 1]], eb0_t0: numpy.ndarray[numpy.float64[3, 1]], eb1_t0: numpy.ndarray[numpy.float64[3, 1]], ea0_t1: numpy.ndarray[numpy.float64[3, 1]], ea1_t1: numpy.ndarray[numpy.float64[3, 1]], eb0_t1: numpy.ndarray[numpy.float64[3, 1]], eb1_t1: numpy.ndarray[numpy.float64[3, 1]], min_distance: float = 0.0, tmax: float = 1.0, conservative_rescaling: float = 0.9) tuple[bool, float]

Computes the time of impact between two edges using continuous collision detection.

Parameters:
ea0_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the first endpoint of the first edge.

ea1_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the second endpoint of the first edge.

eb0_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the first endpoint of the second edge.

eb1_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the second endpoint of the second edge.

ea0_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the first endpoint of the first edge.

ea1_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the second endpoint of the first edge.

eb0_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the first endpoint of the second edge.

eb1_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the second endpoint of the second edge.

min_distance: float = 0.0

The minimum distance between two objects.

tmax: float = 1.0

The maximum time to check for collisions.

conservative_rescaling: float = 0.9

The conservative rescaling of the time of impact.

Returns:

True if a collision was detected, false otherwise. The time of impact between the two edges.

Return type:

Tuple of

ipctk.additive_ccd.point_triangle_ccd(p_t0: numpy.ndarray[numpy.float64[3, 1]], t0_t0: numpy.ndarray[numpy.float64[3, 1]], t1_t0: numpy.ndarray[numpy.float64[3, 1]], t2_t0: numpy.ndarray[numpy.float64[3, 1]], p_t1: numpy.ndarray[numpy.float64[3, 1]], t0_t1: numpy.ndarray[numpy.float64[3, 1]], t1_t1: numpy.ndarray[numpy.float64[3, 1]], t2_t1: numpy.ndarray[numpy.float64[3, 1]], min_distance: float = 0.0, tmax: float = 1.0, conservative_rescaling: float = 0.9) tuple[bool, float]

Computes the time of impact between a point and a triangle using continuous collision detection.

Parameters:
p_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the point.

t0_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the first vertex of the triangle.

t1_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the second vertex of the triangle.

t2_t0: numpy.ndarray[numpy.float64[3, 1]]

The initial position of the third vertex of the triangle.

p_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the point.

t0_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the first vertex of the triangle.

t1_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the second vertex of the triangle.

t2_t1: numpy.ndarray[numpy.float64[3, 1]]

The final position of the third vertex of the triangle.

min_distance: float = 0.0

The minimum distance between two objects.

tmax: float = 1.0

The maximum time to check for collisions.

conservative_rescaling: float = 0.9

The conservative rescaling of the time of impact.

Returns:

True if a collision was detected, false otherwise. The time of impact between the point and the triangle.

Return type:

Tuple of

Generic Interface

ipctk.additive_ccd.additive_ccd(x: numpy.ndarray[numpy.float64[m, 1]], dx: numpy.ndarray[numpy.float64[m, 1]], distance_squared: collections.abc.Callable[[numpy.ndarray[numpy.float64[m, 1]]], float], max_disp_mag: float, min_distance: float = 0.0, tmax: float = 1.0, conservative_rescaling: float = 0.9) tuple[bool, float]

Computes the time of impact between two objects using additive continuous collision detection.

Parameters:
distance_squared: collections.abc.Callable[[numpy.ndarray[numpy.float64[m, 1]]], float]

A function that computes the squared distance between the two objects at a given time.

min_distance: float = 0.0

The minimum distance between the objects.

tmax: float = 1.0

The maximum time to check for collisions.

conservative_rescaling: float = 0.9

The amount to rescale the objects by to ensure conservative advancement.

Returns:

True if a collision was detected, false otherwise. The time of impact between the two objects.

Return type:

Tuple of

Nonlinear CCD

class ipctk.NonlinearTrajectory

Bases: pybind11_object

Public Methods:

__init__(self)

__call__(self, t)

Compute the point's position at time t

max_distance_from_linear(self, t0, t1)

Compute the maximum distance from the nonlinear trajectory to a linearized trajectory

Inherited from pybind11_object

__annotations__ = {}
__call__(self, t: float) numpy.ndarray[numpy.float64[m, 1]]

Compute the point’s position at time t

__init__(self)
__module__ = 'ipctk'
max_distance_from_linear(self, t0: float, t1: float) float

Compute the maximum distance from the nonlinear trajectory to a linearized trajectory

Parameters:
t0: float

Start time of the trajectory

t1: float

End time of the trajectory

class ipctk.IntervalNonlinearTrajectory

Bases: NonlinearTrajectory

Public Methods:

__init__(self)

__call__(*args, **kwargs)

Overloaded function.

max_distance_from_linear(self, t0, t1)

Compute the maximum distance from the nonlinear trajectory to a linearized trajectory

Inherited from NonlinearTrajectory

__init__(self)

__call__(self, t)

Compute the point's position at time t

max_distance_from_linear(self, t0, t1)

Compute the maximum distance from the nonlinear trajectory to a linearized trajectory

Inherited from pybind11_object

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

Overloaded function.

  1. __call__(self: ipctk.IntervalNonlinearTrajectory, t: float) -> numpy.ndarray[numpy.float64[m, 1]]

Compute the point’s position at time t

  1. __call__(self: ipctk.IntervalNonlinearTrajectory, t: filib::Interval) -> numpy.ndarray[filib::Interval[m, 1]]

Compute the point’s position over a time interval t

__init__(self)
__module__ = 'ipctk'
max_distance_from_linear(self, t0: float, t1: float) float

Compute the maximum distance from the nonlinear trajectory to a linearized trajectory

Note

This uses interval arithmetic to compute the maximum distance. If you know a tighter bound on the maximum distance, it is recommended to override this function.

Parameters:
t0: float

Start time of the trajectory

t1: float

End time of the trajectory

ipctk.point_point_nonlinear_ccd(p0: ipctk.NonlinearTrajectory, p1: ipctk.NonlinearTrajectory, tmax: float = 1.0, min_distance: float = 0, tolerance: float = 1e-06, max_iterations: int = 10000000, conservative_rescaling: float = 0.8) tuple[bool, float]

Perform nonlinear CCD between two points moving along nonlinear trajectories.

Parameters:
p0: ipctk.NonlinearTrajectory

First point’s trajectory

p1: ipctk.NonlinearTrajectory

Second point’s trajectory

tmax: float = 1.0

Maximum time to check for collision

min_distance: float = 0

Minimum separation distance between the two points

tolerance: float = 1e-06

Tolerance for the linear CCD algorithm

max_iterations: int = 10000000

Maximum number of iterations for the linear CCD algorithm

conservative_rescaling: float = 0.8

Conservative rescaling of the time of impact

Returns:

True if the two points collide, false otherwise. Output time of impact

Return type:

Tuple of

ipctk.point_edge_nonlinear_ccd(p: ipctk.NonlinearTrajectory, e0: ipctk.NonlinearTrajectory, e1: ipctk.NonlinearTrajectory, tmax: float = 1.0, min_distance: float = 0, tolerance: float = 1e-06, max_iterations: int = 10000000, conservative_rescaling: float = 0.8) tuple[bool, float]

Perform nonlinear CCD between a point and a linear edge moving along nonlinear trajectories.

Parameters:
p: ipctk.NonlinearTrajectory

Point’s trajectory

e0: ipctk.NonlinearTrajectory

Edge’s first endpoint’s trajectory

e1: ipctk.NonlinearTrajectory

Edge’s second endpoint’s trajectory

tmax: float = 1.0

Maximum time to check for collision

min_distance: float = 0

Minimum separation distance between the point and the edge

tolerance: float = 1e-06

Tolerance for the linear CCD algorithm

max_iterations: int = 10000000

Maximum number of iterations for the linear CCD algorithm

conservative_rescaling: float = 0.8

Conservative rescaling of the time of impact

Returns:

True if the point and edge collide, false otherwise. Output time of impact

Return type:

Tuple of

ipctk.edge_edge_nonlinear_ccd(ea0: ipctk.NonlinearTrajectory, ea1: ipctk.NonlinearTrajectory, eb0: ipctk.NonlinearTrajectory, eb1: ipctk.NonlinearTrajectory, tmax: float = 1.0, min_distance: float = 0, tolerance: float = 1e-06, max_iterations: int = 10000000, conservative_rescaling: float = 0.8) tuple[bool, float]

Perform nonlinear CCD between two linear edges moving along nonlinear trajectories.

Parameters:
ea0: ipctk.NonlinearTrajectory

First edge’s first endpoint’s trajectory

ea1: ipctk.NonlinearTrajectory

First edge’s second endpoint’s trajectory

eb0: ipctk.NonlinearTrajectory

Second edge’s first endpoint’s trajectory

eb1: ipctk.NonlinearTrajectory

Second edge’s second endpoint’s trajectory

tmax: float = 1.0

Maximum time to check for collision

min_distance: float = 0

Minimum separation distance between the two edges

tolerance: float = 1e-06

Tolerance for the linear CCD algorithm

max_iterations: int = 10000000

Maximum number of iterations for the linear CCD algorithm

conservative_rescaling: float = 0.8

Conservative rescaling of the time of impact

Returns:

True if the two edges collide, false otherwise. Output time of impact

Return type:

Tuple of

ipctk.point_triangle_nonlinear_ccd(p: ipctk.NonlinearTrajectory, t0: ipctk.NonlinearTrajectory, t1: ipctk.NonlinearTrajectory, t2: ipctk.NonlinearTrajectory, tmax: float = 1.0, min_distance: float = 0, tolerance: float = 1e-06, max_iterations: int = 10000000, conservative_rescaling: float = 0.8) tuple[bool, float]

Perform nonlinear CCD between a point and a linear triangle moving along nonlinear trajectories.

Parameters:
p: ipctk.NonlinearTrajectory

Point’s trajectory

t0: ipctk.NonlinearTrajectory

Triangle’s first vertex’s trajectory

t1: ipctk.NonlinearTrajectory

Triangle’s second vertex’s trajectory

t2: ipctk.NonlinearTrajectory

Triangle’s third vertex’s trajectory

tmax: float = 1.0

Maximum time to check for collision

min_distance: float = 0

Minimum separation distance between the two edges

tolerance: float = 1e-06

Tolerance for the linear CCD algorithm

max_iterations: int = 10000000

Maximum number of iterations for the linear CCD algorithm

conservative_rescaling: float = 0.8

Conservative rescaling of the time of impact

Returns:

True if the point and triangle collide, false otherwise. Output time of impact

Return type:

Tuple of

Generic Interface

ipctk.conservative_piecewise_linear_ccd(distance: collections.abc.Callable[[float], float], max_distance_from_linear: collections.abc.Callable[[float, float], float], linear_ccd: collections.abc.Callable[[float, float, float, bool, float], bool], tmax: float = 1.0, min_distance: float = 0, conservative_rescaling: float = 0.8) tuple[bool, float]

Perform conservative piecewise linear CCD of a nonlinear trajectories.

Parameters:
distance: collections.abc.Callable[[float], float]

Return the distance for a given time in [0, 1].

max_distance_from_linear: collections.abc.Callable[[float, float], float]

Return the maximum distance from the linearized trajectory for a given time interval.

linear_ccd: collections.abc.Callable[[float, float, float, bool, float], bool]

Perform linear CCD on a given time interval.

tmax: float = 1.0

Maximum time to check for collision.

min_distance: float = 0

Minimum separation distance between the objects.

conservative_rescaling: float = 0.8

Conservative rescaling of the time of impact.

Returns:

Output time of impact.

Return type:

Tuple of


Last update: Mar 28, 2024