How to use the meshzoo.create_edges function in meshzoo

To help you get started, we’ve selected a few meshzoo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nschloe / colorio / colorio / _tools.py View on Github external
plot_rgb_triangle=plot_rgb_triangle,
        fill_horseshoe=mesh_resolution is None,
    )

    if mesh_resolution is not None:
        # dir_path = os.path.dirname(os.path.realpath(__file__))
        # with open(os.path.join(dir_path, 'data/gamut_triangulation.yaml')) as f:
        #     data = yaml.safe_load(f)
        # points = numpy.array(data['points'])
        # cells = numpy.array(data['cells'])

        bary, cells = meshzoo.triangle(mesh_resolution)
        corners = numpy.array([[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]]).T
        points = numpy.dot(corners, bary).T

        edges, _ = meshzoo.create_edges(cells)
        pts = xy_to_2d(points.T).T
        lines = pts[edges].T
        plt.plot(*lines, color="0.8", zorder=0)

    _plot_ellipses(centers, offsets, xy_to_2d, ellipse_scaling, facecolor=ellipse_color)