Esempio n. 1
0
    def test_tile_with_guide_mesh(self):
        wire_network = self.get_brick5()
        params = Parameters(wire_network, 0.5)

        tiler = Tiler(wire_network)

        mesh = generate_box_mesh(np.zeros(3),
                                 np.ones(3),
                                 subdiv_order=1,
                                 using_simplex=False)

        tiler = Tiler(wire_network)
        tiler.tile_with_guide_mesh(mesh, params)
        tiled_wire_network = tiler.wire_network

        self.assertEqual(8 * wire_network.num_edges,
                         tiled_wire_network.num_edges)
        self.assertEqual(8 * wire_network.num_vertices - 12,
                         tiled_wire_network.num_vertices)
        self.assert_array_equal(mesh.bbox, tiled_wire_network.bbox)
        self.assertTrue(tiled_wire_network.has_attribute("thickness"))
        self.assertTrue(tiled_wire_network.has_attribute("vertex_offset"))
        self.assert_array_equal(
            np.ones(tiled_wire_network.num_vertices) * 0.5,
            tiled_wire_network.get_attribute("thickness").ravel())
Esempio n. 2
0
def tile_with_guide_mesh(config):
    options = extract_options(config);
    network = load_wire(str(config["wire_network"]));
    parameters = load_parameters(network, config);
    guide_mesh = pymesh.load_mesh(config["guide_mesh"]);

    tiler = Tiler();
    tiler.set_base_pattern(network);
    tiler.tile_with_guide_mesh(guide_mesh, parameters);
    network = tiler.wire_network;

    inflator = Inflator(network);
    inflator.inflate(network.get_attribute("thickness").ravel(),
            parameters.per_vertex_thickness);
    return inflator.mesh;
Esempio n. 3
0
def tile_with_guide_mesh(config):
    options = extract_options(config);
    network = load_wire(str(config["wire_network"]));
    parameters = load_parameters(network, config);
    guide_mesh = pymesh.load_mesh(config["guide_mesh"]);

    tiler = Tiler();
    tiler.set_base_pattern(network);
    tiler.tile_with_guide_mesh(guide_mesh, parameters);
    network = tiler.wire_network;

    if config.get("trim", False):
        network.trim();

    inflator = Inflator(network);
    inflator.inflate(network.get_attribute("thickness").ravel(),
            parameters.per_vertex_thickness);
    return inflator.mesh;
Esempio n. 4
0
def tile_with_guide_mesh(config):
    options = extract_options(config)
    network = load_wire(str(config["wire_network"]))
    parameters = load_parameters(network, config)
    guide_mesh = pymesh.load_mesh(config["guide_mesh"])

    tiler = Tiler()
    tiler.set_base_pattern(network)
    tiler.tile_with_guide_mesh(guide_mesh, parameters)
    network = tiler.wire_network

    if config.get("trim", False):
        network.trim()
    if "output_wire_network" in config:
        network.write_to_file(config["output_wire_network"])

    inflator = Inflator(network)
    inflator.subdivide_order = options["subdiv"]
    inflator.subdivide_method = options["subdiv_method"]
    inflator.inflate(
        network.get_attribute("thickness").ravel(),
        parameters.per_vertex_thickness)
    return inflator.mesh
Esempio n. 5
0
    def test_tile_with_guide_mesh(self):
        wire_network = self.get_brick5();
        params = Parameters(wire_network, 0.5);

        tiler = Tiler(wire_network);

        mesh = generate_box_mesh(np.zeros(3), np.ones(3), subdiv_order=1,
                using_simplex=False);

        tiler = Tiler(wire_network);
        tiler.tile_with_guide_mesh(mesh, params);
        tiled_wire_network = tiler.wire_network;

        self.assertEqual(8 * wire_network.num_edges,
                tiled_wire_network.num_edges);
        self.assertEqual(8 * wire_network.num_vertices - 12,
                tiled_wire_network.num_vertices);
        self.assert_array_equal(
                mesh.bbox, tiled_wire_network.bbox);
        self.assertTrue(tiled_wire_network.has_attribute("thickness"));
        self.assertTrue(tiled_wire_network.has_attribute("vertex_offset"));
        self.assert_array_equal(
                np.ones(tiled_wire_network.num_vertices) * 0.5,
                tiled_wire_network.get_attribute("thickness").ravel());