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)\]
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.