trimesh.path.curve

Functions

binomial(n)

Return all binomial coefficients for a given order.

discretize_bezier(points[, count, scale])

param points

Control points of the bezier curve

discretize_bspline(control, knots[, count, …])

Given a B-Splines control points and knot vector, return a sampled version of the curve.

trimesh.path.curve.binomial(n)

Return all binomial coefficients for a given order.

For n > 5, scipy.special.binom is used, below we hardcode to avoid the scipy.special dependency.

Parameters

n (int) – Order of binomial

Returns

binom – Binomial coefficients of a given order

Return type

(n + 1,) int

trimesh.path.curve.discretize_bezier(points, count=None, scale=1.0)
Parameters
  • points ((order, dimension) float) – Control points of the bezier curve For a 2D cubic bezier, order=3, dimension=2

  • count (int, or None) – Number of segments

  • scale (float) – Scale of curve

Returns

discrete – Points forming a a polyline representation

Return type

(n, dimension) float

trimesh.path.curve.discretize_bspline(control, knots, count=None, scale=1.0)

Given a B-Splines control points and knot vector, return a sampled version of the curve.

Parameters
  • control ((o, d) float) – Control points of the b- spline

  • knots ((j,) float) – B-spline knots

  • count (int) – Number of line segments to discretize the spline If not specified will be calculated as something reasonable

Returns

discrete – Points on a polyline version of the B-spline

Return type

(count, dimension) float