mymesh.primitives.Line#

mymesh.primitives.Line(pt1, pt2, h=None, n=None)[source]#

Generate a mesh of a straight line between two points

Parameters:
  • pt1 (array_like) – Coordinates (x,y,z) of the first point of the line

  • pt2 (array_like) – Coordinates (x,y,z) of the second point of the line

  • h (float, optional) – Approximate element size. Only used if n is not provided. If neither h nor n are provided, element size is norm(pt2-pt1). By default, None.

  • n (int, optional) – Number of segments of the line. If h is also provided, n takes precedence. If neither h nor n are provided, number of segments is 1. By default, None.

Returns:

  • line (mymesh.mesh) – Mesh object containing the line mesh.

  • .. note:: – Due to the ability to unpack the mesh object to NodeCoords and NodeConn, the NodeCoords and NodeConn array can be returned directly (instead of the mesh object) by running: NodeCoords, NodeConn = primitives.Line(...)

Examples

line = primitives.Line([0, 0, 0], [0.5, 0.5, 0])
line.plot(bgcolor='w', show_edges=True)
../../_images/mymesh-primitives-Line-1.png