pyvista_wasm.Line

Contents

pyvista_wasm.Line#

pyvista_wasm.Line(pointa: tuple[float, float, float] = (0.0, 0.0, 0.0), pointb: tuple[float, float, float] = (1.0, 0.0, 0.0), resolution: int = 1) PolyData#

Create a line segment between two points.

This mirrors the pyvista.Line() API, producing a polyline of resolution + 1 evenly spaced points from pointa to pointb.

Parameters:
  • pointa (tuple, optional) – Start point of the line (x, y, z). Default is (0, 0, 0).

  • pointb (tuple, optional) – End point of the line (x, y, z). Default is (1, 0, 0).

  • resolution (int, optional) – Number of line segments (i.e. resolution + 1 points). Default is 1.

Returns:

A line mesh.

Return type:

PolyData

Raises:

ValueError – If resolution is less than 1.

Examples

>>> import pyvista_wasm as pv
>>> line = pv.Line(pointa=(0, 0, 0), pointb=(1, 0, 0), resolution=1)
>>> line.n_points
2
>>> line.plot(color="black")