Esempio n. 1
0
void IsotropicDofExtractor::check_bbox_is_isotropic() const {
    VectorF half_size = 0.5 * (m_bbox_max - m_bbox_min);
    VectorF gap = (half_size.array() - m_bbox_half_size).cwiseAbs();
    if (gap.minCoeff() > 1e-12) {
        throw RuntimeError("BBox is not isotropic.");
    }
}
Esempio n. 2
0
void TilerEngine::normalize_unit_wire(const VectorF& cell_size) {
    if (cell_size.minCoeff() <= 1e-30) {
        const size_t dim = cell_size.size();
        if (dim == 3)
            throw RuntimeError("It seems the 3D wires are flat.");
        else if (dim == 2)
            throw RuntimeError("It seems the 2D wires are degenerated/linear.");
        else
            throw NotImplementedError("Unsupported dimension!");
    }

    VectorF factors = cell_size.cwiseQuotient(
            m_unit_wire_network->get_bbox_max() - m_unit_wire_network->get_bbox_min());
    m_unit_wire_network->center_at_origin();
    m_unit_wire_network->scale(factors);
}