Barrier¶
- ipctk.barrier(d: float, dhat: float) float ¶
Function that grows to infinity as d approaches 0 from the right.
\[b(d) = -(d-\hat{d})^2\ln\left(\frac{d}{\hat{d}}\right)\]
- ipctk.barrier_first_derivative(d: float, dhat: float) float ¶
Derivative of the barrier function.
\[b'(d) = (\hat{d}-d) \left( 2\ln\left( \frac{d}{\hat{d}} \right) - \frac{\hat{d}}{d} + 1\right)\]
- ipctk.barrier_second_derivative(d: float, dhat: float) float ¶
Second derivative of the barrier function.
\[b''(d) = \left( \frac{\hat{d}}{d} + 2 \right) \frac{\hat{d}}{d} - 2\ln\left( \frac{d}{\hat{d}} \right) - 3\]
Barrier Force Magnitude¶
-
ipctk.barrier_force_magnitude(distance_squared: float, barrier: ipctk.Barrier, dhat: float, barrier_stiffness: float, dmin: float =
0
) float ¶ Compute the magnitude of the force due to a barrier.
-
ipctk.barrier_force_magnitude_gradient(distance_squared: float, distance_squared_gradient: numpy.ndarray[numpy.float64[m, 1]], barrier: ipctk.Barrier, dhat: float, barrier_stiffness: float, dmin: float =
0
) numpy.ndarray[numpy.float64[m, 1]] ¶ Compute the gradient of the magnitude of the force due to a barrier.
- Parameters:¶
- distance_squared: float¶
The squared distance between elements.
- distance_squared_gradient: numpy.ndarray[numpy.float64[m, 1]]¶
The gradient of the squared distance.
- barrier: ipctk.Barrier¶
The barrier function.
- dhat: float¶
The activation distance of the barrier.
- barrier_stiffness: float¶
The stiffness of the barrier.
- dmin: float =
0
¶ The minimum distance offset to the barrier.
- Returns:¶
The gradient of the force.
Adaptive Barrier Stiffness¶
-
ipctk.initial_barrier_stiffness(bbox_diagonal: float, barrier: ipctk.Barrier, dhat: float, average_mass: float, grad_energy: numpy.ndarray[numpy.float64[m, 1]], grad_barrier: numpy.ndarray[numpy.float64[m, 1]], min_barrier_stiffness_scale: float =
100000000000.0
, dmin: float =0
) tuple[float, float] ¶ Compute an inital barrier stiffness using the barrier potential gradient.
- Parameters:¶
- bbox_diagonal: float¶
Length of the diagonal of the bounding box of the scene.
- barrier: ipctk.Barrier¶
Barrier function.
- dhat: float¶
Activation distance of the barrier.
- average_mass: float¶
Average mass of all bodies.
- grad_energy: numpy.ndarray[numpy.float64[m, 1]]¶
Gradient of the elasticity energy function.
- grad_barrier: numpy.ndarray[numpy.float64[m, 1]]¶
Gradient of the barrier potential.
- min_barrier_stiffness_scale: float =
100000000000.0
¶ Scale used to premultiply the minimum barrier stiffness.
- dmin: float =
0
¶ Minimum distance between elements.
- Returns:¶
The initial barrier stiffness. Maximum stiffness of the barrier.
- Return type:¶
Tuple of
-
ipctk.update_barrier_stiffness(prev_min_distance: float, min_distance: float, max_barrier_stiffness: float, barrier_stiffness: float, bbox_diagonal: float, dhat_epsilon_scale: float =
1e-09
, dmin: float =0
) float ¶ Update the barrier stiffness if the distance is decreasing and less than dhat_epsilon_scale * diag.
- Parameters:¶
- prev_min_distance: float¶
Previous minimum distance between elements.
- min_distance: float¶
Current minimum distance between elements.
- max_barrier_stiffness: float¶
Maximum stiffness of the barrier.
- barrier_stiffness: float¶
Current barrier stiffness.
- bbox_diagonal: float¶
Length of the diagonal of the bounding box of the scene.
- dhat_epsilon_scale: float =
1e-09
¶ Update if distance is less than this fraction of the diagonal.
- dmin: float =
0
¶ Minimum distance between elements.
- Returns:¶
The updated barrier stiffness.
Barrier Class¶
- class ipctk.Barrier¶
Bases:
pybind11_object
- __init__(self)¶
-
__module__ =
'ipctk'
¶
- first_derivative(self, d: float, dhat: float) float ¶
Evaluate the first derivative of the barrier function wrt d.
Clamped Log Barrier¶
- class ipctk.ClampedLogBarrier¶
Bases:
Barrier
Smoothly clamped log barrier functions from [Li et al. 2020].
-
__annotations__ =
{}
¶
- __init__(self)¶
-
__module__ =
'ipctk'
¶
-
__annotations__ =