points, normals = load_svg(svg_path, point_count) initial_resolution = 32 iterations = [500, 250, 100, 20, 20] if show_point_cloud: plot_points_norms(points, normals) reconstruct_2d(points, normals, initial_resolution, iterations, save_gif) @cli.command() @click.argument("point_cloud_path", type=click.Path(exists=True), required=True) @click.option('--output', 'output_name', type=click.Path(), default='volume.npz') @click.option('--save-gif', default=None, type=click.Path()) def surface_reconstruction_3d(point_cloud_path, output_name, save_gif): """ Perform Poisson Surface Reconstruction of the provided 3D oriented point cloud """ from common.io import load_point_cloud from geometry.poisson_reconstruction import reconstruct_3d points, normals = load_point_cloud(point_cloud_path) iterations = [500, 250, 100, 20, 20] reconstruct_3d(points, normals, output_name, 32, iterations, save_gif) if __name__ == '__main__': icecream.install() icecream.ic.configureOutput(includeContext=True) cli()
from pathlib import Path from icecream import install install() class AdventOfCode: part_one_test_solution = None part_two_test_solution = None @property def test_input(self): return self.load_file('input.test.txt') @property def input(self): return self.load_file('input.txt') def load_file(self, file_path): with Path(file_path).open() as f: lines = list(map(lambda l: l.strip(), f.readlines())) input_ = self.preprocess_input(lines) if type(input_) is not tuple: return input_, return input_ def preprocess_input(self, lines): if all(line.isnumeric() for line in lines): lines = list(map(int, lines)) if len(lines) == 0: return lines[0]
def testInstall(self): icecream.install() with disableColoring(), captureStandardStreams() as (out, err): runMe() assert parseOutputIntoPairs(out, err, 1)[0][0] == ('x', '3') icecream.uninstall() # Clean up builtins.