mesh.Mesh.centerline#

Mesh.centerline(source, targets, cleanup=True, peel=0, connect_ends=False, div=None, elsize=None, smooth=0)#

Compute centerlines from a closed triangular surface mesh.

Parameters#

sourcearray-like of length 3

Coordinates of the source point from which centerline extraction starts.

targetsarray-like

Coordinates of one or more target points defining the end points of the centerline branches. Can be specified as:

  • (3,) array for a single target point.

  • (n, 3) array for multiple target points.

cleanupbool, default True

Fuse coincident nodes and remove duplicate and degenerate elements from the extracted centerline.

peelint, default 0

Number of end-elements to remove from the extracted centerline. This can help remove irregular elements near the source and target boundaries.

connect_endsbool, default False

Connect free centerline endpoints to the supplied source and targets points.

divint, optional

Number of elements used when resampling each centerline branch as a spline. If specified, takes precedence over elsize.

elsizefloat, optional

Approximate element size used when resampling centerline branches as splines. Only used when div is None.

smoothint, default 0

Number of smoothing iterations applied to the final centerline. Border nodes remain fixed during smoothing.

Returns#

Mesh

Centerline represented as a line mesh.

Examples#

>>> surf = shapes.cylinder(height=10.0, height_div=10)
>>> cl = surf.centerline(
... source=[0.0, 0.0, 0.0],
... targets=[0.0, 0.0, 10.0],
... connect_ends=True
... )