Ejemplo n.º 1
0
    def test_circle(self):
        from trimesh.path import creation
        circle = creation.circle(radius=1.0, center=(1.0, 1.0))

        # it's a discrete circle
        assert g.np.isclose(circle.area, g.np.pi, rtol=0.01)
        # should be centered at 0
        assert g.np.allclose(circle.polygons_full[0].centroid, [1.0, 1.0],
                             atol=1e-3)
        assert len(circle.entities) == 1
        assert len(circle.polygons_closed) == 1
        assert len(circle.polygons_full) == 1

        # should be a valid Path2D
        g.check_path2D(circle)
Ejemplo n.º 2
0
    def test_circle(self):
        from trimesh.path import creation
        circle = creation.circle(radius=1.0)

        # it's a discrete circle
        assert g.np.isclose(circle.area, g.np.pi, rtol=0.01)
        # should be centered at 0
        assert g.np.allclose(
            circle.polygons_full[0].centroid, [
                0.0, 0.0], atol=1e-3)

        assert len(circle.entities) == 1
        assert len(circle.polygons_closed) == 1
        assert len(circle.polygons_full) == 1

        # should be a valid Path2D
        g.check_path2D(circle)