This utilities located in module ezdxf.algebra:

from ezdxf.algebra import Vector


ezdxf.algebra.is_close(a, b)

Returns True if value is close to value b, uses math.isclose(a, b, abs_tol=1e-9) for Python 3, and emulates this function for Python 2.7.

ezdxf.algebra.is_close_points(p1, p2)

Returns True if all axis of p1 and p2 are close.

ezdxf.algebra.bspline_control_frame(fit_points, degree=3, method='distance', power=.5)

Generates the control points for the B-spline control frame by Curve Global Interpolation. Given are the fit points and the degree of the B-spline. The function provides 3 methods for generating the parameter vector t:

  1. method = uniform, creates a uniform t vector, form 0 to 1 evenly spaced; see uniform method
  2. method = distance, creates a t vector with values proportional to the fit point distances, see chord length method
  3. method = centripetal, creates a t vector with values proportional to the fit point distances^power; see centripetal method
  • fit_points – fit points of B-spline, as list of (x, y[, z]) tuples
  • degree – degree of B-spline
  • method – calculation method for parameter vector t
  • power – power for centripetal method

a BSpline object, with BSpline.control_points containing the calculated control points, also BSpline.knot_values() returns the used knot values.