13#include <ipc/barrier/adaptive_stiffness.hpp>
14#include <ipc/utils/world_bbox_diagonal_length.hpp>
16#include <igl/writePLY.h>
22 const double avg_mass,
23 const bool use_adaptive_barrier_stiffness,
24 const bool is_time_dependent,
25 const bool enable_shape_derivatives,
26 const ipc::BroadPhaseMethod broad_phase_method,
27 const double ccd_tolerance,
28 const int ccd_max_iterations,
29 const double dhat_epsilon_scale)
30 : collision_mesh_(collision_mesh),
32 use_adaptive_barrier_stiffness_(use_adaptive_barrier_stiffness),
33 barrier_stiffness_(1.0),
34 dhat_epsilon_scale_(dhat_epsilon_scale),
36 is_time_dependent_(is_time_dependent),
37 enable_shape_derivatives_(enable_shape_derivatives),
38 broad_phase_method_(broad_phase_method),
39 broad_phase_(
ipc::create_broad_phase(broad_phase_method)),
40 tight_inclusion_ccd_(ccd_tolerance, ccd_max_iterations)
43 assert(ccd_tolerance > 0);
84 max_step =
candidates_.compute_collision_free_stepsize(
87 max_step = ipc::compute_collision_free_stepsize(
97 Eigen::MatrixXd V_toi = (V1 - V0) * max_step + V0;
101 logger().error(
"Taking max_step results in intersections (max_step={:g})", max_step);
104 const double Linf = (V_toi - V0).lpNorm<Eigen::Infinity>();
105 if (max_step <= 0 || Linf == 0)
106 log_and_throw_error(
"Unable to find an intersection free step size (max_step={:g} L∞={:g})", max_step, Linf);
108 V_toi = (V1 - V0) * max_step + V0;
139 if ((displaced1 - displaced0).lpNorm<Eigen::Infinity>() == 0.0)
151 is_valid = ipc::is_step_collision_free(
std::tuple< bool, int, Tree > is_valid(const int dim, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const Eigen::VectorXd &u, const double threshold, const unsigned max_iter)
Eigen::MatrixXd unflatten(const Eigen::VectorXd &x, int dim)
Unflatten rowwises, so every dim elements in x become a row.
spdlog::logger & logger()
Retrieves the current logger.
void log_and_throw_error(const std::string &msg)