Adaptive Tessellation. There are many algorithms. But here is one:
def line_angle((x0,y0),(x1,y1)):
return atan2(y1-y0,x1-x0)
def adaptive_bezier(p0,p1,p2,lev=32):
p01 = midpoint(p0,p1)
p12 = midpoint(p1,p2)
m = midpoint(p01, p12)
da = abs(line_angle(p0,p1) - line_angle(p1,p2))
if da <= max_tolerance or lev <= 0:
yield m
else:
for p in adaptive_bezier(p0,p01,m,lev-1): yield p
for p in adaptive_bezier(m,p12,p2,lev-1): yield p
Complications arise for the tessellation of triangles in this way. You need to control the adaptive tessellator algorithm in accordance with the angles of the extreme beziers. There are three unique ways how your triangle can split when tesselating.
2 edges one edge 3 edges
-------- --------- --------
\ ...// \ | / \ / \ /
\/___/ \ | / \____/
\ / \ | / \ /
\/ \|/ \/
Define tessellation results for these patterns and you are provided. Only single-edge tessellation is described in the Wikipedia article.
Two other tessellation results can be obtained by studying the case of one edge partition.
"2 " , , .
"3 " - , . , "2 " -case . , :
-------- /\
\ / / \
\____/ -____-
\ / \ /
\/ \/