def _subdivide(ci): """ Recursive subdivision. """ # Check flatness. cpi = ci.cp if not is_curve_flat(ci.n, cpi, tol): # Split curve. if ci.p == 1: mid = int(ceil((ci.uk.size - 1) / 2)) ui = ci.uk[mid] else: ui = 0.5 * (ci.a + ci.b) c1, c2 = ci.split(ui, domain='global') # Subdivide. map(_subdivide, [c1, c2]) else: params.append(ci.a) verts.append(curve.eval(ci.a, rtype='ndarray', domain='global')) nvert[0] += 2
def _is_curve_flat(ni, cpi): """ Check curve flatness. """ return is_curve_flat(ni, cpi, ftol)
def _is_flat(ni, cpi): """ Check the flatness of the curve. """ return is_curve_flat(ni, cpi, ftol)