Ejemplo n.º 1
0
void AABBTiler::evaluate_thickness_parameters(WireNetwork& wire_network,
        const AABBTiler::FuncList& funcs) {
    assert(m_params);
    const size_t dim = wire_network.get_dim();
    const size_t num_vertices = wire_network.get_num_vertices();
    const size_t num_edges = wire_network.get_num_edges();
    const size_t num_unit_vertices = m_unit_wire_network->get_num_vertices();
    const size_t num_unit_edges = m_unit_wire_network->get_num_edges();

    size_t num_thickness_entries, thickness_index_stride;
    if (m_params->get_thickness_type() == ParameterCommon::VERTEX) {
        thickness_index_stride = num_unit_vertices;
        num_thickness_entries = num_vertices;
        wire_network.add_attribute("thickness", true);
    } else {
        thickness_index_stride = num_unit_edges;
        num_thickness_entries = num_edges;
        wire_network.add_attribute("thickness", false);
    }
    MatrixFr thickness(num_thickness_entries, 1);

    ParameterCommon::Variables vars;
    size_t count=0;
    for (auto f : funcs) {
        VectorF local_thickness = m_params->evaluate_thickness(vars);
        thickness.block(count * thickness_index_stride, 0,
                thickness_index_stride, 1) = local_thickness;
        count++;
    }
    wire_network.set_attribute("thickness", thickness);
}
Ejemplo n.º 2
0
void AABBTiler::evaluate_offset_parameters(WireNetwork& wire_network,
        const AABBTiler::FuncList& funcs) {
    const size_t dim = wire_network.get_dim();
    const size_t num_vertices = wire_network.get_num_vertices();
    const size_t num_unit_vertices = m_unit_wire_network->get_num_vertices();

    wire_network.add_attribute("vertex_offset", true);
    MatrixFr attr_value(num_vertices, dim);

    ParameterCommon::Variables vars;
    const MatrixFr& ori_vertices = m_unit_wire_network->get_vertices();
    size_t count=0;
    for (auto f : funcs) {
        MatrixFr local_offseted_vertices = ori_vertices + m_params->evaluate_offset(vars);
        attr_value.block(count * num_unit_vertices, 0,
                num_unit_vertices, dim) = f(local_offseted_vertices);
        count++;
    }

    attr_value = attr_value - wire_network.get_vertices();
    wire_network.set_attribute("vertex_offset", attr_value);
}
void WireVertexCubicSymmetryAttribute::compute(const WireNetwork& network) {
    Operators ops = get_symmetry_operators(
            network.get_dim(), network.center());
    VectorI orbit_labels = get_vertex_labels(network.get_vertices(), ops);
    m_values = orbit_labels.cast<Float>();
}