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;
def test_tiled(self): wire_network = self.get_brick5() params = Parameters(wire_network, 0.1) tiler = Tiler() tiler.set_base_pattern(wire_network) tiler.tile_with_guide_bbox(np.zeros(3), np.ones(3), np.ones(3) * 2, params) tiled_wire_network = tiler.wire_network inflator = Inflator(tiled_wire_network) inflator.inflate(tiled_wire_network.get_attribute("thickness").ravel()) mesh = inflator.mesh self.assertLess(0, mesh.num_vertices) self.assertLess(0, mesh.num_faces) self.assertTrue(mesh.is_closed())
def tile_with_guide_box(config): options = extract_options(config); network = load_wire(str(config["wire_network"])); parameters = load_parameters(network, config); tiler = Tiler(); tiler.set_base_pattern(network); tiler.tile_with_guide_bbox( config["bbox_min"][:network.dim], config["bbox_max"][:network.dim], config["repeats"][:network.dim], parameters); network = tiler.wire_network; inflator = Inflator(network); inflator.inflate(network.get_attribute("thickness").ravel(), parameters.per_vertex_thickness); return inflator.mesh;
def test_tiled(self): wire_network = self.get_brick5(); params = Parameters(wire_network, 0.1); tiler = Tiler(); tiler.set_base_pattern(wire_network); tiler.tile_with_guide_bbox( np.zeros(3), np.ones(3), np.ones(3)*2, params); tiled_wire_network = tiler.wire_network; inflator = Inflator(tiled_wire_network); inflator.inflate( tiled_wire_network.get_attribute("thickness").ravel()); mesh = inflator.mesh; self.assertLess(0, mesh.num_vertices); self.assertLess(0, mesh.num_faces); self.assertTrue(mesh.is_closed());
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;
def tile_with_guide_box(config): options = extract_options(config); network = load_wire(str(config["wire_network"])); parameters = load_parameters(network, config); tiler = Tiler(); tiler.set_base_pattern(network); tiler.tile_with_guide_bbox( config["bbox_min"][:network.dim], config["bbox_max"][:network.dim], config["repeats"][:network.dim], 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;
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