Package micycle.pgs

Class PGS_Tiling

java.lang.Object
micycle.pgs.PGS_Tiling

public final class PGS_Tiling extends Object
Tiling, tessellation and subdivision of the plane using periodic or non-periodic geometric shapes.

A tiling is created when a collection of tiles fills a plane such that no gaps occur between the tiles and no two tiles overlap each other.

Naming convention in this class:
Methods ending with "subdivision" recursively break the plane down into smaller and smaller shapes, usually of the same geometric type at each step (for example, rectangles are split into smaller rectangles).
Methods ending with "division" split the plane all at once, in a single step, often by making several cuts or slices, with no recursion.

Since:
1.2.0
Author:
Michael Carleton
  • Method Summary

    Modifier and Type
    Method
    Description
    static processing.core.PShape
    annularBricks(int nRings, double cx, double cy, double innerRadius, double ringGrowth, double segGrowth)
    Generates a geometric arrangement composed of annular-sector bricks arranged in concentric circular rings.
    static processing.core.PShape
    arcDivision(double width, double height, int arcs, long seed)
    Creates a cellular partition of the plane using arcs formed by circles seeded along its boundary.
    static List<processing.core.PVector>
    doyleSpiral(double centerX, double centerY, int p, int q, double maxRadius)
    Generates a Doyle spiral.
    static processing.core.PShape
    hatchSubdivision(double width, double height, int gridCountX, int gridCountY, long seed)
    Randomly subdivides the plane into equal-width strips having varying lengths.
    static processing.core.PShape
    hexTiling(double width, double height, double sideLength, boolean flat)
    Generates a hexagonal tiling of the plane.
    static processing.core.PShape
    islamicTiling(double width, double height, double w, double h)
    Generates an "islamic-style" (Girih) tiling of the plane.
    static processing.core.PShape
    penroseTiling(double centerX, double centerY, double radius, int steps)
    Generates a Penrose Tiling (consisting of rhombi).
    static processing.core.PShape
    quadSubdivision(double width, double height, int depth)
    Recursively and randomly subdivides the given/bounded plane into convex quad polygons.
    static processing.core.PShape
    quadSubdivision(double width, double height, int depth, long seed)
    Recursively and randomly subdivides the given/bounded plane into convex quad polygons.
    static processing.core.PShape
    rectSubdivision(double width, double height, int maxDepth)
    Recursively and randomly subdivides the given/bounded plane into rectangles.
    static processing.core.PShape
    rectSubdivision(double width, double height, int maxDepth, long seed)
    Recursively and randomly subdivides the given/bounded plane into rectangles.
    static processing.core.PShape
    sliceDivision(double width, double height, int slices, boolean forceOpposite, long seed)
    Divides the plane into randomly “sliced” polygonal regions.
    static processing.core.PShape
    squareTriangleTiling(double width, double height, double tileSize)
    Generates a non-periodic tiling, comprising squares and equilateral triangles.
    static processing.core.PShape
    squareTriangleTiling(double width, double height, double tileSize, long seed)
    Generates a non-periodic tiling, comprising squares and equilateral triangles, having a given seed.
    static processing.core.PShape
    triangleSubdivision(double width, double height, int maxDepth)
    Recursively and randomly subdivides the given/bounded plane into triangles.
    static processing.core.PShape
    triangleSubdivision(double width, double height, int maxDepth, long seed)
    Recursively and randomly subdivides the given/bounded plane into triangles.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • rectSubdivision

      public static processing.core.PShape rectSubdivision(double width, double height, int maxDepth)
      Recursively and randomly subdivides the given/bounded plane into rectangles.
      Parameters:
      width - width of the quad subdivision plane
      height - height of the quad subdivision plane
      maxDepth - maximum number of subdivisions (recursion depth)
      Returns:
      a GROUP PShape, where each child shape is a face of the subdivision
      See Also:
    • rectSubdivision

      public static processing.core.PShape rectSubdivision(double width, double height, int maxDepth, long seed)
      Recursively and randomly subdivides the given/bounded plane into rectangles.
      Parameters:
      width - width of the quad subdivision plane
      height - height of the quad subdivision plane
      maxDepth - maximum number of subdivisions (recursion depth)
      seed - the random seed
      Returns:
      a GROUP PShape, where each child shape is a face of the subdivision
      See Also:
    • triangleSubdivision

      public static processing.core.PShape triangleSubdivision(double width, double height, int maxDepth)
      Recursively and randomly subdivides the given/bounded plane into triangles.
      Parameters:
      width - width of the subdivision plane
      height - height of the subdivision plane
      maxDepth - maximum number of subdivisions (recursion depth)
      Returns:
      a GROUP PShape, where each child shape is a face of the subdivision
      See Also:
    • triangleSubdivision

      public static processing.core.PShape triangleSubdivision(double width, double height, int maxDepth, long seed)
      Recursively and randomly subdivides the given/bounded plane into triangles.
      Parameters:
      width - width of the subdivision plane
      height - height of the subdivision plane
      maxDepth - maximum number of subdivisions (recursion depth)
      seed - the random seed
      Returns:
      a GROUP PShape, where each child shape is a face of the subdivision
      See Also:
    • quadSubdivision

      public static processing.core.PShape quadSubdivision(double width, double height, int depth)
      Recursively and randomly subdivides the given/bounded plane into convex quad polygons.
      Parameters:
      width - width of the plane that is subdivided
      height - height of the plane that is subdivided
      depth - number of subdivisions (recursion depth)
      Returns:
      a GROUP PShape, where each child shape is a face of the subdivision
      See Also:
    • quadSubdivision

      public static processing.core.PShape quadSubdivision(double width, double height, int depth, long seed)
      Recursively and randomly subdivides the given/bounded plane into convex quad polygons.
      Parameters:
      width - width of the quad subdivision plane
      height - height of the quad subdivision plane
      depth - number of subdivisions (recursion depth)
      seed - the random seed
      Returns:
      a GROUP PShape, where each child shape is a face of the subdivision
      See Also:
    • hatchSubdivision

      public static processing.core.PShape hatchSubdivision(double width, double height, int gridCountX, int gridCountY, long seed)
      Randomly subdivides the plane into equal-width strips having varying lengths.
      Parameters:
      width - width of the subdivision plane
      height - height of the subdivision plane
      gridCountX - horizontal grid count
      gridCountY - vertical grid count
      seed - the random seed
      Returns:
      a GROUP PShape, where each child shape is a face of the subdivision
      Since:
      1.3.0
    • sliceDivision

      public static processing.core.PShape sliceDivision(double width, double height, int slices, boolean forceOpposite, long seed)
      Divides the plane into randomly “sliced” polygonal regions.

      slices random cuts are generated across the plane (dimensions w×h, at (0,0)). Each cut connects a random point on one side of the plane to a random point on another side. If forceOpposite is true, each cut always connects opposite sides; otherwise the two sides are chosen at random (but never the same side).

      In practice:

      • forceOpposite == true → mostly long, quadrilateral strips that span the full width or height of the rectangle.
      • forceOpposite == false → a richer variety of cell shapes (triangles, trapezoids, L-shapes, etc.) that may not stretch all the way across.

      Parameters:
      width - the width of the plane
      height - the height of the plane
      slices - the number of random interior cuts to perform
      forceOpposite - if true, each cut connects opposite sides of the rectangle; if false, cuts connect any two distinct sides
      seed - the random seed for reproducible slice placement
      Returns:
      a GROUP PShape containing the subdivided polygonal regions
      Since:
      2.1
    • arcDivision

      public static processing.core.PShape arcDivision(double width, double height, int arcs, long seed)
      Creates a cellular partition of the plane using arcs formed by circles seeded along its boundary. Each circle’s radius is chosen large enough to guarantee it intersects at least two distinct sides of the plane, forming an arc cut.

      In practice:

      • You get a “cellular” subdivision where each circle carves out roughly circular holes or bulges against the rectangle boundary.
      • Because every radius ≥ the minimum distance to a second side, each circle always spans at least two sides (forming an arc).

      Parameters:
      width - the width of the plane
      height - the height of the plane
      arcs - the number of circles to seed along the boundary
      circlePoints - the number of linear segments used to approximate each circle
      seed - the random seed for reproducible circle placement & radii
      Returns:
      a GROUP PShape containing the polygonal faces formed by the plane plus the seeded circles
      Since:
      2.1
    • doyleSpiral

      public static List<processing.core.PVector> doyleSpiral(double centerX, double centerY, int p, int q, double maxRadius)
      Generates a Doyle spiral. A Doyle spiral fills the plane with closely packed circles, where the radius of each circle in a packing is proportional to the distance of its centre from a central point. Each circle is tangent to six others that surround it by a ring of tangent circles
      Parameters:
      centerX - x coordinate of the center of the spiral
      centerY - y coordinate of the center of the spiral
      p - at least 2
      q - at least p + 1
      maxRadius - the maximum radius of the packing arrangement (the maximum distance a circle centroid can be from the center of the arrangement)
      Returns:
      A list of PVectors, each representing one circle in the spiral: (.x, .y) represent the center point and .z represents radius.
    • hexTiling

      public static processing.core.PShape hexTiling(double width, double height, double sideLength, boolean flat)
      Generates a hexagonal tiling of the plane.
      Parameters:
      width - width of the tiling plane
      height - height of the tiling plane
      sideLength - side length of each hexagon
      flat - determines the orientation of the hexagons -- whether the top is flat, or pointy
      Returns:
      a GROUP PShape, where each child shape is a hexagon of the tiling
    • islamicTiling

      public static processing.core.PShape islamicTiling(double width, double height, double w, double h)
      Generates an "islamic-style" (Girih) tiling of the plane.
      Parameters:
      width - width of the tiling plane
      height - height of the tiling plane
      w -
      h -
      Returns:
      a GROUP PShape, where each child shape is a tile of the tiling
    • penroseTiling

      public static processing.core.PShape penroseTiling(double centerX, double centerY, double radius, int steps)
      Generates a Penrose Tiling (consisting of rhombi).
      Parameters:
      centerX - x coordinate of the center/origin of the tiling
      centerY - y coordinate of the center/origin of the tiling
      radius - maximum radius of the tiling (measured from the center)
      steps - number of tiling subdivisions
      Returns:
      a GROUP PShape, where each child shape is a face of the tiling
    • squareTriangleTiling

      public static processing.core.PShape squareTriangleTiling(double width, double height, double tileSize)
      Generates a non-periodic tiling, comprising squares and equilateral triangles.
      Parameters:
      width - width of the tiling plane
      height - height of the tiling plane
      tileSize - diameter of each tile
      Returns:
      a GROUP PShape, where each child shape is a tile of the tiling
      Since:
      1.3.0
    • squareTriangleTiling

      public static processing.core.PShape squareTriangleTiling(double width, double height, double tileSize, long seed)
      Generates a non-periodic tiling, comprising squares and equilateral triangles, having a given seed.
      Parameters:
      width - width of the tiling plane
      height - height of the tiling plane
      tileSize - diameter of each tile
      seed - the random seed
      Returns:
      a GROUP PShape, where each child shape is a tile of the tiling
      Since:
      1.3.0
    • annularBricks

      public static processing.core.PShape annularBricks(int nRings, double cx, double cy, double innerRadius, double ringGrowth, double segGrowth)
      Generates a geometric arrangement composed of annular-sector bricks arranged in concentric circular rings. Rings progressively expand from the inside out based on the growth rates provided. Brick sizes (arc length) adapt radially according to growth factors.
      Parameters:
      nRings - Number of annular rings to generate.
      cx - The x-coordinate of the center of the generated pattern.
      cy - The y-coordinate of the center of the generated pattern.
      innerRadius - The radius of the innermost ring in pixels.
      ringGrowth - The growth factor of each successive ring radius; values greater than 1.0 cause rings to expand radially outward.
      segGrowth - The growth factor controlling segment (brick) arc length adjustment along each ring; values greater than 1.0 increase brick length progressively outward.
      Returns:
      A single flattened PShape consisting of annular-sector bricks forming concentric rings around the specified center point (cx, cy).
      Since:
      2.1