RectangleGrid
Represents a rectangular grid structure composed of lists of Rectangle instances.
This class provides a convenient abstraction for working with 2D grids, where each cell is represented by a Rectangle. The class delegates to the underlying grid structure, which is implemented as a list of lists, allowing it to be used interchangeably with other list-based data structures.
Properties
Functions
Aligns a list of rectangles horizontally relative to a specified rectangle.
Aligns the rectangles in the list vertically to a reference rectangle. The vertical position of each rectangle is determined based on the reference rectangle and the specified vertical anchor point.
Create an alpha shape from list of Vector2
Converts this polyline into a contour of tangent-continuous circular arcs that pass through all of its points, after surface-detail.com/posts/arc-plotter.
Converts this polyline into a contour of biarcs: every pair of consecutive points is joined by two circular arcs that leave the first point in its tangent direction, meet tangentially at a joint, and arrive at the second point in its tangent direction. Unlike org.openrndr.extra.shapes.arcer.arcer, every edge is fixed by its own end tangents, so the contour is tangent-continuous everywhere, also where it closes, and an edge doesn't influence the edges after it.
Extracts a sub-block from a 2D list of rectangles based on the specified coordinates and dimensions.
Converts this polyline into a circle spline through all points, after Séquin, Lee and Yen, "Fair, G2- and C2-continuous circle splines for the interpolation of sparse data points" (Computer-Aided Design, 2005).
Converts this polyline into a clothoid spline: a contour of clothoid (Euler spiral) segments, along which the curvature changes linearly with arc length, that passes through all points.
Computes the convex hull of a list of 2D points using the Monotone chain algorithm. The convex hull is the smallest convex shape that encompasses all the points in the input list.
Computes the convex hull of a list of 2D points and returns the vertices of the hull as a set. The convex hull is the smallest convex polygon that can enclose all points in the input list.
Distributes the rectangles in the list horizontally within a specified bounding rectangle.
Distributes the rectangles in the list vertically within the given bounding rectangle. The rectangles are spaced evenly, ensuring an equal distance between them, while maintaining their original height and width.
Drops the first n columns from a 2D list of Rectangles.
Removes the last n columns from each row (inner list) within a two-dimensional list.
The shortest Dubins paths between consecutive points of this polyline, joined into a contour: the path a vehicle with minimum turning radius takes through the points. When directions is null, the direction at every point is that of the centripetal Catmull-Rom spline through the points. The path passes through every point in its direction and is tangent-continuous; between points it consists of arcs of radius and straight segments.
Converts this polyline into an elastica through all points: a minimum-energy curve (MEC), the G2 curve that minimizes its bending energy ∫κ² ds, which is the shape of a thin elastic rod threaded through pins at the points. A pin applies a force but no bending moment, so the curvature is continuous where the rod passes it.
Converts this polyline into a contour in which the corners are replaced by circular arcs of radius that keep the tangent direction continuous along the whole contour.
Distributes a list of rectangles horizontally within a given container rectangle, maintaining their relative width proportions and adding an optional gutter between them.
Fits a list of rectangles within a given vertical rectangular area. Each rectangle's height is adjusted proportionally based on its original height relative to the total height of all rectangles in the list. The rectangles are then distributed vertically, with an optional gutter spacing between them.
Retrieves a Rectangle from a two-dimensional list of Rectangles based on the specified x and y indices.
Retrieves a list of rectangles at a specific x-coordinate for a range of y-coordinates from a 2D list of rectangles.
Retrieves a sublist of Rectangle objects from a two-dimensional List given a range of indices for rows and a specific column index.
Retrieves a subgrid from a 2D list of Rectangles based on the specified ranges.
The B-spline of degree that passes through these 2D points, see interpolatingBSpline.
The B-spline of degree that passes through these 3D points, see interpolatingBSpline.
The B-spline of degree that passes through these points, after Piegl and Tiller, "The NURBS Book", algorithm A9.1.
Converts this polyline into a κ-curve, after Yan, Schiller, Wilensky, Carr and Schaefer, "κ-Curves: Interpolation at Local Maximum Curvature" (SIGGRAPH 2017): a curve of quadratic Béziers, one per point, on which every point is where the curvature of its quadratic peaks. Corners of the polyline therefore become the sharpest spots of the curve, and the curve never bends more sharply between the points than at them.
Converts this 3D polyline into a Kochanek-Bartels spline with a tension, continuity and bias per point.
Converts this polyline into a Kochanek-Bartels spline with a tension, continuity and bias per point, see List.kochanekBartels.
Converts this 3D polyline into a Kochanek-Bartels spline, for instance for a camera path, see List.kochanekBartels.
Converts this polyline into a Kochanek-Bartels spline, after Kochanek and Bartels, "Interpolating splines with local tension, continuity, and bias control" (SIGGRAPH 1984): a cubic Hermite spline through all points whose tangents are shaped by a tension, continuity and bias, see TCB. With all three 0 it is the uniform Catmull-Rom spline.
Fits a polyline with segments in a limited set of directions to this sequence of points, using the path schematisation heuristic described in Dwyer, Hurst and Merrick, "A Fast and Simple Heuristic for Metro Map Path Simplification" (ISVC 2008).
Converts this polyline into a minimum-variation curve (MVC) through all points: the G2 curve that minimizes the variation of its curvature, ∫(dκ/ds)² ds, after Moreton and Séquin, "Functional optimization for fair surface design" (SIGGRAPH 1992). The variation shrinks as a curve grows, so where the curve loops it has no minimum: the loop would inflate without end. The scale-invariant form, the variation times the cube of the curve length, is minimized instead; it has the same minimizers up to how the length is weighed in, and a circle still scores zero. Where clothoid splines let the curvature change linearly along every segment, the MVC lets it change as little as possible over the whole curve, so it is fairer still. Points on a circle give that circle, the curve with zero variation, and collinear points a straight line.
Converts this polyline into a C2 spline of Pythagorean-hodograph quintics through all points, see phQuinticSpline, as a contour of cubic Béziers within tolerance. With a non-zero offset the offset curve at that distance is returned; it is evaluated exactly, PH curves have rational offsets, and approximated within tolerance too.
The C2 interpolating spline of PH quintics through this polyline, one per edge, after Albrecht and Farouki, "Construction of C2 Pythagorean-hodograph interpolating splines by the homotopy method" (Advances in Computational Mathematics, 1996).
Selects specific columns from a two-dimensional list of rectangles. The method slices each inner list based on the provided column indices.
Slices the specified range of columns from each row of a two-dimensional list.
Subtracts a given Box from each Box in the list and returns a list of the resulting Boxes.
Subtracts a rectangle from a list of rectangles, removing overlapping areas and returning the non-overlapping parts of the original rectangles.
Selects the first n columns from each row in a 2D list of Rectangle objects.
Returns a new list where each sub-list contains only the last n elements of the original sub-list.
Transposes a 2D list of rectangles, switching rows and columns.
Extracts a uniform random sub-block of rectangles from a 2D list within the specified constraints.