PatchClip
The part of a Bezier patch inside a shape, tessellated: the counterpart of org.openrndr.extra.shapes.distort.envelope for the area of a shape instead of its outline. The x and y of the shape in the basis rectangle give the u and v on the patch, as they do for the envelope, so the rim of the surface follows the enveloped outline.
The tessellation is made in the u, v square, once: the shape is triangulated and its triangles are clipped to a grid of gridSize by gridSize cells, so that no triangle spans more than a cell and the surface bends with the patch inside the shape too. Neighbouring triangles share their corners, and the edges of the shape are split where they cross the grid, so the surface has no cracks. Since the tessellation does not depend on the control points of the patch, vertices can map it onto a patch that changes, frame by frame.
Parameters
the rectangle of the shape that maps to the whole patch
the number of grid cells along u and along v
the tolerance of the outline of the shape as it is sampled, in the coordinates of basis
how the contours of the shape fill it
true to keep only the part of the shape on the patch, where u and v are from 0 to 1; false to keep all of it, where the patch is extrapolated beyond its edges
Constructors
Functions
The triangles of the surface on patch, three vertices each. With a thickness of 0 it is the surface itself, facing along the normal of the patch. Otherwise it is a solid between the surface and its offset by thickness along the normal (against it when negative): a face at either side, facing away from the solid, and walls along the rim, facing out. Triangles are wound counterclockwise seen from where their normals point. Texture coordinates are the u and v of the patch.