def test_circular_arc(): pointa = [-1, 0, 0] pointb = [0, 1, 0] center = [0, 0, 0] resolution = 100 mesh = pyvista.CircularArc(pointa, pointb, center, resolution) assert mesh.n_points assert mesh.n_cells mesh = pyvista.CircularArc([-1, 0, 0], [0, 0, 1], [0, 0, 0], normal=[0, 0, 1], polar=[1, 0, 1], negative=True, angle=180) assert mesh.n_points assert mesh.n_cells
def test_circular_arc(): pointa = [-1, 0, 0] pointb = [0, 1, 0] center = [0, 0, 0] resolution = 100 mesh = pyvista.CircularArc(pointa, pointb, center, resolution) assert mesh.n_points == resolution + 1 assert mesh.n_cells == 1 distance = np.arange(0.0, 1.0 + 0.01, 0.01) * np.pi / 2.0 assert np.allclose(mesh['Distance'], distance) # pointa and pointb are not equidistant from center with pytest.raises(ValueError): mesh = pyvista.CircularArc([-1, 0, 0], [-0.99, 0.001, 0], [0, 0, 0], 100)
def test_extrude(): arc = pyvista.CircularArc([-1, 0, 0], [1, 0, 0], [0, 0, 0]) poly = arc.extrude([0, 0, 1]) assert poly.n_points assert poly.n_cells n_points_old = arc.n_points arc.extrude([0, 0, 1], inplace=True) assert arc.n_points != n_points_old
# Torus # +++++ torus = pv.ParametricTorus() torus.plot(color="tan") ############################################################################### # Circular Arc # ++++++++++++ pointa = [-1, 0, 0] pointb = [0, 1, 0] center = [0, 0, 0] resolution = 100 arc = pv.CircularArc(pointa, pointb, center, resolution) pl = pv.Plotter() pl.add_mesh(arc, color='k', line_width=4) pl.show_bounds() pl.view_xy() pl.show() ############################################################################### # Extruded Half Arc # +++++++++++++++++ pointa = [-1, 0, 0] pointb = [1, 0, 0] center = [0, 0, 0]