triangulated_bezier_circuit

Turning bezier outlines into filled triangle meshes.

Most 2-D shapes are rendered as bezier circuits, evaluated analytically. A TriangulatedBezierCircuit is the alternative: the outline is triangulated into a real mesh, which is what a shape needs when its interior has to carry per-fragment shading or a texture.

Its fills are unlit by default – they are circuits that happen to be triangulated, not 3-D surfaces – matching every other circuit’s flat look; set_material / set_shader can light them explicitly.

The module implements the tiling and triangulation – polygon triangulation, region tiling, and curve subdivision fine enough that the mesh boundary follows the bezier outline. The result is cached on disk under SETTINGS.paths.cache_directory, keyed by content, because triangulating a dense glyph batch is expensive and perfectly reproducible.

Classes

Functions

cubic_bezier_derivative_eval(p, t)[source]
cubic_bezier_eval(p, t)[source]
get_corners(g, i, j)[source]
get_points_along_cubic_bezier(params, invert=False)[source]
get_points_along_line(params, invert=False)[source]
get_points_per_tile(grid, perimeter_points, max_pp=500)[source]
params_to_tensor(params)[source]
point_to_tensor(point)[source]
point_to_tensor2(point)[source]
project_onto_cubic_bezier(params, point, invert=False)[source]
project_onto_line(params, point, invert=False)[source]
tile_region(perimeter_points, tile_size, random_perturbation=0.0, reverse_points=False, color=Color([0.5137, 0.7569, 0.4039, 0.0000, 1.0000]), **kwargs)[source]

perimeter_points: Tensor[num_points, 2]: collection of points outlining the perimeter of the region to be tiled. perimeter_normals: Tensor[num_points, 2]: unit vectors pointing in direction from perimeter_point out of the region. tile_size: size of each tile. random_perturbation: strength of random perturbation applied to tile corners.

tile_region2(perimeter_points, perimeter_normals=None, tile_size=20, random_perturbation=0, color=Color([1., 1., 1., 0., 1.]), **kwargs)[source]

perimeter_points: Tensor[num_points, 2]: collection of points outlining the perimeter of the region to be tiled. perimeter_normals: Tensor[num_points, 2]: unit vectors pointing in direction from perimeter_point out of the region. tile_size: size of each tile. random_perturbation: strength of random perturbation applied to tile corners.

triangulate_simple_polygon(polygons)[source]