Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# py2d.Bezier.flatten_cubic_bezier

All Samples(6)  |  Call(4)  |  Derive(0)  |  Import(2)

```        def flatten_cubic_bezier(p1,p2,c1,c2, max_divisions=None, max_flatness=0.1):
out = []

if not __is_flat(max_divisions, max_flatness, __bezier_flatness(p1,p2,c1,c2)):
a,m,p,n,c = subdivide_cubic_bezier(p1,p2,c1,c2,0.5)

md_rec = max_divisions - 1 if max_divisions else None

out.extend(flatten_cubic_bezier(p1,p,a,m, md_rec, max_flatness))
out.append(p)
out.extend(flatten_cubic_bezier(p,p2,n,c, md_rec, max_flatness))

return out
```

```from collections import deque
from py2d.Math import Polygon, Vector, Transform

def convert_svg(f, transform=Transform.unit(), bezier_max_divisions=None, bezier_max_flatness=0.1):
```
```						b += relative_pos

bez = flatten_cubic_bezier(relative_pos, b, c1, c2, bezier_max_divisions, bezier_max_flatness)

last_control = c2
```
```						b += relative_pos

bez = flatten_cubic_bezier(relative_pos, b, c1, c2, bezier_max_divisions, bezier_max_flatness)

last_control = c2
```

```from collections import deque
from py2d.Math import Polygon, Vector, Transform

def convert_svg(f, transform=Transform.unit(), bezier_max_divisions=None, bezier_max_flatness=0.1):
```
```						b += relative_pos

bez = flatten_cubic_bezier(relative_pos, b, c1, c2, bezier_max_divisions, bezier_max_flatness)

last_control = c2
```
```						b += relative_pos

bez = flatten_cubic_bezier(relative_pos, b, c1, c2, bezier_max_divisions, bezier_max_flatness)

last_control = c2
```