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 : collision_mesh_(collision_mesh),
31 use_adaptive_barrier_stiffness_(use_adaptive_barrier_stiffness),
33 is_time_dependent_(is_time_dependent),
34 enable_shape_derivatives_(enable_shape_derivatives),
35 broad_phase_method_(broad_phase_method),
36 broad_phase_(
ipc::build_broad_phase(broad_phase_method)),
37 tight_inclusion_ccd_(ccd_tolerance, ccd_max_iterations)
40 assert(ccd_tolerance > 0);
81 max_step =
candidates_.compute_collision_free_stepsize(
84 max_step = ipc::compute_collision_free_stepsize(
94 Eigen::MatrixXd V_toi = (
V1 -
V0) * max_step +
V0;
98 logger().error(
"Taking max_step results in intersections (max_step={:g})", max_step);
101 const double Linf = (V_toi -
V0).lpNorm<Eigen::Infinity>();
102 if (max_step <= 0 || Linf == 0)
103 log_and_throw_error(
"Unable to find an intersection free step size (max_step={:g} L∞={:g})", max_step, Linf);
105 V_toi = (
V1 -
V0) * max_step +
V0;
136 if ((displaced1 - displaced0).lpNorm<Eigen::Infinity>() == 0.0)
148 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)
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)