Skip to content

Commit

Permalink
Set enable parallel projection defalut in Plotter
Browse files Browse the repository at this point in the history
  • Loading branch information
tkoyama010 committed Mar 2, 2024
1 parent 43f9d2b commit f4eb665
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ To visualize the model we can use PyVista.

```python
plotter = sg.Plotter()
plotter.enable_parallel_projection()
_ = plotter.add_mesh(
mesh,
show_edges=True,
Expand All @@ -96,7 +95,6 @@ mesh = sg.delaunay_3d(edge_source, target_sizes=0.2)

```python
plotter = sg.Plotter()
plotter.enable_parallel_projection()
_ = plotter.add_mesh(
mesh,
show_edges=True,
Expand Down
14 changes: 4 additions & 10 deletions src/skgmsh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def frontal_delaunay_2d(
>>> mesh = sg.frontal_delaunay_2d(edge_source, target_sizes=2.0)
>>> plotter = sg.Plotter(off_screen=True)
>>> plotter.enable_parallel_projection()
>>> _ = plotter.add_mesh(mesh, show_edges=True, line_width=1, color="aliceblue", lighting=False, edge_color="gray")
>>> _ = plotter.add_mesh(edge_source, show_edges=True, line_width=4, color="gray")
>>> plotter.show(cpos="xy", screenshot="docs/_static/frontal_delaunay_2d_01.png")
Expand Down Expand Up @@ -146,7 +145,6 @@ def delaunay_3d(
>>> mesh = sg.delaunay_3d(edge_source, target_sizes=0.2)
>>> plotter = sg.Plotter(off_screen=True)
>>> plotter.enable_parallel_projection()
>>> _ = plotter.add_mesh(mesh, show_edges=True, line_width=1, color="aliceblue", lighting=False, edge_color="gray")
>>> _ = plotter.add_mesh(edge_source.extract_all_edges(), line_width=4, color="gray")
>>> _ = plotter.add_axes(
Expand All @@ -172,7 +170,6 @@ def delaunay_3d(
... edge_color="gray",
... )
>>> _ = plotter.add_mesh(edge_source.extract_all_edges(), line_width=4, color="gray")
>>> plotter.enable_parallel_projection()
>>> _ = plotter.add_axes(
... box=True,
... box_args={
Expand Down Expand Up @@ -311,9 +308,9 @@ def __init__(
)


class PlotterBase:
class Plotter(pv.Plotter): # type: ignore[misc]
"""
Base class with common behaviour for a gmsh aware plotter.
Plotting object to display vtk meshes or numpy arrays.
See :class:`pyvista.Plotter`.
Expand All @@ -331,7 +328,7 @@ class PlotterBase:
"""

def __init__(self: PlotterBase, *args, **kwargs) -> None: # type: ignore[no-untyped-def] # noqa: ANN002, ANN003
def __init__(self: Plotter, *args, **kwargs) -> None: # type: ignore[no-untyped-def] # noqa: ANN002, ANN003
"""
Create gmsh aware plotter.
Expand All @@ -349,10 +346,7 @@ def __init__(self: PlotterBase, *args, **kwargs) -> None: # type: ignore[no-unt
"""
super().__init__(*args, **kwargs)


class Plotter(PlotterBase, pv.Plotter): # type: ignore[misc]
"""Plotting object to display vtk meshes or numpy arrays."""
super().enable_parallel_projection()


class PolyData(pv.PolyData): # type: ignore[misc]
Expand Down

0 comments on commit f4eb665

Please sign in to comment.