45 Eigen::Vector3d
const& c,
46 Eigen::Vector3d
const& e)
54 if (((v.rowwise().minCoeff() - e).array() > 0).any() ||
55 ((v.rowwise().maxCoeff() + e).array() < 0).any())
61 std::array<Eigen::Vector3d, 3> tri_edge{
62 {v.col(1) - v.col(0), v.col(2) - v.col(1), v.col(0) - v.col(2)}};
63 std::array<Eigen::Vector3d, 9>
const axx{
64 {Eigen::Vector3d({0, -tri_edge[0].z(), tri_edge[0].y()}),
65 Eigen::Vector3d({0, -tri_edge[1].z(), tri_edge[1].y()}),
66 Eigen::Vector3d({0, -tri_edge[2].z(), tri_edge[2].y()}),
67 Eigen::Vector3d({tri_edge[0].z(), 0, -tri_edge[0].x()}),
68 Eigen::Vector3d({tri_edge[1].z(), 0, -tri_edge[1].x()}),
69 Eigen::Vector3d({tri_edge[2].z(), 0, -tri_edge[2].x()}),
70 Eigen::Vector3d({-tri_edge[0].y(), tri_edge[0].x(), 0}),
71 Eigen::Vector3d({-tri_edge[1].y(), tri_edge[1].x(), 0}),
72 Eigen::Vector3d({-tri_edge[2].y(), tri_edge[2].x(), 0})}};
77 for (
auto const& a : axx)
79 Eigen::Vector3d p = v.transpose() * a;
80 double const r = e.dot(a.cwiseAbs());
81 if (std::max(-p.maxCoeff(), p.minCoeff()) > r)
88 Eigen::Vector3d
const plane_normal(tri_edge[0].cross(tri_edge[1]));
89 double const pd = plane_normal.dot(v.row(0));
94 int const fault_id, Eigen::Vector3d
const& half_cell_size)
99 auto const& fnodes = fault.
getNodes();
101 GeoLib::AABB const fault_aabb(fnodes.cbegin(), fnodes.cend());
105 min_pnt -= half_cell_size;
106 max_pnt += half_cell_size;
108 std::array<Eigen::Vector3d, 2>
const fault_extent{{min_pnt, max_pnt}};
109 GeoLib::AABB const fault_aabb_ext(fault_extent.cbegin(),
110 fault_extent.cend());
113 Eigen::Vector3d
const extent{half_cell_size};
114 for (std::size_t j = 0; j < n_elems; ++j)
124 auto const& c(centre_pnt.asEigenVector3d());
125 for (
auto const*
const fault_elem : felems)
127 if (fault_elem->getDimension() != 2)
133 *fault_elem->getNode(0), *fault_elem->getNode(1),
134 *fault_elem->getNode(2), c, extent))
136 (*mat_ids)[j] = fault_id;
143 *fault_elem->getNode(0), *fault_elem->getNode(2),
144 *fault_elem->getNode(3), c, extent))
146 (*mat_ids)[j] = fault_id;