public class PGS_Construction extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PGS_Construction.SierpinskiTriCurveType |
Modifier and Type | Method and Description |
---|---|
static processing.core.PShape |
createArbelos(double centerX,
double centerY,
double radius,
double notchPosition)
Creates an Arbelos shape, a mathematical figure bounded by three semicircles.
|
static processing.core.PShape |
createArc(double centerX,
double centerY,
double width,
double height,
double orientation,
double angle)
Creates an elliptical arc polygon (a slice of a circle).
|
static processing.core.PShape |
createBlobbie(double centerX,
double centerY,
double maxWidth,
double a,
double b,
double c,
double d)
Creates a "blob"-like shape.
|
static processing.core.PShape |
createFermatSpiral(double centerX,
double centerY,
double coils,
double outerRadius)
Creates Fermat's spiral, a parabolic spiral which is symmetrical about the
origin.
|
static processing.core.PShape |
createGear(double centerX,
double centerY,
double radius,
int n)
Creates a gear shape from a parametric gear curve.
|
static processing.core.PShape |
createHeart(double centerX,
double centerY,
double width)
Creates a heart shape.
|
static processing.core.PShape |
createHilbertCurve(double width,
double height,
int order)
Creates a Hilbert Curve shape, a type of plane-filling curve.
|
static processing.core.PShape |
createKochSnowflake(double width,
double height,
int order)
Creates a Koch Snowflake shape, a fractal curve.
|
static processing.core.PShape |
createLinearSpiral(double centerX,
double centerY,
double coils,
double outerRadius)
Creates an linear/archimedean spiral shape, where the distance between any 2
successive windings is constant.
|
static processing.core.PShape |
createRandomBezierPolygon(int nPoints,
double scale,
double radius,
double spikiness,
long seed)
Generates a smooth or spiky random polygon comprising Bezier curves.
|
static processing.core.PShape |
createRandomPolygon(int n,
double maxWidth,
double maxHeight)
Generates a random simple convex polygon (n-gon).
|
static processing.core.PShape |
createRandomPolygon(int n,
double maxWidth,
double maxHeight,
long seed)
Generates a random simple convex polygon (n-gon), having a given random seed.
|
static processing.core.PShape |
createRandomPolygonExact(int n,
double width,
double height)
Generates a random simple convex polygon (n-gon), where the output's bounding
box has the dimensions of those specified.
|
static processing.core.PShape |
createRandomPolygonExact(int n,
double width,
double height,
long seed)
Generates a random simple convex polygon (n-gon), where the output's bounding
box has the dimensions of those specified.
|
static processing.core.PShape |
createRandomSFCurve(int nColumns,
int nRows,
double cellWidth,
double cellHeight)
Creates a random space-filling curve.
|
static processing.core.PShape |
createRandomSFCurve(int nColumns,
int nRows,
double cellWidth,
double cellHeight,
long seed)
Creates a random space-filling curve, having a specific random seed.
|
static processing.core.PShape |
createRectangularSpiral(float x,
float y,
float width,
float height,
float spacing)
Creates a rectangular-shaped spiral shape.
|
static processing.core.PShape |
createRing(double centerX,
double centerY,
double outerRadius,
double innerRadius)
Creates a joined ring (a "donut") shape.
|
static processing.core.PShape |
createRing(double centerX,
double centerY,
double outerRadius,
double innerRadius,
double orientation,
double angle)
Creates an (un)joined ring shape.
|
static processing.core.PShape |
createSierpinskiCarpet(double width,
double height,
int order)
Creates a Sierpiński Carpet shape, a type of plane fractal.
|
static processing.core.PShape |
createSierpinskiCurve(double centerX,
double centerY,
double width,
int curveOrder)
Creates a closed Sierpiński curve (a recursive space-filling curve), having a
user-defined degree/order.
|
static processing.core.PShape |
createSierpinskiTriCurve(PGS_Construction.SierpinskiTriCurveType type,
double width,
int order)
Creates one of a family of trifurcating Sierpinski curves.
|
static processing.core.PShape |
createSponge(double width,
double height,
int generators,
double thickness,
double smoothing,
int classes,
long seed)
Creates a sponge-like porous structure.
|
static processing.core.PShape |
createStar(double centerX,
double centerY,
int numRays,
double innerRadius,
double outerRadius,
double roundness)
Creates a star shape, having a specified number of rays.
|
static processing.core.PShape |
createSupercircle(double centerX,
double centerY,
double width,
double height,
double power)
Creates a supercircle shape.
|
static processing.core.PShape |
createSuperRandomPolygon(double dimensions,
int cells,
double markFraction,
int smoothing,
int depth,
boolean orthogonal,
boolean holes,
long seed)
Generates a highly customisable random polygon based on a square grid of NxN
cells.
|
static processing.core.PShape |
createSuperShape(double centerX,
double centerY,
double radius,
double m,
double n1,
double n2,
double n3)
Creates a supershape PShape.
|
static processing.core.PShape |
createTaijitu(double centerX,
double centerY,
double radius)
Creates a Taijitu shape (a geometric representation of the Taoist
symbol of yin and yang).
|
static processing.core.PShape |
createTeardrop(double centerX,
double centerY,
double height,
double m)
Creates a teardrop shape from a parametric curve.
|
public static processing.core.PShape createRandomPolygon(int n, double maxWidth, double maxHeight)
n
- number of polygon vertices/sidesmaxWidth
- maximum width of generated random polygonmaxHeight
- maximum height of generated random polygon#createRandomPolygonExact(int, double, double)
createRandomPolygonExact()} to specify exact dimensions
public static processing.core.PShape createRandomPolygon(int n, double maxWidth, double maxHeight, long seed)
n
- number of polygon vertices/sidesmaxWidth
- maximum width of generated random polygonmaxHeight
- maximum height of generated random polygonseed
- a seed value used to generate the random polygon (optional)#createRandomPolygonExact(int, double, double, long)
createRandomPolygonExact()} to specify exact dimensions
public static processing.core.PShape createRandomPolygonExact(int n, double width, double height)
n
- number of polygon vertices/sideswidth
- width of generated random polygonheight
- height of generated random polygonpublic static processing.core.PShape createRandomPolygonExact(int n, double width, double height, long seed)
n
- number of polygon vertices/sideswidth
- width of generated random polygonheight
- height of generated random polygonseed
- a seed value used to generate the random polygonpublic static processing.core.PShape createSupercircle(double centerX, double centerY, double width, double height, double power)
centerX
- centre point XcenterY
- centre point Ywidth
- height
- power
- circularity of super circle. Values less than 1 create
star-like shapes; power=1 is a square;public static processing.core.PShape createSuperShape(double centerX, double centerY, double radius, double m, double n1, double n2, double n3)
centerX
- centre point XcenterY
- centre point Yradius
- maximum radiusm
- specifies the rotational symmetry of the shape (3 = 3 sided; 4
= 4 sided)n1
- supershape parameter 1n2
- supershape parameter 2n3
- supershape parameter 3public static processing.core.PShape createArc(double centerX, double centerY, double width, double height, double orientation, double angle)
centerX
- centre point XcenterY
- centre point Ywidth
- height
- orientation
- start angle/orientation in radians (where 0 is 12 o'clock)angle
- size of the arc angle in radianspublic static processing.core.PShape createTaijitu(double centerX, double centerY, double radius)
centerX
- the x-coordinate of the center of the shapecenterY
- the y-coordinate of the center of the shaperadius
- the radius of the shapepublic static processing.core.PShape createArbelos(double centerX, double centerY, double radius, double notchPosition)
The position of the central notch is arbitrary and can be located anywhere along the diameter.
centerX
- the x-coordinate of the center of the shapecenterY
- the y-coordinate of the center of the shaperadius
- radius of the largest (enclosing) circlenotchPosition
- the fractional position, between 0 and 1, along the
diameter where the notch will bepublic static processing.core.PShape createStar(double centerX, double centerY, int numRays, double innerRadius, double outerRadius, double roundness)
centerX
- The x coordinate of the centercenterY
- The y coordinate of the centernumRays
- The number of rays the star hasinnerRadius
- The inner radius of the starouterRadius
- The outer radius of the starroundness
- A roundness value between 0.0 and 1.0, for the inner and
outer corners of the star.public static processing.core.PShape createBlobbie(double centerX, double centerY, double maxWidth, double a, double b, double c, double d)
In order for the shape to not self intersect a + b should be less than 1.
centerX
- The x coordinate of the centercenterY
- The y coordinate of the centermaxWidth
- a
- blob parameter. a + b should be less than 1b
- blob parameter.a + b should be less than 1c
- blob parameterd
- blob parameterpublic static processing.core.PShape createHeart(double centerX, double centerY, double width)
centerX
- The x coordinate of the center of the heartcenterY
- The y coordinate of the center of the heartwidth
- Maximum width of the widest part of the heartpublic static processing.core.PShape createTeardrop(double centerX, double centerY, double height, double m)
centerX
- The x coordinate of the center of the teardropcenterY
- The y coordinate of the center of the teardropheight
- height of the teardropm
- order of the curve. Values of [2...5] give good resultspublic static processing.core.PShape createGear(double centerX, double centerY, double radius, int n)
centerX
- The x coordinate of the center of the gearcenterY
- The y coordinate of the center of the gearradius
- maximum radius of gear teethn
- number of gear teethpublic static processing.core.PShape createRing(double centerX, double centerY, double outerRadius, double innerRadius)
centerX
- the x coordinate of the centercenterY
- the y coordinate of the centerouterRadius
- radius of ring exteriorinnerRadius
- radius of ring holepublic static processing.core.PShape createRing(double centerX, double centerY, double outerRadius, double innerRadius, double orientation, double angle)
centerX
- the x coordinate of the centercenterY
- the y coordinate of the centerouterRadius
- radius of ring exteriorinnerRadius
- radius of ring holeorientation
- start angle/orientation in radians (where 0 is 12 o'clock)angle
- size of the ring arc angle in radianspublic static processing.core.PShape createSponge(double width, double height, int generators, double thickness, double smoothing, int classes, long seed)
The sponge structure is formed by randomly merging adjacent cells of a Voronoi tessellation and then smoothing them; the final structure is obtained by subtracting that result from a rectangle.
width
- the width of the sponge boundsheight
- the height of the sponge boundsgenerators
- the number of generator points for the underlying Voronoi
tessellation. Should be >5.thickness
- thickness of sponge structure wallssmoothing
- the cell smoothing factor which determines how rounded the
cells are. a value of 6 is a good starting point.classes
- the number of classes to use for the cell merging process,
where lower results in more merging (or larger "blob-like"
shapes).seed
- the seed for the random number generatorpublic static processing.core.PShape createLinearSpiral(double centerX, double centerY, double coils, double outerRadius)
centerX
- the x coordinate of the spiral center point / origincenterY
- the y coordinate of the spiral center point / origincoils
- number of coils/rotations in the spiralouterRadius
- the outer-most radius of the spiral / final coilpublic static processing.core.PShape createFermatSpiral(double centerX, double centerY, double coils, double outerRadius)
centerX
- the x coordinate of the spiral center point / origincenterY
- the y coordinate of the spiral center point / origincoils
- number of coils/rotations in the spiralouterRadius
- the outer-most radius of the spiral / final coilpublic static processing.core.PShape createRectangularSpiral(float x, float y, float width, float height, float spacing)
x
- x position of the top-left of spiraly
- y position of the top-left of spiralwidth
- width of outer-most coilheight
- height of outer-most coilspacing
- the distance between successive coilspublic static processing.core.PShape createRandomSFCurve(int nColumns, int nRows, double cellWidth, double cellHeight)
A space-filling curve is a continuous curve that (in this case) traverses every cell of a grid exactly once.
nColumns
- number of columns in the underlying gridnRows
- number of rows in the underlying gridcellWidth
- visual/pixel width of each cellcellHeight
- visual/pixel width of each cellcreateRandomSFCurve(int, int, double, double, long)
public static processing.core.PShape createRandomSFCurve(int nColumns, int nRows, double cellWidth, double cellHeight, long seed)
A space-filling curve is a continuous curve that (in this case) traverses every cell of a grid exactly once.
nColumns
- number of columns in the underlying gridnRows
- number of rows in the underlying gridcellWidth
- visual/pixel width of each cellcellHeight
- visual/pixel width of each cellseed
- random seedcreateRandomSFCurve(int, int, double, double)
public static processing.core.PShape createSuperRandomPolygon(double dimensions, int cells, double markFraction, int smoothing, int depth, boolean orthogonal, boolean holes, long seed)
The number of vertices of the polygon generated is not configurable, but
depends on the size of cells
and the percentage
markPercent
: for larger values of cells
, the more
vertices the polygon tends to have for a given markPercent.
Visually pleasing "random" polygons can be achieved by selecting fairly small
values for markFraction, e.g., markFraction=0.1
or even
markPercent=0.01
.
dimensions
- pixel dimensions of the polygon in its longest axis.cells
- the number of cells in the X and Y directions of the
grid.markFraction
- The fraction of vertices marked on the grid. The larger
the percentage, the more vertices the polygon tends to
have. Should generally be between 0...0.5.holes
- If true, generates a holes in the polygon.orthogonal
- Whether the polygon vertices lie exactly on integer grid
points and only form horizontal and vertical lines.smoothing
- The number of rounds of corner cutting to apply to the
polygon. A small positive integer value is recommended. A
value of 3 is probably sufficient.depth
- The number of rounds of recursive refinement to apply to
the polygon generated. A small positive integer value is
recommended. This is akin to increasing the depth of
fractal curve.seed
- the seed for the random number generatorpublic static processing.core.PShape createRandomBezierPolygon(int nPoints, double scale, double radius, double spikiness, long seed)
nPoints
- The number of bezier curves the polygon consists of.scale
- Polygon scale. Determines the maximum width or height the
polygon could have.radius
- The radius relative to the distance between adjacent points.
The radius is used to position the control points of the
bezier curve, should be between 0 and 1. Larger values
result in sharper features on the curve.spikiness
- A measure of the curve's smoothness. If 0, the curve's angle
through each point will be the average between the direction
to adjacent points. As it increases, the angle will be
determined mostly by one adjacent point, making the curve
more "spiky".seed
- the seed for the random number generatorpublic static processing.core.PShape createSierpinskiCurve(double centerX, double centerY, double width, int curveOrder)
centerX
- the x coordinate of the curve center pointcenterY
- the y coordinate of the curve center pointwidth
- length (the maximum width and height) of the curve (the
curve will approach this width as the curve order is
increased and more space is filled)curveOrder
- the order of the curve (the number of recursive
subdivisions). Must be 1 or greater.public static processing.core.PShape createHilbertCurve(double width, double height, int order)
width
- pixel width of the curveheight
- pixel height of the curveorder
- order of the hilbert curve. should be at least 0public static processing.core.PShape createSierpinskiCarpet(double width, double height, int order)
width
- pixel width of the curveheight
- pixel height of the curveorder
- the number of recursive subdivisions (at least 0, probably no
more than 5)public static processing.core.PShape createKochSnowflake(double width, double height, int order)
width
- pixel width of the curve's envelopeheight
- pixel width of the curve's envelopeorder
- the number of recursive subdivisions (at least 0)public static processing.core.PShape createSierpinskiTriCurve(PGS_Construction.SierpinskiTriCurveType type, double width, int order)
type
- the type of tri-curve: {TRI, TETRA, PENTA, DECA}width
- pixel width of the curve's envelopeorder
- the number of recursive subdivisions (at least 1)Copyright © 2023. All rights reserved.